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

RE: [PATCH v3 2/3] xen/sched: Link CPU topology to scheduler


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Wed, 1 Jul 2026 21:50:47 +0000
  • Accept-language: ja-JP, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=valinux.co.jp; dmarc=pass action=none header.from=valinux.co.jp; dkim=pass header.d=valinux.co.jp; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wMr+iCYzj+ti+jg9ziJqWr1SMrXbZx3IfO46chyDpn4=; b=ypwaOpQDAZrqy15ukHBZ2NWTP4TXHRwj58N2XvSuxWoNtIuwSKRQzXgaCP88hkZdyuEvQEC7ECVV2WotG2ovtzWXoG/73aXh8ARHSbgGFDKUGqK2uM0x29UlONvuh9rhm4rdTMaiTLAj6sy2EzCNX//xmINYyeEZkyN0rAvO+6xpIFftuLUjHBuVhUaBVKtwfbTp4UvpazkxHRGgaK7CkpDybpahAfcc9QJkg5WG9IRfzizC2Zuxz85bIkynuNv/5G8WuQcoJJfBE+lPGmEh9AnRI/o0fPfLcoVVku41mFjgGWCAsMVV5QxjPRYfrrWMBSNglxHOZ99vwTjHcNFdXQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Apnt8DqnPB3QP1Pss7XvY9p+0kbdCP7yxn2rrucfvwj1y68FkxLlEYrg1hRhKLRVhyD6qJ6DuvnV1m8FznVx0qbUlsBKftnGQXO6Wo/V+zAqP5PZ8GXbfpNUC5qfyrsM5h60JCsd7LABTNnf5vdeLIN/8Vajq0BLZMJ3UL4qGx5+G68Pt952GHS2r1yYxERDGhqdg/TTmhtUjnc8tBMc19hwFHs36WbhFGm6DSO9p+WK0EuT9rRr+vRF5g48f8MBxt+s+C76qSknaAJY/M+hCBJRI17V3Z7F9NBv5gOhIh0qHJc8qS1XQI128AUOERHzQDbdjdB/ufIEr4h/DLwXEg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=valinux.co.jp header.i="@valinux.co.jp" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=valinux.co.jp;
  • Cc: 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>, Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 01 Jul 2026 21:51:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdCBJhHN8gTC0+5k6Ik1hF9MtBXrZWrIoAgAKKNXA=
  • Thread-topic: [PATCH v3 2/3] xen/sched: Link CPU topology to scheduler

Hello,

> > +#include <xen/cpu-topology.h>
> >  #include <xen/errno.h>
> >  #include <xen/init.h>
> >  #include <xen/lib.h>
> > @@ -37,6 +38,8 @@ static unsigned int cpu_nr_siblings(unsigned int cpu)
> >  {
> >  #ifdef CONFIG_X86
> >      return cpu_data[cpu].x86_num_siblings;
> > +#elif defined(CONFIG_CPU_TOPOLOGY)
> > +    return cpu_topology ? cpu_topology[cpu].num_siblings : 1;
> 
> See my earlier remark regarding the ordering here.
> 
> > --- a/xen/common/sysctl.c
> > +++ b/xen/common/sysctl.c
> > @@ -28,6 +28,7 @@
> >  #include <xen/pmstat.h>
> >  #include <xen/livepatch.h>
> >  #include <xen/coverage.h>
> > +#include <xen/cpu-topology.h>
> 
> Taking e.g. this #include, ...
> 
> > --- a/xen/include/xen/cpu-topology.h
> > +++ b/xen/include/xen/cpu-topology.h
> > @@ -9,6 +9,10 @@ struct cpu_topology {
> >      cpumask_var_t thread_sibling;
> >      cpumask_var_t core_sibling;
> >      cpumask_var_t cluster_sibling;
> > +    unsigned int phys_core_id;
> > +    unsigned int phys_cluster_id;
> > +    unsigned int phys_socket_id;
> > +    unsigned int num_siblings;
> >  };
> >
> >  #ifdef CONFIG_CPU_TOPOLOGY
> > @@ -16,11 +20,22 @@ struct cpu_topology {
> >  extern struct cpu_topology *cpu_topology;
> >  void init_cpu_topology(void);
> >
> > +#define cpu_to_core(cpu) (cpu_topology ?
> cpu_topology[cpu].phys_core_id : 0)
> > +#define cpu_to_socket(cpu) (cpu_topology ?
> cpu_topology[cpu].phys_socket_id : 0)
> > +
> >  #else /* CONFIG_CPU_TOPOLOGY */
> >
> >  #define cpu_topology ((struct cpu_topology *)NULL)
> >  static inline void init_cpu_topology(void) {}
> >
> > +#ifndef cpu_to_core
> > +#define cpu_to_core(cpu)   (0)
> > +#endif
> > +
> > +#ifndef cpu_to_socket
> > +#define cpu_to_socket(cpu) (0)
> > +#endif
> 
> ... what guarantees, on x86, that cpu_to_core and cpu_to_socket are already
> #define-d by this point, so that these fallbacks don't take effect there?
> (IOW I think you need to explicitly "#include <asm/processor.h>" below the
> #else here. Yet better might be to move those two x86 #define-s to a new
> asm/topology.h.)

You are completely right. I will fix it in v4.

Thank you,
Hirokazu Takahashi.

 


Rackspace

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