Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable
@ 2024-07-11 10:34 Petr Tesarik
  2024-07-11 17:25 ` Petr Tesařík
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Petr Tesarik @ 2024-07-11 10:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Eric Biederman, kexec
  Cc: linux-kernel, Petr Tesarik, Petr Tesarik

From: Petr Tesarik <ptesarik@suse.com>

There is no reason to restrict access to this attribute, as it merely
reports whether crash elfcorehdr is automatically updated on CPU hot
plug/unplug and/or online/offline events.

Note that since commit 79365026f8694 ("crash: add a new kexec flag for
hotplug support"), this maps to the same flag which is world-accessible
through /sys/devices/system/memory/crash_hotplug.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 drivers/base/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index c61ecb0c2ae2..73d69791d0d3 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -308,7 +308,7 @@ static ssize_t crash_hotplug_show(struct device *dev,
 {
 	return sysfs_emit(buf, "%d\n", crash_check_hotplug_support());
 }
-static DEVICE_ATTR_ADMIN_RO(crash_hotplug);
+static DEVICE_ATTR_RO(crash_hotplug);
 #endif
 
 static void cpu_device_release(struct device *dev)
-- 
2.45.2


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable
  2024-07-11 10:34 [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable Petr Tesarik
@ 2024-07-11 17:25 ` Petr Tesařík
  2024-07-12  3:35 ` Baoquan He
  2024-07-12  4:30 ` Sourabh Jain
  2 siblings, 0 replies; 8+ messages in thread
From: Petr Tesařík @ 2024-07-11 17:25 UTC (permalink / raw)
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Eric Biederman, kexec,
	linux-kernel, Petr Tesarik, Sourabh Jain

Forgot to Cc Sourabh Jain.

On Thu, 11 Jul 2024 12:34:09 +0200
Petr Tesarik <petr.tesarik@suse.com> wrote:

> From: Petr Tesarik <ptesarik@suse.com>
> 
> There is no reason to restrict access to this attribute, as it merely
> reports whether crash elfcorehdr is automatically updated on CPU hot
> plug/unplug and/or online/offline events.
> 
> Note that since commit 79365026f8694 ("crash: add a new kexec flag for
> hotplug support"), this maps to the same flag which is world-accessible
> through /sys/devices/system/memory/crash_hotplug.
> 
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>
> ---
>  drivers/base/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index c61ecb0c2ae2..73d69791d0d3 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -308,7 +308,7 @@ static ssize_t crash_hotplug_show(struct device *dev,
>  {
>  	return sysfs_emit(buf, "%d\n", crash_check_hotplug_support());
>  }
> -static DEVICE_ATTR_ADMIN_RO(crash_hotplug);
> +static DEVICE_ATTR_RO(crash_hotplug);
>  #endif
>  
>  static void cpu_device_release(struct device *dev)


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable
  2024-07-11 10:34 [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable Petr Tesarik
  2024-07-11 17:25 ` Petr Tesařík
@ 2024-07-12  3:35 ` Baoquan He
  2024-07-12  4:30 ` Sourabh Jain
  2 siblings, 0 replies; 8+ messages in thread
From: Baoquan He @ 2024-07-12  3:35 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Eric Biederman, kexec,
	linux-kernel, Petr Tesarik, Petr Tesarik

On 07/11/24 at 12:34pm, Petr Tesarik wrote:
> From: Petr Tesarik <ptesarik@suse.com>
> 
> There is no reason to restrict access to this attribute, as it merely
> reports whether crash elfcorehdr is automatically updated on CPU hot
> plug/unplug and/or online/offline events.
> 
> Note that since commit 79365026f8694 ("crash: add a new kexec flag for
> hotplug support"), this maps to the same flag which is world-accessible
> through /sys/devices/system/memory/crash_hotplug.
> 
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>
> ---
>  drivers/base/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index c61ecb0c2ae2..73d69791d0d3 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -308,7 +308,7 @@ static ssize_t crash_hotplug_show(struct device *dev,
>  {
>  	return sysfs_emit(buf, "%d\n", crash_check_hotplug_support());
>  }
> -static DEVICE_ATTR_ADMIN_RO(crash_hotplug);
> +static DEVICE_ATTR_RO(crash_hotplug);

Agree. I guess this was copied from codes related to 
crash_notes/crash_notes_size. While crash_notes/crash_notes_size are in
/sys/devices/system/cpu/cpuX/ which is next level. 

Acked-by: Baoquan He <bhe@redhat.com>


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable
  2024-07-11 10:34 [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable Petr Tesarik
  2024-07-11 17:25 ` Petr Tesařík
  2024-07-12  3:35 ` Baoquan He
@ 2024-07-12  4:30 ` Sourabh Jain
  2024-07-12  6:21   ` Petr Tesařík
  2 siblings, 1 reply; 8+ messages in thread
From: Sourabh Jain @ 2024-07-12  4:30 UTC (permalink / raw)
  To: Petr Tesarik, Greg Kroah-Hartman, Rafael J. Wysocki,
	Eric Biederman, kexec
  Cc: linux-kernel, Petr Tesarik, Petr Tesarik

Hello Petr,

Just want to mentioned few points about the commit message. No strong
opinion on changing the commit message.

On 11/07/24 16:04, Petr Tesarik wrote:
> From: Petr Tesarik <ptesarik@suse.com>
>
> There is no reason to restrict access to this attribute, as it merely
> reports whether crash elfcorehdr is automatically updated on CPU hot
> plug/unplug and/or online/offline events.

Now, it is not just elfcorehdr; there could be multiple kexec segments 
based on the architecture's needs.
For example, on PowerPC, it is elfcorehdr and FDT.

>
> Note that since commit 79365026f8694 ("crash: add a new kexec flag for
> hotplug support"), this maps to the same flag which is world-accessible
> through /sys/devices/system/memory/crash_hotplug.

The previous comment is more relevant for the kexec_load system call.

For the kexec_file_load system call, the kexec flag introduced in the 
commit message
mentioned above is irrelevant. Building kernel with CONFIG_CRASH_HOTPLUG 
is enough.

> Signedoff-by: Petr Tesarik <ptesarik@suse.com>
> ---
>   drivers/base/cpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index c61ecb0c2ae2..73d69791d0d3 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -308,7 +308,7 @@ static ssize_t crash_hotplug_show(struct device *dev,
>   {
>   	return sysfs_emit(buf, "%d\n", crash_check_hotplug_support());
>   }
> -static DEVICE_ATTR_ADMIN_RO(crash_hotplug);
> +static DEVICE_ATTR_RO(crash_hotplug);

I agree, it doesn't have to be readable by admin only.

Acked-by: Sourabh Jain <sourabhjain@linux.ibm.com>


Thanks for the patch.
- Sourabh

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable
  2024-07-12  4:30 ` Sourabh Jain
@ 2024-07-12  6:21   ` Petr Tesařík
  2024-07-12  6:31     ` Sourabh Jain
  0 siblings, 1 reply; 8+ messages in thread
From: Petr Tesařík @ 2024-07-12  6:21 UTC (permalink / raw)
  To: Sourabh Jain
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Eric Biederman, kexec,
	linux-kernel, Petr Tesarik

On Fri, 12 Jul 2024 10:00:09 +0530
Sourabh Jain <sourabhjain@linux.ibm.com> wrote:

> Hello Petr,
> 
> Just want to mentioned few points about the commit message. No strong
> opinion on changing the commit message.
> 
> On 11/07/24 16:04, Petr Tesarik wrote:
> > From: Petr Tesarik <ptesarik@suse.com>
> >
> > There is no reason to restrict access to this attribute, as it merely
> > reports whether crash elfcorehdr is automatically updated on CPU hot
> > plug/unplug and/or online/offline events.  
> 
> Now, it is not just elfcorehdr; there could be multiple kexec segments 
> based on the architecture's needs.
> For example, on PowerPC, it is elfcorehdr and FDT.

Right. I am even working with a PowerVM LPAR on an L922 system now. ;-)

OTOH I was just too lazy to invent my own description, so I took it
from Documentation/ABI/testing/sysfs-devices-system-cpu. That one
could be improved. And a couple of other places... Expect a patch.

> >
> > Note that since commit 79365026f8694 ("crash: add a new kexec flag
> > for hotplug support"), this maps to the same flag which is
> > world-accessible through /sys/devices/system/memory/crash_hotplug.  
> 
> The previous comment is more relevant for the kexec_load system call.
> 
> For the kexec_file_load system call, the kexec flag introduced in the 
> commit message
> mentioned above is irrelevant. Building kernel with
> CONFIG_CRASH_HOTPLUG is enough.

Yes, but then this sysfs attribute always reads "1".

> > Signedoff-by: Petr Tesarik <ptesarik@suse.com>
> > ---
> >   drivers/base/cpu.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> > index c61ecb0c2ae2..73d69791d0d3 100644
> > --- a/drivers/base/cpu.c
> > +++ b/drivers/base/cpu.c
> > @@ -308,7 +308,7 @@ static ssize_t crash_hotplug_show(struct device
> > *dev, {
> >   	return sysfs_emit(buf, "%d\n",
> > crash_check_hotplug_support()); }
> > -static DEVICE_ATTR_ADMIN_RO(crash_hotplug);
> > +static DEVICE_ATTR_RO(crash_hotplug);  
> 
> I agree, it doesn't have to be readable by admin only.
> 
> Acked-by: Sourabh Jain <sourabhjain@linux.ibm.com>

Thank you!

Petr T

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable
  2024-07-12  6:21   ` Petr Tesařík
@ 2024-07-12  6:31     ` Sourabh Jain
  2024-07-12  6:48       ` Petr Tesarik
  0 siblings, 1 reply; 8+ messages in thread
From: Sourabh Jain @ 2024-07-12  6:31 UTC (permalink / raw)
  To: Petr Tesařík
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Eric Biederman, kexec,
	linux-kernel, Petr Tesarik

Hello Petr,

On 12/07/24 11:51, Petr Tesařík wrote:
> On Fri, 12 Jul 2024 10:00:09 +0530
> Sourabh Jain <sourabhjain@linux.ibm.com> wrote:
>
>> Hello Petr,
>>
>> Just want to mentioned few points about the commit message. No strong
>> opinion on changing the commit message.
>>
>> On 11/07/24 16:04, Petr Tesarik wrote:
>>> From: Petr Tesarik <ptesarik@suse.com>
>>>
>>> There is no reason to restrict access to this attribute, as it merely
>>> reports whether crash elfcorehdr is automatically updated on CPU hot
>>> plug/unplug and/or online/offline events.
>> Now, it is not just elfcorehdr; there could be multiple kexec segments
>> based on the architecture's needs.
>> For example, on PowerPC, it is elfcorehdr and FDT.
> Right. I am even working with a PowerVM LPAR on an L922 system now. ;-)
>
> OTOH I was just too lazy to invent my own description, so I took it
> from Documentation/ABI/testing/sysfs-devices-system-cpu. That one
> could be improved. And a couple of other places... Expect a patch.
Thanks for point it out, I will send a patch to fix the ABI document for 
crash_hotplug and other places in the kernel. Thanks,
Sourabh Jain

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable
  2024-07-12  6:31     ` Sourabh Jain
@ 2024-07-12  6:48       ` Petr Tesarik
  2024-07-12  6:54         ` Sourabh Jain
  0 siblings, 1 reply; 8+ messages in thread
From: Petr Tesarik @ 2024-07-12  6:48 UTC (permalink / raw)
  To: Sourabh Jain
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Eric Biederman, kexec,
	linux-kernel, Petr Tesarik

On Fri, 12 Jul 2024 12:01:29 +0530
Sourabh Jain <sourabhjain@linux.ibm.com> wrote:

> Hello Petr,
> 
> On 12/07/24 11:51, Petr Tesařík wrote:
> > On Fri, 12 Jul 2024 10:00:09 +0530
> > Sourabh Jain <sourabhjain@linux.ibm.com> wrote:
> >  
> >> Hello Petr,
> >>
> >> Just want to mentioned few points about the commit message. No strong
> >> opinion on changing the commit message.
> >>
> >> On 11/07/24 16:04, Petr Tesarik wrote:  
> >>> From: Petr Tesarik <ptesarik@suse.com>
> >>>
> >>> There is no reason to restrict access to this attribute, as it merely
> >>> reports whether crash elfcorehdr is automatically updated on CPU hot
> >>> plug/unplug and/or online/offline events.  
> >> Now, it is not just elfcorehdr; there could be multiple kexec segments
> >> based on the architecture's needs.
> >> For example, on PowerPC, it is elfcorehdr and FDT.  
> > Right. I am even working with a PowerVM LPAR on an L922 system now. ;-)
> >
> > OTOH I was just too lazy to invent my own description, so I took it
> > from Documentation/ABI/testing/sysfs-devices-system-cpu. That one
> > could be improved. And a couple of other places... Expect a patch.  
> Thanks for point it out, I will send a patch to fix the ABI document for 
> crash_hotplug and other places in the kernel. Thanks,

Oh, I was planning to do that, but if you want to send a patch
yourself, I won't duplicate efforts. There are other cleanups on my
TODO list.

Petr T

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable
  2024-07-12  6:48       ` Petr Tesarik
@ 2024-07-12  6:54         ` Sourabh Jain
  0 siblings, 0 replies; 8+ messages in thread
From: Sourabh Jain @ 2024-07-12  6:54 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Eric Biederman, kexec,
	linux-kernel, Petr Tesarik



On 12/07/24 12:18, Petr Tesarik wrote:
> On Fri, 12 Jul 2024 12:01:29 +0530
> Sourabh Jain <sourabhjain@linux.ibm.com> wrote:
>
>> Hello Petr,
>>
>> On 12/07/24 11:51, Petr Tesařík wrote:
>>> On Fri, 12 Jul 2024 10:00:09 +0530
>>> Sourabh Jain <sourabhjain@linux.ibm.com> wrote:
>>>   
>>>> Hello Petr,
>>>>
>>>> Just want to mentioned few points about the commit message. No strong
>>>> opinion on changing the commit message.
>>>>
>>>> On 11/07/24 16:04, Petr Tesarik wrote:
>>>>> From: Petr Tesarik <ptesarik@suse.com>
>>>>>
>>>>> There is no reason to restrict access to this attribute, as it merely
>>>>> reports whether crash elfcorehdr is automatically updated on CPU hot
>>>>> plug/unplug and/or online/offline events.
>>>> Now, it is not just elfcorehdr; there could be multiple kexec segments
>>>> based on the architecture's needs.
>>>> For example, on PowerPC, it is elfcorehdr and FDT.
>>> Right. I am even working with a PowerVM LPAR on an L922 system now. ;-)
>>>
>>> OTOH I was just too lazy to invent my own description, so I took it
>>> from Documentation/ABI/testing/sysfs-devices-system-cpu. That one
>>> could be improved. And a couple of other places... Expect a patch.
>> Thanks for point it out, I will send a patch to fix the ABI document for
>> crash_hotplug and other places in the kernel. Thanks,
> Oh, I was planning to do that, but if you want to send a patch
> yourself, I won't duplicate efforts. There are other cleanups on my
> TODO list.

Yes, I will take care of this.

Thanks,
Sourabh Jain

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2024-07-12  6:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-11 10:34 [PATCH] sysfs/cpu: Make crash_hotplug attribute world-readable Petr Tesarik
2024-07-11 17:25 ` Petr Tesařík
2024-07-12  3:35 ` Baoquan He
2024-07-12  4:30 ` Sourabh Jain
2024-07-12  6:21   ` Petr Tesařík
2024-07-12  6:31     ` Sourabh Jain
2024-07-12  6:48       ` Petr Tesarik
2024-07-12  6:54         ` Sourabh Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox