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

Re: [PATCH v6 2/6] xen/x86: move generically usable NUMA code from x86 to common


  • To: Wei Chen <wei.chen@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 18 Oct 2022 15:45:54 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=hXRxwaWaXAkHACvM+MNdQovDSnV3EImA1Wlpni37DgM=; b=YO6+l1dFZnoycpKbkmdH1hj6bz1R2aetMG4n+vTZYNVR9oVFuERd7MFMhi2rcoa0EzvtGWa5rwVUJEoS90QBJ/AtP3k1rLCAE8Ns5CUsv1hV/4l7bFhUGDpGQmL3P80pBNzJvVOgHe3j3+ve/R++vDDtKe5gGZGojJ7ItyZusivlnmEefpm98LJCTsmaBQpn+A9Qi0pXQJCLPxp42X5BfovtDD2bVSavWdk3ftizp8mioRKNGfvt3rltWBiTnxGwR/HH+MluTQykkofLKcHxfVe/MI5ApV67JuU+SrVYWTzsRbGBjBWwifSajjk0Lu8g2X6fyWafsg8JaVl9+YFXgA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FZCBCTlAF6Q1yf6vxWI3jxEZCRuaYM1Bkw6h23ewd28WPnkcuZhTFq807WDwnbSaWaigO3Hqb688M/W27k24xVlJPYJcjvUZ0s4cZ/YkxsTDzFbBtbxUKiykCocyH5K3FuogkN+OZnanErFPCtsgPIbIod2wpBvsrBFMq3YYt2PViGLMTIQHpvv57NuJ3aFG0oaBJAiz6Pd9u+Q8AiUzokcKg+mAPREokSlngM6QNkWNtgdI2CvJA3Fhwd84q0Va4Q8qmyN+5akS7Ukr6tNf5ojqnIK3FAkVeiFgu4oIN578jFh9aqdCDvliaOvpfgD1igHwjgcO0x9kV49/mzgbqw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: nd@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 18 Oct 2022 13:46:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11.10.2022 13:17, Wei Chen wrote:
> v5 -> v6:
>  1. Replace numa_scan_node to numa_process_nodes in commit log.
>  2. Limit the scope of page_num_node, vnuma and page of numa_setup
>     function.
>  3. Use memset to init page_num_node instead of for_each_online_node.
>  4. Use %u instead of %d for nodeid_t and j in numa_setup print
>     messages.

The only instances of nodeid_t typed variable uses that I was able to
find are in dump_numa(). I guess you can leave them that way, but
strictly speaking %u isn't correct to use for nodeid_t (as it promotes
to int, not to unsigned int).

>  5. Use min(PADDR_BITS, BITS_PER_LONG - 1) to calculate the shift
>     when only one node is in the system.

This change needs mentioning / justifying in the description.

> +static void cf_check dump_numa(unsigned char key)
> +{
> +    s_time_t now = NOW();
> +    unsigned int i, j, n;
> +    struct domain *d;
> +
> +    printk("'%c' pressed -> dumping numa info (now = %"PRI_stime")\n", key,
> +           now);
> +
> +    for_each_online_node ( i )
> +    {
> +        paddr_t pa = pfn_to_paddr(node_start_pfn(i) + 1);
> +
> +        printk("NODE%u start->%lu size->%lu free->%lu\n",
> +               i, node_start_pfn(i), node_spanned_pages(i),
> +               avail_node_heap_pages(i));
> +        /* Sanity check phys_to_nid() */
> +        if ( phys_to_nid(pa) != i )
> +            printk("phys_to_nid(%"PRIpaddr") -> %u should be %u\n",
> +                   pa, phys_to_nid(pa), i);
> +    }
> +
> +    j = cpumask_first(&cpu_online_map);
> +    n = 0;
> +    for_each_online_cpu ( i )
> +    {
> +        if ( i != j + n || cpu_to_node[j] != cpu_to_node[i] )
> +        {
> +            if ( n > 1 )
> +                printk("CPU%u...%u -> NODE%u\n", j, j + n - 1, 
> cpu_to_node[j]);
> +            else
> +                printk("CPU%u -> NODE%u\n", j, cpu_to_node[j]);
> +            j = i;
> +            n = 1;
> +        }
> +        else
> +            ++n;
> +    }
> +    if ( n > 1 )
> +        printk("CPU%u...%u -> NODE%u\n", j, j + n - 1, cpu_to_node[j]);
> +    else
> +        printk("CPU%u -> NODE%u\n", j, cpu_to_node[j]);
> +
> +    rcu_read_lock(&domlist_read_lock);
> +
> +    printk("Memory location of each domain:\n");
> +    for_each_domain ( d )
> +    {
> +        const struct page_info *page;
> +        unsigned int page_num_node[MAX_NUMNODES];
> +        const struct vnuma_info *vnuma;
> +
> +        process_pending_softirqs();
> +
> +        printk("Domain %u (total: %u):\n", d->domain_id, 
> domain_tot_pages(d));

Perhaps switch to using %pd here?

> +        memset(page_num_node, 0, sizeof(unsigned int) * MAX_NUMNODES);

Simply (and less fragile) sizeof(page_num_node)?

Jan



 


Rackspace

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