Wei, Gang
2009-Oct-14 09:26 UTC
[Xen-devel] [PATCH] Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET
Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET Xen is using HPET to wakeup cpu from deep c-states, so the HPET usage in dom0 must be fobidden. In 2.6.18-xen, the HPET was by default disabled in config file. For upstream kernel built for pv dom0, it is not practical to disable dom0 HPET usage in that way because the same image may be also using as bare metal kernerl. So add cmdline option to do this thing for dom0. Signed-off-by: Wei Gang <gang.wei@intel.com> diff -r 9ba855e57afb xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Tue Sep 29 20:56:30 2009 +0800 +++ b/xen/arch/x86/setup.c Tue Oct 13 22:32:13 2009 +0800 @@ -1106,6 +1106,7 @@ void __init __start_xen(unsigned long mb safe_strcat(dom0_cmdline, " acpi="); safe_strcat(dom0_cmdline, acpi_param); } + safe_strcat(dom0_cmdline, " nohpet"); cmdline = dom0_cmdline; } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2009-Oct-14 10:07 UTC
[Xen-devel] Re: [PATCH] Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET
On 14/10/2009 10:26, "Wei, Gang" <gang.wei@intel.com> wrote:> Xen is using HPET to wakeup cpu from deep c-states, so the HPET usage in dom0 > must be fobidden. In 2.6.18-xen, the HPET was by default disabled in config > file. For upstream kernel built for pv dom0, it is not practical to disable > dom0 > HPET usage in that way because the same image may be also using as bare metal > kernerl. So add cmdline option to do this thing for dom0.This Linux-version-specific cmdline construction is getting ridiculous. Surely Linux''s Xen-pv_ops code can get in early enough to add this to its own command line, if it needs it? -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jeremy Fitzhardinge
2009-Oct-14 19:58 UTC
Re: [Xen-devel] [PATCH] Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET
On 10/14/09 02:26, Wei, Gang wrote:> Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET > > Xen is using HPET to wakeup cpu from deep c-states, so the HPET usage in dom0 > must be fobidden. In 2.6.18-xen, the HPET was by default disabled in config > file. For upstream kernel built for pv dom0, it is not practical to disable dom0 > HPET usage in that way because the same image may be also using as bare metal > kernerl. So add cmdline option to do this thing for dom0. >I think it would be better to unstatic disable_hpet() and call it from Xen setup. But as far as I can see hpet_init() should never be called under Xen, because pv_time_ops won''t be pointing to it, so there won''t be any attempt to use the hpet. J _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei, Gang
2009-Oct-15 02:13 UTC
RE: [Xen-devel] [PATCH] Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET
Jeremy Fitzhardinge wrote:> On 10/14/09 02:26, Wei, Gang wrote: >> Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET >> >> Xen is using HPET to wakeup cpu from deep c-states, so the HPET >> usage in dom0 must be fobidden. In 2.6.18-xen, the HPET was by >> default disabled in config file. For upstream kernel built for pv >> dom0, it is not practical to disable dom0 HPET usage in that way >> because the same image may be also using as bare metal kernerl. So >> add cmdline option to do this thing for dom0. >> > > I think it would be better to unstatic disable_hpet() and call it from > Xen setup. But as far as I can see hpet_init() should never be called > under Xen, because pv_time_ops won''t be pointing to it, so there won''t > be any attempt to use the hpet.Call disable_hpet() in dom0 xen setup phase will disable physical hpet and break hpet usage in hypervisor. There are another path to initialize hpet: fs_initcall(hpet_late_init), hpet_late_init()->hpet_enable(). Jimmy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei, Gang
2009-Oct-15 03:31 UTC
RE: [Xen-devel] [PATCH] Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET
>>> Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET >>> >>> Xen is using HPET to wakeup cpu from deep c-states, so the HPET >>> usage in dom0 must be fobidden. In 2.6.18-xen, the HPET was by >>> default disabled in config file. For upstream kernel built for pv >>> dom0, it is not practical to disable dom0 HPET usage in that way >>> because the same image may be also using as bare metal kernerl. So >>> add cmdline option to do this thing for dom0. >> >> I think it would be better to unstatic disable_hpet() and call it >> from Xen setup. But as far as I can see hpet_init() should never be >> called under Xen, because pv_time_ops won''t be pointing to it, so >> there won''t be any attempt to use the hpet. > > Call disable_hpet() in dom0 xen setup phase will disable physical > hpet and break hpet usage in hypervisor. There are another path to > initialize hpet: fs_initcall(hpet_late_init), > hpet_late_init()->hpet_enable().Resend the updated patch which apply to pv-ops tree. diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 5eeeedb..f8a794b 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -285,6 +285,7 @@ void __init xen_arch_setup(void) memcpy(boot_command_line, xen_start_info->cmd_line, MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ? COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE); + strlcat(boot_command_line, " nohpet", COMMAND_LINE_SIZE); pm_idle = xen_idle; Jimmy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jeremy Fitzhardinge
2009-Oct-15 17:23 UTC
Re: [Xen-devel] [PATCH] Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET
On 10/14/09 19:13, Wei, Gang wrote:> Call disable_hpet() in dom0 xen setup phase will disable physical hpet and > break hpet usage in hypervisor. There are another path to initialize hpet: > fs_initcall(hpet_late_init), hpet_late_init()->hpet_enable(). >Well, making disable_hpet() non-static and calling it from Xen setup is the same as appending nohpet to the command line, but less hacky. J _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei, Gang
2009-Oct-16 01:13 UTC
RE: [Xen-devel] [PATCH] Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET
Jeremy Fitzhardinge wrote:> Well, making disable_hpet() non-static and calling it from Xen setup > is the same as appending nohpet to the command line, but less hacky.Yes, you are right. I mixed disable_hpet() with hpet_disable(). I just try to avoid changes in normal kernel code. If such slight change is acceptable, please just make it this way. Jimmy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei, Gang
2009-Oct-16 02:19 UTC
RE: [Xen-devel] [PATCH] Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET
Wei, Gang wrote:> Jeremy Fitzhardinge wrote: >> Well, making disable_hpet() non-static and calling it from Xen setup >> is the same as appending nohpet to the command line, but less hacky. > > Yes, you are right. I mixed disable_hpet() with hpet_disable(). I > just try to avoid changes in normal kernel code. If such slight > change is acceptable, please just make it this way.Here is the new patch. diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 9b32c88..366e1e5 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -96,7 +96,7 @@ static int __init hpet_setup(char *str) } __setup("hpet=", hpet_setup); -static int __init disable_hpet(char *str) +int __init disable_hpet(char *str) { boot_hpet_disable = 1; return 1; diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 5eeeedb..3774578 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -34,6 +34,10 @@ extern void xen_sysenter_target(void); extern void xen_syscall_target(void); extern void xen_syscall32_target(void); +#ifdef CONFIG_HPET_TIMER +extern int __init disable_hpet(char *str); +#endif + static unsigned long __init xen_release_chunk(phys_addr_t start_addr, phys_addr_t end_addr) { struct xen_memory_reservation reservation = { @@ -280,6 +284,10 @@ void __init xen_arch_setup(void) printk(KERN_INFO "ACPI in unprivileged domain disabled\n"); disable_acpi(); } +#endif + +#ifdef CONFIG_HPET_TIMER + disable_hpet(NULL); #endif memcpy(boot_command_line, xen_start_info->cmd_line, Jimmy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jeremy Fitzhardinge
2009-Oct-16 02:31 UTC
Re: [Xen-devel] [PATCH] Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET
On 10/15/09 19:19, Wei, Gang wrote:> Wei, Gang wrote: > >> Jeremy Fitzhardinge wrote: >> >>> Well, making disable_hpet() non-static and calling it from Xen setup >>> is the same as appending nohpet to the command line, but less hacky. >>> >> Yes, you are right. I mixed disable_hpet() with hpet_disable(). I >> just try to avoid changes in normal kernel code. If such slight >> change is acceptable, please just make it this way. >> > Here is the new patch. > > diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c > index 9b32c88..366e1e5 100644 > --- a/arch/x86/kernel/hpet.c > +++ b/arch/x86/kernel/hpet.c > @@ -96,7 +96,7 @@ static int __init hpet_setup(char *str) > } > __setup("hpet=", hpet_setup); > > -static int __init disable_hpet(char *str) > +int __init disable_hpet(char *str) > { > boot_hpet_disable = 1; > return 1; > diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c > index 5eeeedb..3774578 100644 > --- a/arch/x86/xen/setup.c > +++ b/arch/x86/xen/setup.c > @@ -34,6 +34,10 @@ extern void xen_sysenter_target(void); > extern void xen_syscall_target(void); > extern void xen_syscall32_target(void); > > +#ifdef CONFIG_HPET_TIMER > +extern int __init disable_hpet(char *str); > +#endif >It would be better to add #else static inline int disable_hpet(char *str) { return 0; } #endif> + > static unsigned long __init xen_release_chunk(phys_addr_t start_addr, phys_addr_t end_addr) > { > struct xen_memory_reservation reservation = { > @@ -280,6 +284,10 @@ void __init xen_arch_setup(void) > printk(KERN_INFO "ACPI in unprivileged domain disabled\n"); > disable_acpi(); > } > +#endif > + > +#ifdef CONFIG_HPET_TIMER > + disable_hpet(NULL); > #endif >and do without the #ifdef here. Also, it wouldn''t hurt to put a small explanatory message here. J _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Wei, Gang
2009-Oct-16 02:51 UTC
RE: [Xen-devel] [PATCH] Append ''nohpet'' in dom0 cmdline to prevent dom0 from using HPET
Resend. Disable HPET in Xen pv dom0 Xen is using HPET to wakeup cpu from deep c-states, so the HPET usage in dom0 must be fobidden. In 2.6.18-xen, the HPET was by default disabled in config file. For upstream kernel built for pv dom0, it is not practical to disable dom0 HPET usage in that way because the same image may be also using as bare metal kernerl. So do it in Xen specific setup code. Signed-off-by: Wei Gang <gang.wei@intel.com> diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 9b32c88..366e1e5 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -96,7 +96,7 @@ static int __init hpet_setup(char *str) } __setup("hpet=", hpet_setup); -static int __init disable_hpet(char *str) +int __init disable_hpet(char *str) { boot_hpet_disable = 1; return 1; diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 5eeeedb..c73381b 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -34,6 +34,12 @@ extern void xen_sysenter_target(void); extern void xen_syscall_target(void); extern void xen_syscall32_target(void); +#ifdef CONFIG_HPET_TIMER +extern int __init disable_hpet(char *str); +#else +static inline int disable_hpet(char *str) { return 0; } +#endif + static unsigned long __init xen_release_chunk(phys_addr_t start_addr, phys_addr_t end_addr) { struct xen_memory_reservation reservation = { @@ -282,6 +288,12 @@ void __init xen_arch_setup(void) } #endif + /* + * Xen hypervisor uses HPET to wakeup cpu from deep c-states, + * so the HPET usage in dom0 must be forbidden. + */ + disable_hpet(NULL); + memcpy(boot_command_line, xen_start_info->cmd_line, MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ? COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel