Re: Switch APIC (+nmi, +oprofile) to driver model

From: Pavel Machek (pavel@suse.cz)
Date: Sun Feb 16 2003 - 07:05:16 EST


Hi!

> Here is my modified version of Pavel's latest patch to convert
> apm/apic/nmi to the driver model. It's a minimalistic patch,
> intendended ONLY to convert the old-fashioned PM support code
> to the driver model. It seems to work for me, except that
> initiating a suspend (via apm --suspend) triggers a BUG_ON
> somewhere in ide-disk.c, which prevents the suspend and causes a
> hang at shutdown.

> --- linux-2.5.60/arch/i386/kernel/apm.c.~1~ 2003-02-10 23:36:54.000000000 +0100
> +++ linux-2.5.60/arch/i386/kernel/apm.c 2003-02-12 21:01:51.000000000 +0100
> @@ -218,6 +218,7 @@
> #include <linux/time.h>
> #include <linux/sched.h>
> #include <linux/pm.h>
> +#include <linux/device.h>
> #include <linux/kernel.h>
> #include <linux/smp.h>
> #include <linux/smp_lock.h>
> @@ -1263,6 +1264,11 @@
> }
> printk(KERN_CRIT "apm: suspend was vetoed, but suspending anyway.\n");
> }
> +
> + device_suspend(3, SUSPEND_NOTIFY);
> + device_suspend(3, SUSPEND_SAVE_STATE);

Comment these two lines... and all RESTORE_STATEs. System needs to be
stopped in order for SAVE_STATE to work, and it is not in apm case.

> +static struct device_driver local_apic_nmi_driver = {
> + .name = "local_apic_nmi",
> + .bus = &system_bus_type,
> + .resume = nmi_resume,
> + .suspend = nmi_suspend,
> +};

Do you think it is neccessary to call it "*local_*apic_nmi_driver"? It
seems way too long.

> +extern struct sys_device device_local_apic;
> +
> +static struct sys_device device_local_apic_nmi = {
> + .name = "local_apic_nmi",
> + .id = 0,
> + .dev = {
> + .name = "local_apic_nmi",
> + .driver = &local_apic_nmi_driver,
> + .parent = &device_local_apic.dev,
> + },
> +};

Why did you convert device_apic_nmi to *sys_*device?

> @@ -402,3 +423,7 @@
> wrmsr(nmi_perfctr_msr, -(cpu_khz/nmi_hz*1000), -1);
> }
> }
> +
> +EXPORT_SYMBOL(nmi_watchdog);
> +EXPORT_SYMBOL(disable_local_apic_nmi_watchdog);
> +EXPORT_SYMBOL(enable_local_apic_nmi_watchdog);

This is good, if we have disable_, we should have enable_, not setup_;
but I killed _local_ part as it is way too long, then.

                                                                Pavel

-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Feb 23 2003 - 22:00:14 EST