Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 17541
b: refs/heads/master
c: 51be560
h: refs/heads/master
i:
  17539: d6aa8e5
v: v3
  • Loading branch information
Vivek Goyal authored and Linus Torvalds committed Jan 10, 2006
1 parent a796835 commit 57e4659
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cc57165874e938ef684d71ba7d36e7088b551489
refs/heads/master: 51be5606d9ff9eb27ed6514f6172fbd7578a25d6
32 changes: 32 additions & 0 deletions trunk/drivers/base/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,33 @@ static inline void register_cpu_control(struct cpu *cpu)
}
#endif /* CONFIG_HOTPLUG_CPU */

#ifdef CONFIG_KEXEC
#include <linux/kexec.h>

static ssize_t show_crash_notes(struct sys_device *dev, char *buf)
{
struct cpu *cpu = container_of(dev, struct cpu, sysdev);
ssize_t rc;
unsigned long long addr;
int cpunum;

cpunum = cpu->sysdev.id;

/*
* Might be reading other cpu's data based on which cpu read thread
* has been scheduled. But cpu data (memory) is allocated once during
* boot up and this data does not change there after. Hence this
* operation should be safe. No locking required.
*/
get_cpu();
addr = __pa(per_cpu_ptr(crash_notes, cpunum));
rc = sprintf(buf, "%Lx\n", addr);
put_cpu();
return rc;
}
static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL);
#endif

/*
* register_cpu - Setup a driverfs device for a CPU.
* @cpu - Callers can set the cpu->no_control field to 1, to indicate not to
Expand All @@ -108,6 +135,11 @@ int __devinit register_cpu(struct cpu *cpu, int num, struct node *root)
register_cpu_control(cpu);
if (!error)
cpu_sys_devices[num] = &cpu->sysdev;

#ifdef CONFIG_KEXEC
if (!error)
error = sysdev_create_file(&cpu->sysdev, &attr_crash_notes);
#endif
return error;
}

Expand Down
13 changes: 0 additions & 13 deletions trunk/kernel/ksysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,13 @@ static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, s
KERNEL_ATTR_RW(uevent_helper);
#endif

#ifdef CONFIG_KEXEC
#include <asm/kexec.h>

static ssize_t crash_notes_show(struct subsystem *subsys, char *page)
{
return sprintf(page, "%p\n", (void *)crash_notes);
}
KERNEL_ATTR_RO(crash_notes);
#endif

decl_subsys(kernel, NULL, NULL);
EXPORT_SYMBOL_GPL(kernel_subsys);

static struct attribute * kernel_attrs[] = {
#ifdef CONFIG_HOTPLUG
&uevent_seqnum_attr.attr,
&uevent_helper_attr.attr,
#endif
#ifdef CONFIG_KEXEC
&crash_notes_attr.attr,
#endif
NULL
};
Expand Down

0 comments on commit 57e4659

Please sign in to comment.