[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 18/19] xen/sysctl: wrap around arch-specific arch_do_sysctl


  • To: Penny Zheng <Penny.Zheng@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 13 Mar 2025 17:33:04 +0100
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: ray.huang@xxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxx>, Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 13 Mar 2025 16:33:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.03.2025 05:06, Penny Zheng wrote:
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -140,7 +140,7 @@ config HAS_ITS
>          depends on GICV3 && !NEW_VGIC && !ARM_32
>  
>  config OVERLAY_DTB
> -     bool "DTB overlay support (UNSUPPORTED)" if UNSUPPORTED
> +     bool "DTB overlay support (UNSUPPORTED)" if UNSUPPORTED && SYSCTL
>       help
>         Dynamic addition/removal of Xen device tree nodes using a dtbo.

This wants to be "depends on", not an extension to the prompt's visibility.
Else a "select OVERLAY_DTB" somewhere would be permitted by kconfig without
issuing a warning.

> --- 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");

This kind of a change would preferrably have the #endif annotated with a comment
mentioning the #ifdef's condition. Such comments may best be added as the 
#ifdef-s
are introduced. They can certainly continue to be omitted when the range covered
is only very few lines.

> --- a/xen/arch/x86/include/asm/psr.h
> +++ b/xen/arch/x86/include/asm/psr.h
> @@ -75,8 +75,10 @@ static inline bool psr_cmt_enabled(void)
>  int psr_alloc_rmid(struct domain *d);
>  void psr_free_rmid(struct domain *d);
>  
> +#ifdef CONFIG_SYSCTL
>  int psr_get_info(unsigned int socket, enum psr_type type,
>                   uint32_t data[], unsigned int array_len);
> +#endif

As before declarations alone may not need #ifdef-ing out.

> --- a/xen/arch/x86/psr.c
> +++ b/xen/arch/x86/psr.c
> @@ -133,9 +133,11 @@ static const struct feat_props {
>       */
>      enum psr_type alt_type;
>  
> +#ifdef CONFIG_SYSCTL
>      /* get_feat_info is used to return feature HW info through sysctl. */
>      bool (*get_feat_info)(const struct feat_node *feat,
>                            uint32_t data[], unsigned int array_len);
> +#endif
>  
>      /* write_msr is used to write out feature MSR register. */
>      void (*write_msr)(unsigned int cos, uint32_t val, enum psr_type type);
> @@ -418,6 +420,7 @@ static bool mba_init_feature(const struct cpuid_leaf 
> *regs,
>      return true;
>  }
>  
> +#ifdef CONFIG_SYSCTL
>  static bool cf_check cat_get_feat_info(
>      const struct feat_node *feat, uint32_t data[], unsigned int array_len)
>  {
> @@ -430,6 +433,7 @@ static bool cf_check cat_get_feat_info(
>  
>      return true;
>  }
> +#endif
>  
>  /* L3 CAT props */
>  static void cf_check l3_cat_write_msr(
> @@ -442,11 +446,14 @@ static const struct feat_props l3_cat_props = {
>      .cos_num = 1,
>      .type[0] = PSR_TYPE_L3_CBM,
>      .alt_type = PSR_TYPE_UNKNOWN,
> +#ifdef CONFIG_SYSCTL
>      .get_feat_info = cat_get_feat_info,
> +#endif
>      .write_msr = l3_cat_write_msr,
>      .sanitize = cat_check_cbm,
>  };
>  
> +#ifdef CONFIG_SYSCTL
>  /* L3 CDP props */
>  static bool cf_check l3_cdp_get_feat_info(
>      const struct feat_node *feat, uint32_t data[], uint32_t array_len)
> @@ -458,6 +465,7 @@ static bool cf_check l3_cdp_get_feat_info(
>  
>      return true;
>  }
> +#endif
>  
>  static void cf_check l3_cdp_write_msr(
>      unsigned int cos, uint32_t val, enum psr_type type)
> @@ -473,7 +481,9 @@ static const struct feat_props l3_cdp_props = {
>      .type[0] = PSR_TYPE_L3_DATA,
>      .type[1] = PSR_TYPE_L3_CODE,
>      .alt_type = PSR_TYPE_L3_CBM,
> +#ifdef CONFIG_SYSCTL
>      .get_feat_info = l3_cdp_get_feat_info,
> +#endif
>      .write_msr = l3_cdp_write_msr,
>      .sanitize = cat_check_cbm,
>  };
> @@ -489,11 +499,14 @@ static const struct feat_props l2_cat_props = {
>      .cos_num = 1,
>      .type[0] = PSR_TYPE_L2_CBM,
>      .alt_type = PSR_TYPE_UNKNOWN,
> +#ifdef CONFIG_SYSCTL
>      .get_feat_info = cat_get_feat_info,
> +#endif
>      .write_msr = l2_cat_write_msr,
>      .sanitize = cat_check_cbm,
>  };
>  
> +#ifdef CONFIG_SYSCTL
>  /* MBA props */
>  static bool cf_check mba_get_feat_info(
>      const struct feat_node *feat, uint32_t data[], unsigned int array_len)
> @@ -508,6 +521,7 @@ static bool cf_check mba_get_feat_info(
>  
>      return true;
>  }
> +#endif
>  
>  static void cf_check mba_write_msr(
>      unsigned int cos, uint32_t val, enum psr_type type)
> @@ -545,7 +559,9 @@ static const struct feat_props mba_props = {
>      .cos_num = 1,
>      .type[0] = PSR_TYPE_MBA_THRTL,
>      .alt_type = PSR_TYPE_UNKNOWN,
> +#ifdef CONFIG_SYSCTL
>      .get_feat_info = mba_get_feat_info,
> +#endif
>      .write_msr = mba_write_msr,
>      .sanitize = mba_sanitize_thrtl,
>  };
> @@ -808,6 +824,7 @@ static struct psr_socket_info *get_socket_info(unsigned 
> int socket)
>      return socket_info + socket;
>  }
>  
> +#ifdef CONFIG_SYSCTL
>  int psr_get_info(unsigned int socket, enum psr_type type,
>                   uint32_t data[], unsigned int array_len)
>  {
> @@ -839,6 +856,7 @@ int psr_get_info(unsigned int socket, enum psr_type type,
>  
>      return -EINVAL;
>  }
> +#endif /* CONFIG_SYSCTL */
>  
>  int psr_get_val(struct domain *d, unsigned int socket,
>                  uint32_t *val, enum psr_type type)

That's quite a lot of #ifdef-ary here. I wonder if we can't do any better.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.