All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Penny, Zheng" <penny.zheng@amd.com>
Cc: "Huang, Ray" <Ray.Huang@amd.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Orzel, Michal" <Michal.Orzel@amd.com>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Bob Eshleman" <bobbyeshleman@gmail.com>,
	"Connor Davis" <connojdavis@gmail.com>,
	"Oleksii Kurochko" <oleksii.kurochko@gmail.com>,
	"Stabellini, Stefano" <stefano.stabellini@amd.com>,
	"Sergiy Kibrik" <Sergiy_Kibrik@epam.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v2 18/19] xen/sysctl: wrap around arch-specific arch_do_sysctl
Date: Tue, 22 Apr 2025 08:50:54 +0200	[thread overview]
Message-ID: <a92a292d-a283-41f2-816d-1db51a6789fb@suse.com> (raw)
In-Reply-To: <DM4PR12MB845116DF8BF05D205BD8622FE1BF2@DM4PR12MB8451.namprd12.prod.outlook.com>

On 18.04.2025 11:46, Penny, Zheng wrote:
> [Public]
> 
> Hi,
> 
>> -----Original Message-----
>> From: Jan Beulich <jbeulich@suse.com>
>> Sent: Tuesday, April 1, 2025 10:47 PM
>> To: Penny, Zheng <penny.zheng@amd.com>
>> Cc: Huang, Ray <Ray.Huang@amd.com>; Stefano Stabellini
>> <sstabellini@kernel.org>; Julien Grall <julien@xen.org>; Bertrand Marquis
>> <bertrand.marquis@arm.com>; Orzel, Michal <Michal.Orzel@amd.com>;
>> Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>; Andrew Cooper
>> <andrew.cooper3@citrix.com>; Anthony PERARD <anthony.perard@vates.tech>;
>> Roger Pau Monné <roger.pau@citrix.com>; Alistair Francis
>> <alistair.francis@wdc.com>; Bob Eshleman <bobbyeshleman@gmail.com>;
>> Connor Davis <connojdavis@gmail.com>; Oleksii Kurochko
>> <oleksii.kurochko@gmail.com>; Stabellini, Stefano
>> <stefano.stabellini@amd.com>; Sergiy Kibrik <Sergiy_Kibrik@epam.com>; xen-
>> devel@lists.xenproject.org
>> Subject: Re: [PATCH v2 18/19] xen/sysctl: wrap around arch-specific
>> arch_do_sysctl
>>
>> On 26.03.2025 06:50, Penny Zheng wrote:
>>> Function arch_do_sysctl is to perform arch-specific sysctl op.
>>> Some functions, like psr_get_info for x86, DTB overlay support for
>>> arm, are solely available through sysctl op, then they all shall be
>>> wrapped with CONFIG_SYSCTL Also, remove all #ifdef CONFIG_SYSCTL-s in
>>> arch-specific sysctl.c, as we put the guardian in Makefile for the
>>> whole file.
>>>
>>> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
>>> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
>>> Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
>>> ---
>>> - use "depends on" for config OVERLAY_DTB
>>> - no need to wrap declaration
>>> - add transient #ifdef in sysctl.c for correct compilation
>>> ---
>>>  xen/arch/arm/Kconfig   |  1 +
>>>  xen/arch/arm/Makefile  |  2 +-
>>>  xen/arch/arm/sysctl.c  |  2 --
>>>  xen/arch/riscv/stubs.c |  2 +-
>>>  xen/arch/x86/Makefile  |  2 +-
>>>  xen/arch/x86/psr.c     | 18 ++++++++++++++++++
>>>  xen/arch/x86/sysctl.c  |  2 --
>>>  xen/common/sysctl.c    |  2 ++
>>>  8 files changed, 24 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index
>>> ffdff1f0a3..aa1b4a6e6b 100644
>>> --- a/xen/arch/arm/Kconfig
>>> +++ b/xen/arch/arm/Kconfig
>>> @@ -141,6 +141,7 @@ config HAS_ITS
>>>
>>>  config OVERLAY_DTB
>>>     bool "DTB overlay support (UNSUPPORTED)" if UNSUPPORTED
>>> +   depends on SYSCTL
>>>     help
>>>       Dynamic addition/removal of Xen device tree nodes using a dtbo.
>>>
>>> diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index
>>> 4837ad467a..7c6015b84d 100644
>>> --- a/xen/arch/arm/Makefile
>>> +++ b/xen/arch/arm/Makefile
>>> @@ -54,7 +54,7 @@ obj-y += smpboot.o
>>>  obj-$(CONFIG_STATIC_EVTCHN) += static-evtchn.init.o
>>>  obj-$(CONFIG_STATIC_MEMORY) += static-memory.init.o
>>>  obj-$(CONFIG_STATIC_SHM) += static-shmem.init.o -obj-y += sysctl.o
>>> +obj-$(CONFIG_SYSCTL) += sysctl.o
>>>  obj-y += time.o
>>>  obj-y += traps.o
>>>  obj-y += vcpreg.o
>>> diff --git a/xen/arch/arm/sysctl.c b/xen/arch/arm/sysctl.c index
>>> 2d350b700a..32cab4feff 100644
>>> --- a/xen/arch/arm/sysctl.c
>>> +++ b/xen/arch/arm/sysctl.c
>>> @@ -15,7 +15,6 @@
>>>  #include <asm/arm64/sve.h>
>>>  #include <public/sysctl.h>
>>>
>>> -#ifdef CONFIG_SYSCTL
>>>  void arch_do_physinfo(struct xen_sysctl_physinfo *pi)  {
>>>      pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm |
>>> XEN_SYSCTL_PHYSCAP_hap; @@ -23,7 +22,6 @@ void
>> arch_do_physinfo(struct xen_sysctl_physinfo *pi)
>>>      pi->arch_capabilities |= MASK_INSR(sve_encode_vl(get_sys_vl_len()),
>>>
>>> XEN_SYSCTL_PHYSCAP_ARM_SVE_MASK);  } -#endif
>>>
>>>  long arch_do_sysctl(struct xen_sysctl *sysctl,
>>>                      XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
>>> diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index
>>> 7b3f748886..ae865e1972 100644
>>> --- a/xen/arch/riscv/stubs.c
>>> +++ b/xen/arch/riscv/stubs.c
>>> @@ -322,13 +322,13 @@ unsigned long raw_copy_from_guest(void *to,
>>> const void __user *from,
>>>
>>>  /* sysctl.c */
>>>
>>> +#ifdef CONFIG_SYSCTL
>>>  long arch_do_sysctl(struct xen_sysctl *sysctl,
>>>                      XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)  {
>>>      BUG_ON("unimplemented");
>>>  }
>>>
>>> -#ifdef CONFIG_SYSCTL
>>>  void arch_do_physinfo(struct xen_sysctl_physinfo *pi)  {
>>>      BUG_ON("unimplemented");
>>> diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index
>>> f59c9665fd..837eafcbc0 100644
>>> --- a/xen/arch/x86/Makefile
>>> +++ b/xen/arch/x86/Makefile
>>> @@ -79,7 +79,7 @@ ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)  obj-y +=
>>> domctl.o  obj-y += platform_hypercall.o
>>>  obj-$(CONFIG_COMPAT) += x86_64/platform_hypercall.o -obj-y +=
>>> sysctl.o
>>> +obj-$(CONFIG_SYSCTL) += sysctl.o
>>>  endif
>>
>> I think I had indicated before that this shouldn't stay inside the conditional, but
>> move back up. Whether that is to happen here or while addressing my respective
>> comment on patch 01 I can't easily tell.
> 
> We want that "PV_SHIM_EXCLUSIVE likely wants / needs sorting as
> a prereq anyway", does the prereq here mean that prereq in kconfig,
> something like
> ```
> config SYSCTL
>       depends on xxx
> ```

I'm sorry, but I fear I can't interpret what you're saying (possibly asking).

>>> --- a/xen/common/sysctl.c
>>> +++ b/xen/common/sysctl.c
>>> @@ -490,8 +490,10 @@ long
>> do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
>>>          break;
>>>
>>>      default:
>>> +#ifdef CONFIG_SYSCTL
>>>          ret = arch_do_sysctl(op, u_sysctl);
>>>          copyback = 0;
>>> +#endif
>>>          break;
>>>      }
>>
>> This isn't enough. "ret" is 0 when reaching the default: label, but may not stay 0 for
>> the return from the function. I understand (expect) this is going to be dropped
>> again in the next patch, but even if only transiently needed this should be kept
>> correct imo. Things might be different if patch 02 introduced the option without a
>> prompt, i.e. always enabled. Then all the #ifdef-ary added up to here would be
>> merely syntactic sugar. In fact in that case you could omit all the transient #ifdef
>> that the last patch is going to remove again. Please consider going that route.
>>
>> Otherwise I think the #endif also needs moving up, for copyback to still be cleared
>> here.
>>
> 
> I'll change it to as follows to complement case for CONFIG_SYSCTL==n, plz correct me if I understand wrongly here:
> ```
>       default:
> +#ifdef CONFIG_SYSCTL
>          ret = arch_do_sysctl(op, u_sysctl);
> +#else
> +        ret = -EOPNOTSUPP;
> +#endif
>          copyback = 0;
>          break;
> ```

This is an option, yes, yet I'd like my other outline to be taken into consideration,
too (for imo resulting in less churn overall).

Jan


  reply	other threads:[~2025-04-22  6:51 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26  5:50 [PATCH v2 00/19] xen: introduce CONFIG_SYSCTL Penny Zheng
2025-03-26  5:50 ` [PATCH v2 01/19] xen/x86: remove "depends on !PV_SHIM_EXCLUSIVE" Penny Zheng
2025-03-28 23:56   ` Stefano Stabellini
2025-03-31  6:29     ` Jan Beulich
2025-04-01  8:41       ` Penny, Zheng
2025-04-01  9:01         ` Jan Beulich
2025-04-01  9:57           ` Penny, Zheng
2025-03-26  5:50 ` [PATCH v2 02/19] xen: introduce CONFIG_SYSCTL Penny Zheng
2025-03-27  9:57   ` Jan Beulich
2025-03-26  5:50 ` [PATCH v2 03/19] xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL Penny Zheng
2025-03-29  0:06   ` Stefano Stabellini
2025-03-26  5:50 ` [PATCH v2 04/19] xen/sysctl: wrap around XEN_SYSCTL_readconsole Penny Zheng
2025-03-29  0:07   ` Stefano Stabellini
2025-04-01 12:24   ` Jan Beulich
2025-03-26  5:50 ` [PATCH v2 05/19] xen/sysctl: make CONFIG_TRACEBUFFER depend on CONFIG_SYSCTL Penny Zheng
2025-03-26  5:50 ` [PATCH v2 06/19] xen/sysctl: wrap around XEN_SYSCTL_sched_id Penny Zheng
2025-04-01 12:27   ` Jan Beulich
2025-03-26  5:50 ` [PATCH v2 07/19] xen/sysctl: wrap around XEN_SYSCTL_perfc_op Penny Zheng
2025-03-29  0:07   ` Stefano Stabellini
2025-03-26  5:50 ` [PATCH v2 08/19] xen/sysctl: wrap around XEN_SYSCTL_lockprof_op Penny Zheng
2025-03-29  0:07   ` Stefano Stabellini
2025-04-01 12:36   ` Jan Beulich
2025-03-26  5:50 ` [PATCH v2 09/19] xen/pmstat: clean up pmstat.c Penny Zheng
2025-03-29  0:41   ` Stefano Stabellini
2025-04-01 12:55   ` Jan Beulich
2025-03-26  5:50 ` [PATCH v2 10/19] xen/sysctl: introduce CONFIG_PM_STATS Penny Zheng
2025-03-29  0:35   ` Stefano Stabellini
2025-04-01 13:09   ` Jan Beulich
2025-04-16  3:54     ` Penny, Zheng
2025-04-16  6:37       ` Jan Beulich
2025-04-16  8:38         ` Penny, Zheng
2025-04-16  8:45           ` Jan Beulich
2025-03-26  5:50 ` [PATCH v2 11/19] xen/sysctl: wrap around XEN_SYSCTL_page_offline_op Penny Zheng
2025-03-26  5:50 ` [PATCH v2 12/19] xen/sysctl: wrap around XEN_SYSCTL_cpupool_op Penny Zheng
2025-03-26  5:50 ` [PATCH v2 13/19] xen/sysctl: wrap around XEN_SYSCTL_scheduler_op Penny Zheng
2025-03-26 15:22   ` Stewart Hildebrand
2025-03-26  5:50 ` [PATCH v2 14/19] xen: make avail_domheap_pages() static Penny Zheng
2025-03-29  0:11   ` Stefano Stabellini
2025-03-31  6:33   ` Jan Beulich
2025-03-26  5:50 ` [PATCH v2 15/19] xen/sysctl: wrap around XEN_SYSCTL_physinfo Penny Zheng
2025-03-27  9:35   ` Oleksii Kurochko
2025-03-27  9:58     ` Jan Beulich
2025-03-27 10:25       ` Oleksii Kurochko
2025-03-29  0:13   ` Stefano Stabellini
2025-04-01 14:29     ` Jan Beulich
2025-03-26  5:50 ` [PATCH v2 16/19] xen/sysctl: make CONFIG_COVERAGE depend on CONFIG_SYSCTL Penny Zheng
2025-03-26  5:50 ` [PATCH v2 17/19] xen/sysctl: make CONFIG_LIVEPATCH " Penny Zheng
2025-03-26  5:50 ` [PATCH v2 18/19] xen/sysctl: wrap around arch-specific arch_do_sysctl Penny Zheng
2025-03-27  9:39   ` Oleksii Kurochko
2025-03-29  0:21   ` Stefano Stabellini
2025-04-01 14:46   ` Jan Beulich
2025-04-18  9:46     ` Penny, Zheng
2025-04-22  6:50       ` Jan Beulich [this message]
2025-03-26  5:50 ` [PATCH v2 19/19] xen/sysctl: wrap around sysctl hypercall Penny Zheng
2025-04-01 14:49   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a92a292d-a283-41f2-816d-1db51a6789fb@suse.com \
    --to=jbeulich@suse.com \
    --cc=Michal.Orzel@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=Sergiy_Kibrik@epam.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=alistair.francis@wdc.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=bertrand.marquis@arm.com \
    --cc=bobbyeshleman@gmail.com \
    --cc=connojdavis@gmail.com \
    --cc=julien@xen.org \
    --cc=oleksii.kurochko@gmail.com \
    --cc=penny.zheng@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=stefano.stabellini@amd.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.