linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] xen: fix illegal rtc device usage of pv guests
@ 2021-09-03  8:49 Juergen Gross
  2021-09-03  8:49 ` [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data Juergen Gross
  2021-09-03  8:49 ` [PATCH 2/2] xen: reset legacy rtc flag for PV domU Juergen Gross
  0 siblings, 2 replies; 10+ messages in thread
From: Juergen Gross @ 2021-09-03  8:49 UTC (permalink / raw)
  To: xen-devel, linux-pm, linux-kernel, x86
  Cc: Juergen Gross, Rafael J. Wysocki, Len Brown, Pavel Machek,
	Greg Kroah-Hartman, Rafael J. Wysocki, stable, Boris Ostrovsky,
	Stefano Stabellini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin

A recent change in mc146818_get_time() resulted in WARN splats when
booting a Xen PV guest.

The main reason is that there is a code path resulting in accessing a
RTC device which is not present, which has been made obvious by a
call of WARN() in this case.

This small series is fixing this issue by:

- avoiding the RTC device access from drivers/base/power/trace.c in
  cast there is no legacy RTC device available
- resetting the availability flag of a legacy RTC device for Xen PV
  guests

Juergen Gross (2):
  PM: base: power: don't try to use non-existing RTC for storing data
  xen: reset legacy rtc flag for PV domU

 arch/x86/xen/enlighten_pv.c |  7 +++++++
 drivers/base/power/trace.c  | 10 ++++++++++
 2 files changed, 17 insertions(+)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data
  2021-09-03  8:49 [PATCH 0/2] xen: fix illegal rtc device usage of pv guests Juergen Gross
@ 2021-09-03  8:49 ` Juergen Gross
  2021-09-03  8:56   ` Greg Kroah-Hartman
  2021-09-03  8:49 ` [PATCH 2/2] xen: reset legacy rtc flag for PV domU Juergen Gross
  1 sibling, 1 reply; 10+ messages in thread
From: Juergen Gross @ 2021-09-03  8:49 UTC (permalink / raw)
  To: xen-devel, linux-pm, linux-kernel
  Cc: Juergen Gross, Rafael J. Wysocki, Len Brown, Pavel Machek,
	Greg Kroah-Hartman, Rafael J. Wysocki, stable

In there is no legacy RTC device, don't try to use it for storing trace
data across suspend/resume.

Cc: <stable@vger.kernel.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 drivers/base/power/trace.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
index a97f33d0c59f..b7c80849455c 100644
--- a/drivers/base/power/trace.c
+++ b/drivers/base/power/trace.c
@@ -13,6 +13,7 @@
 #include <linux/export.h>
 #include <linux/rtc.h>
 #include <linux/suspend.h>
+#include <linux/init.h>
 
 #include <linux/mc146818rtc.h>
 
@@ -165,6 +166,9 @@ void generate_pm_trace(const void *tracedata, unsigned int user)
 	const char *file = *(const char **)(tracedata + 2);
 	unsigned int user_hash_value, file_hash_value;
 
+	if (!x86_platform.legacy.rtc)
+		return 0;
+
 	user_hash_value = user % USERHASH;
 	file_hash_value = hash_string(lineno, file, FILEHASH);
 	set_magic_time(user_hash_value, file_hash_value, dev_hash_value);
@@ -267,6 +271,9 @@ static struct notifier_block pm_trace_nb = {
 
 static int __init early_resume_init(void)
 {
+	if (!x86_platform.legacy.rtc)
+		return 0;
+
 	hash_value_early_read = read_magic_time();
 	register_pm_notifier(&pm_trace_nb);
 	return 0;
@@ -277,6 +284,9 @@ static int __init late_resume_init(void)
 	unsigned int val = hash_value_early_read;
 	unsigned int user, file, dev;
 
+	if (!x86_platform.legacy.rtc)
+		return 0;
+
 	user = val % USERHASH;
 	val = val / USERHASH;
 	file = val % FILEHASH;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] xen: reset legacy rtc flag for PV domU
  2021-09-03  8:49 [PATCH 0/2] xen: fix illegal rtc device usage of pv guests Juergen Gross
  2021-09-03  8:49 ` [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data Juergen Gross
@ 2021-09-03  8:49 ` Juergen Gross
  2021-09-08 14:54   ` Boris Ostrovsky
  1 sibling, 1 reply; 10+ messages in thread
From: Juergen Gross @ 2021-09-03  8:49 UTC (permalink / raw)
  To: xen-devel, x86, linux-kernel
  Cc: Juergen Gross, Boris Ostrovsky, Stefano Stabellini,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
	stable

A Xen PV guest doesn't have a legacy RTC device, so reset the legacy
RTC flag. Otherwise the following WARN splat will occur at boot:

[    1.333404] WARNING: CPU: 1 PID: 1 at /home/gross/linux/head/drivers/rtc/rtc-mc146818-lib.c:25 mc146818_get_time+0x1be/0x210
[    1.333404] Modules linked in:
[    1.333404] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W         5.14.0-rc7-default+ #282
[    1.333404] RIP: e030:mc146818_get_time+0x1be/0x210
[    1.333404] Code: c0 64 01 c5 83 fd 45 89 6b 14 7f 06 83 c5 64 89 6b 14 41 83 ec 01 b8 02 00 00 00 44 89 63 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 <0f> 0b 48 c7 c7 30 0e ef 82 4c 89 e6 e8 71 2a 24 00 48 c7 c0 ff ff
[    1.333404] RSP: e02b:ffffc90040093df8 EFLAGS: 00010002
[    1.333404] RAX: 00000000000000ff RBX: ffffc90040093e34 RCX: 0000000000000000
[    1.333404] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000000000000000d
[    1.333404] RBP: ffffffff82ef0e30 R08: ffff888005013e60 R09: 0000000000000000
[    1.333404] R10: ffffffff82373e9b R11: 0000000000033080 R12: 0000000000000200
[    1.333404] R13: 0000000000000000 R14: 0000000000000002 R15: ffffffff82cdc6d4
[    1.333404] FS:  0000000000000000(0000) GS:ffff88807d440000(0000) knlGS:0000000000000000
[    1.333404] CS:  10000e030 DS: 0000 ES: 0000 CR0: 0000000080050033
[    1.333404] CR2: 0000000000000000 CR3: 000000000260a000 CR4: 0000000000050660
[    1.333404] Call Trace:
[    1.333404]  ? wakeup_sources_sysfs_init+0x30/0x30
[    1.333404]  ? rdinit_setup+0x2b/0x2b
[    1.333404]  early_resume_init+0x23/0xa4
[    1.333404]  ? cn_proc_init+0x36/0x36
[    1.333404]  do_one_initcall+0x3e/0x200
[    1.333404]  kernel_init_freeable+0x232/0x28e
[    1.333404]  ? rest_init+0xd0/0xd0
[    1.333404]  kernel_init+0x16/0x120
[    1.333404]  ret_from_fork+0x1f/0x30

Cc: <stable@vger.kernel.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/enlighten_pv.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 753f63734c13..349f780a1567 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1214,6 +1214,11 @@ static void __init xen_dom0_set_legacy_features(void)
 	x86_platform.legacy.rtc = 1;
 }
 
+static void __init xen_domu_set_legacy_features(void)
+{
+	x86_platform.legacy.rtc = 0;
+}
+
 /* First C function to be called on Xen boot */
 asmlinkage __visible void __init xen_start_kernel(void)
 {
@@ -1359,6 +1364,8 @@ asmlinkage __visible void __init xen_start_kernel(void)
 		add_preferred_console("xenboot", 0, NULL);
 		if (pci_xen)
 			x86_init.pci.arch_init = pci_xen_init;
+		x86_platform.set_legacy_features =
+				xen_domu_set_legacy_features;
 	} else {
 		const struct dom0_vga_console_info *info =
 			(void *)((char *)xen_start_info +
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data
  2021-09-03  8:49 ` [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data Juergen Gross
@ 2021-09-03  8:56   ` Greg Kroah-Hartman
  2021-09-03  9:01     ` Juergen Gross
  0 siblings, 1 reply; 10+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-03  8:56 UTC (permalink / raw)
  To: Juergen Gross
  Cc: xen-devel, linux-pm, linux-kernel, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Rafael J. Wysocki, stable

On Fri, Sep 03, 2021 at 10:49:36AM +0200, Juergen Gross wrote:
> In there is no legacy RTC device, don't try to use it for storing trace
> data across suspend/resume.
> 
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  drivers/base/power/trace.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
> index a97f33d0c59f..b7c80849455c 100644
> --- a/drivers/base/power/trace.c
> +++ b/drivers/base/power/trace.c
> @@ -13,6 +13,7 @@
>  #include <linux/export.h>
>  #include <linux/rtc.h>
>  #include <linux/suspend.h>
> +#include <linux/init.h>
>  
>  #include <linux/mc146818rtc.h>
>  
> @@ -165,6 +166,9 @@ void generate_pm_trace(const void *tracedata, unsigned int user)
>  	const char *file = *(const char **)(tracedata + 2);
>  	unsigned int user_hash_value, file_hash_value;
>  
> +	if (!x86_platform.legacy.rtc)
> +		return 0;

Why does the driver core code here care about a platform/arch-specific
thing at all?  Did you just break all other arches?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data
  2021-09-03  8:56   ` Greg Kroah-Hartman
@ 2021-09-03  9:01     ` Juergen Gross
  2021-09-03  9:08       ` Greg Kroah-Hartman
  2021-09-06 17:07       ` Rafael J. Wysocki
  0 siblings, 2 replies; 10+ messages in thread
From: Juergen Gross @ 2021-09-03  9:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: xen-devel, linux-pm, linux-kernel, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Rafael J. Wysocki, stable


[-- Attachment #1.1.1: Type: text/plain, Size: 1318 bytes --]

On 03.09.21 10:56, Greg Kroah-Hartman wrote:
> On Fri, Sep 03, 2021 at 10:49:36AM +0200, Juergen Gross wrote:
>> In there is no legacy RTC device, don't try to use it for storing trace
>> data across suspend/resume.
>>
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>>   drivers/base/power/trace.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
>> index a97f33d0c59f..b7c80849455c 100644
>> --- a/drivers/base/power/trace.c
>> +++ b/drivers/base/power/trace.c
>> @@ -13,6 +13,7 @@
>>   #include <linux/export.h>
>>   #include <linux/rtc.h>
>>   #include <linux/suspend.h>
>> +#include <linux/init.h>
>>   
>>   #include <linux/mc146818rtc.h>
>>   
>> @@ -165,6 +166,9 @@ void generate_pm_trace(const void *tracedata, unsigned int user)
>>   	const char *file = *(const char **)(tracedata + 2);
>>   	unsigned int user_hash_value, file_hash_value;
>>   
>> +	if (!x86_platform.legacy.rtc)
>> +		return 0;
> 
> Why does the driver core code here care about a platform/arch-specific
> thing at all?  Did you just break all other arches?

This file is only compiled for x86. It depends on CONFIG_PM_TRACE_RTC,
which has a "depends on X86" attribute.


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data
  2021-09-03  9:01     ` Juergen Gross
@ 2021-09-03  9:08       ` Greg Kroah-Hartman
  2021-09-06 17:07       ` Rafael J. Wysocki
  1 sibling, 0 replies; 10+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-03  9:08 UTC (permalink / raw)
  To: Juergen Gross
  Cc: xen-devel, linux-pm, linux-kernel, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Rafael J. Wysocki, stable

On Fri, Sep 03, 2021 at 11:01:58AM +0200, Juergen Gross wrote:
> On 03.09.21 10:56, Greg Kroah-Hartman wrote:
> > On Fri, Sep 03, 2021 at 10:49:36AM +0200, Juergen Gross wrote:
> > > In there is no legacy RTC device, don't try to use it for storing trace
> > > data across suspend/resume.
> > > 
> > > Cc: <stable@vger.kernel.org>
> > > Signed-off-by: Juergen Gross <jgross@suse.com>
> > > ---
> > >   drivers/base/power/trace.c | 10 ++++++++++
> > >   1 file changed, 10 insertions(+)
> > > 
> > > diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
> > > index a97f33d0c59f..b7c80849455c 100644
> > > --- a/drivers/base/power/trace.c
> > > +++ b/drivers/base/power/trace.c
> > > @@ -13,6 +13,7 @@
> > >   #include <linux/export.h>
> > >   #include <linux/rtc.h>
> > >   #include <linux/suspend.h>
> > > +#include <linux/init.h>
> > >   #include <linux/mc146818rtc.h>
> > > @@ -165,6 +166,9 @@ void generate_pm_trace(const void *tracedata, unsigned int user)
> > >   	const char *file = *(const char **)(tracedata + 2);
> > >   	unsigned int user_hash_value, file_hash_value;
> > > +	if (!x86_platform.legacy.rtc)
> > > +		return 0;
> > 
> > Why does the driver core code here care about a platform/arch-specific
> > thing at all?  Did you just break all other arches?
> 
> This file is only compiled for x86. It depends on CONFIG_PM_TRACE_RTC,
> which has a "depends on X86" attribute.

Odd, and not obvious at all :(

Ok, I'll let Rafael review this...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data
  2021-09-03  9:01     ` Juergen Gross
  2021-09-03  9:08       ` Greg Kroah-Hartman
@ 2021-09-06 17:07       ` Rafael J. Wysocki
  2021-09-07  4:18         ` Juergen Gross
  1 sibling, 1 reply; 10+ messages in thread
From: Rafael J. Wysocki @ 2021-09-06 17:07 UTC (permalink / raw)
  To: Juergen Gross
  Cc: Greg Kroah-Hartman, xen-devel, Linux PM,
	Linux Kernel Mailing List, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Rafael J. Wysocki, Stable

On Fri, Sep 3, 2021 at 11:02 AM Juergen Gross <jgross@suse.com> wrote:
>
> On 03.09.21 10:56, Greg Kroah-Hartman wrote:
> > On Fri, Sep 03, 2021 at 10:49:36AM +0200, Juergen Gross wrote:
> >> In there is no legacy RTC device, don't try to use it for storing trace
> >> data across suspend/resume.
> >>
> >> Cc: <stable@vger.kernel.org>
> >> Signed-off-by: Juergen Gross <jgross@suse.com>
> >> ---
> >>   drivers/base/power/trace.c | 10 ++++++++++
> >>   1 file changed, 10 insertions(+)
> >>
> >> diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
> >> index a97f33d0c59f..b7c80849455c 100644
> >> --- a/drivers/base/power/trace.c
> >> +++ b/drivers/base/power/trace.c
> >> @@ -13,6 +13,7 @@
> >>   #include <linux/export.h>
> >>   #include <linux/rtc.h>
> >>   #include <linux/suspend.h>
> >> +#include <linux/init.h>
> >>
> >>   #include <linux/mc146818rtc.h>
> >>
> >> @@ -165,6 +166,9 @@ void generate_pm_trace(const void *tracedata, unsigned int user)
> >>      const char *file = *(const char **)(tracedata + 2);
> >>      unsigned int user_hash_value, file_hash_value;
> >>
> >> +    if (!x86_platform.legacy.rtc)
> >> +            return 0;
> >
> > Why does the driver core code here care about a platform/arch-specific
> > thing at all?  Did you just break all other arches?
>
> This file is only compiled for x86. It depends on CONFIG_PM_TRACE_RTC,
> which has a "depends on X86" attribute.

This feature uses the CMOS RTC memory to store data, so if that memory
is not present, it's better to avoid using it.

Please feel free to add

Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>

to this patch or let me know if you want me to take it.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data
  2021-09-06 17:07       ` Rafael J. Wysocki
@ 2021-09-07  4:18         ` Juergen Gross
  0 siblings, 0 replies; 10+ messages in thread
From: Juergen Gross @ 2021-09-07  4:18 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Greg Kroah-Hartman, xen-devel, Linux PM,
	Linux Kernel Mailing List, Rafael J. Wysocki, Len Brown,
	Pavel Machek, Stable


[-- Attachment #1.1.1: Type: text/plain, Size: 1898 bytes --]

On 06.09.21 19:07, Rafael J. Wysocki wrote:
> On Fri, Sep 3, 2021 at 11:02 AM Juergen Gross <jgross@suse.com> wrote:
>>
>> On 03.09.21 10:56, Greg Kroah-Hartman wrote:
>>> On Fri, Sep 03, 2021 at 10:49:36AM +0200, Juergen Gross wrote:
>>>> In there is no legacy RTC device, don't try to use it for storing trace
>>>> data across suspend/resume.
>>>>
>>>> Cc: <stable@vger.kernel.org>
>>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>>> ---
>>>>    drivers/base/power/trace.c | 10 ++++++++++
>>>>    1 file changed, 10 insertions(+)
>>>>
>>>> diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
>>>> index a97f33d0c59f..b7c80849455c 100644
>>>> --- a/drivers/base/power/trace.c
>>>> +++ b/drivers/base/power/trace.c
>>>> @@ -13,6 +13,7 @@
>>>>    #include <linux/export.h>
>>>>    #include <linux/rtc.h>
>>>>    #include <linux/suspend.h>
>>>> +#include <linux/init.h>
>>>>
>>>>    #include <linux/mc146818rtc.h>
>>>>
>>>> @@ -165,6 +166,9 @@ void generate_pm_trace(const void *tracedata, unsigned int user)
>>>>       const char *file = *(const char **)(tracedata + 2);
>>>>       unsigned int user_hash_value, file_hash_value;
>>>>
>>>> +    if (!x86_platform.legacy.rtc)
>>>> +            return 0;
>>>
>>> Why does the driver core code here care about a platform/arch-specific
>>> thing at all?  Did you just break all other arches?
>>
>> This file is only compiled for x86. It depends on CONFIG_PM_TRACE_RTC,
>> which has a "depends on X86" attribute.
> 
> This feature uses the CMOS RTC memory to store data, so if that memory
> is not present, it's better to avoid using it.
> 
> Please feel free to add
> 
> Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>

Thanks!

> 
> to this patch or let me know if you want me to take it.
> 

No, I can take it with the other patch of this small series, thanks.


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] xen: reset legacy rtc flag for PV domU
  2021-09-03  8:49 ` [PATCH 2/2] xen: reset legacy rtc flag for PV domU Juergen Gross
@ 2021-09-08 14:54   ` Boris Ostrovsky
  2021-09-10  7:27     ` Juergen Gross
  0 siblings, 1 reply; 10+ messages in thread
From: Boris Ostrovsky @ 2021-09-08 14:54 UTC (permalink / raw)
  To: Juergen Gross, xen-devel, x86, linux-kernel
  Cc: Stefano Stabellini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, stable


On 9/3/21 4:49 AM, Juergen Gross wrote:
> A Xen PV guest doesn't have a legacy RTC device, so reset the legacy
> RTC flag. Otherwise the following WARN splat will occur at boot:
>
> [    1.333404] WARNING: CPU: 1 PID: 1 at /home/gross/linux/head/drivers/rtc/rtc-mc146818-lib.c:25 mc146818_get_time+0x1be/0x210
> [    1.333404] Modules linked in:
> [    1.333404] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W         5.14.0-rc7-default+ #282
> [    1.333404] RIP: e030:mc146818_get_time+0x1be/0x210
> [    1.333404] Code: c0 64 01 c5 83 fd 45 89 6b 14 7f 06 83 c5 64 89 6b 14 41 83 ec 01 b8 02 00 00 00 44 89 63 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 <0f> 0b 48 c7 c7 30 0e ef 82 4c 89 e6 e8 71 2a 24 00 48 c7 c0 ff ff
> [    1.333404] RSP: e02b:ffffc90040093df8 EFLAGS: 00010002
> [    1.333404] RAX: 00000000000000ff RBX: ffffc90040093e34 RCX: 0000000000000000
> [    1.333404] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000000000000000d
> [    1.333404] RBP: ffffffff82ef0e30 R08: ffff888005013e60 R09: 0000000000000000
> [    1.333404] R10: ffffffff82373e9b R11: 0000000000033080 R12: 0000000000000200
> [    1.333404] R13: 0000000000000000 R14: 0000000000000002 R15: ffffffff82cdc6d4
> [    1.333404] FS:  0000000000000000(0000) GS:ffff88807d440000(0000) knlGS:0000000000000000
> [    1.333404] CS:  10000e030 DS: 0000 ES: 0000 CR0: 0000000080050033
> [    1.333404] CR2: 0000000000000000 CR3: 000000000260a000 CR4: 0000000000050660
> [    1.333404] Call Trace:
> [    1.333404]  ? wakeup_sources_sysfs_init+0x30/0x30
> [    1.333404]  ? rdinit_setup+0x2b/0x2b
> [    1.333404]  early_resume_init+0x23/0xa4
> [    1.333404]  ? cn_proc_init+0x36/0x36
> [    1.333404]  do_one_initcall+0x3e/0x200
> [    1.333404]  kernel_init_freeable+0x232/0x28e
> [    1.333404]  ? rest_init+0xd0/0xd0
> [    1.333404]  kernel_init+0x16/0x120
> [    1.333404]  ret_from_fork+0x1f/0x30
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Juergen Gross <jgross@suse.com>


Fixes: 211e5db19d15 ("rtc: mc146818: Detect and handle broken RTCs") ?


Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] xen: reset legacy rtc flag for PV domU
  2021-09-08 14:54   ` Boris Ostrovsky
@ 2021-09-10  7:27     ` Juergen Gross
  0 siblings, 0 replies; 10+ messages in thread
From: Juergen Gross @ 2021-09-10  7:27 UTC (permalink / raw)
  To: Boris Ostrovsky, xen-devel, x86, linux-kernel
  Cc: Stefano Stabellini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, H. Peter Anvin, stable


[-- Attachment #1.1.1: Type: text/plain, Size: 2450 bytes --]

On 08.09.21 16:54, Boris Ostrovsky wrote:
> 
> On 9/3/21 4:49 AM, Juergen Gross wrote:
>> A Xen PV guest doesn't have a legacy RTC device, so reset the legacy
>> RTC flag. Otherwise the following WARN splat will occur at boot:
>>
>> [    1.333404] WARNING: CPU: 1 PID: 1 at /home/gross/linux/head/drivers/rtc/rtc-mc146818-lib.c:25 mc146818_get_time+0x1be/0x210
>> [    1.333404] Modules linked in:
>> [    1.333404] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W         5.14.0-rc7-default+ #282
>> [    1.333404] RIP: e030:mc146818_get_time+0x1be/0x210
>> [    1.333404] Code: c0 64 01 c5 83 fd 45 89 6b 14 7f 06 83 c5 64 89 6b 14 41 83 ec 01 b8 02 00 00 00 44 89 63 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 <0f> 0b 48 c7 c7 30 0e ef 82 4c 89 e6 e8 71 2a 24 00 48 c7 c0 ff ff
>> [    1.333404] RSP: e02b:ffffc90040093df8 EFLAGS: 00010002
>> [    1.333404] RAX: 00000000000000ff RBX: ffffc90040093e34 RCX: 0000000000000000
>> [    1.333404] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000000000000000d
>> [    1.333404] RBP: ffffffff82ef0e30 R08: ffff888005013e60 R09: 0000000000000000
>> [    1.333404] R10: ffffffff82373e9b R11: 0000000000033080 R12: 0000000000000200
>> [    1.333404] R13: 0000000000000000 R14: 0000000000000002 R15: ffffffff82cdc6d4
>> [    1.333404] FS:  0000000000000000(0000) GS:ffff88807d440000(0000) knlGS:0000000000000000
>> [    1.333404] CS:  10000e030 DS: 0000 ES: 0000 CR0: 0000000080050033
>> [    1.333404] CR2: 0000000000000000 CR3: 000000000260a000 CR4: 0000000000050660
>> [    1.333404] Call Trace:
>> [    1.333404]  ? wakeup_sources_sysfs_init+0x30/0x30
>> [    1.333404]  ? rdinit_setup+0x2b/0x2b
>> [    1.333404]  early_resume_init+0x23/0xa4
>> [    1.333404]  ? cn_proc_init+0x36/0x36
>> [    1.333404]  do_one_initcall+0x3e/0x200
>> [    1.333404]  kernel_init_freeable+0x232/0x28e
>> [    1.333404]  ? rest_init+0xd0/0xd0
>> [    1.333404]  kernel_init+0x16/0x120
>> [    1.333404]  ret_from_fork+0x1f/0x30
>>
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
> 
> 
> Fixes: 211e5db19d15 ("rtc: mc146818: Detect and handle broken RTCs") ?

I don't think so. Its rather:

Fixes: 8d152e7a5c7537 ("x86/rtc: Replace paravirt rtc check with 
platform legacy quirk")

as this was the commit leading to domUs having the rtc capability being
set.

> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Thanks,

Juergen


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-09-10  7:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03  8:49 [PATCH 0/2] xen: fix illegal rtc device usage of pv guests Juergen Gross
2021-09-03  8:49 ` [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data Juergen Gross
2021-09-03  8:56   ` Greg Kroah-Hartman
2021-09-03  9:01     ` Juergen Gross
2021-09-03  9:08       ` Greg Kroah-Hartman
2021-09-06 17:07       ` Rafael J. Wysocki
2021-09-07  4:18         ` Juergen Gross
2021-09-03  8:49 ` [PATCH 2/2] xen: reset legacy rtc flag for PV domU Juergen Gross
2021-09-08 14:54   ` Boris Ostrovsky
2021-09-10  7:27     ` Juergen Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).