[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] NUMA: replace phys_to_nid()
- To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Fri, 16 Dec 2022 11:49:09 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=iN+POd6iucM0FuIyOncCIlDCt+Sf6dLn+TRP+YnCtpQ=; b=eIwo5hhY8YcUnkOUKMjxJLHtG1oQ+Zr4/a2X45US4bxv5XEa+tCm86L93uXvY6KdyZPw7NFR2/PrbS2mWxs8DqhLkworZGH7sLsRXXxYYvo+wq6y/ZlzfSZvhoABVs5of8FKu8a2cw1qT7Hrhhl70BvOJ+oVy7vhbFur1rxNRUT8/VvzVKQGZ0pzbZGS91lGs9O6LgYelYV2rZVMrrBGvWUSBi0P5SliBLQtZN3+W0MFbmxADogzzscwHklERf4/UtjJQfQQ2bEiLV0y4uuQ2ioQxf6X9CihzckZ/mIwjaTzHAFxVK3/MnkFIFN+hHUJoZL6GCQjm1TH81yZShSijg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R+9gm2UN9/NZcDwww151PtKQxDs7thTet5PvT09zIMnkU1xDndZE2QUy/kbTXZ+FGDxEPZLL9bO45aal9QeooHLsIJG3DsOKA8AWN/RdEo9DebOf9JkuZqzrxGGAcJbq/flNPZvy2RrStfYSYvLp+PewTJjeuDX/Sfv5C/IRwrNmyWu959JzJyk2VVjNtmi9dIT5AyfKal1EoQ9FTuwC062VLoOOORQDx1mdzYhhbwlVuHNK1Tww1QlMzNnNRogNc6rFYM1kXbbBOHJ3i3SD2p2Gm7+ZhBFpu7D/Ak4bKve42nq4OZ6vcvf+Iy5Hvh/uDNULcyU/kpjyxwwPxAcRqg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: George Dunlap <George.Dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
- Delivery-date: Fri, 16 Dec 2022 11:49:25 +0000
- Ironport-data: A9a23:zAk9v6xrVqfyFAjacjp6t+e2xyrEfRIJ4+MujC+fZmUNrF6WrkUDy GROWTqFOvmPYGL3Kt0gPIW+/EtVupXUn9VjTgA4+SAxQypGp/SeCIXCJC8cHc8wwu7rFxs7s ppEOrEsCOhuExcwcz/0auCJQUFUjP3OHfykTbaeYUidfCc8IA85kxVvhuUltYBhhNm9Emult Mj75sbSIzdJ4RYtWo4vw//F+U0HUMja4mtC5AVkPK4T5jcyqlFOZH4hDfDpR5fHatE88t6SH 47r0Ly/92XFyBYhYvvNfmHTKxBirhb6ZGBiu1IOM0SQqkEqSh8ai87XAME0e0ZP4whlqvgqo Dl7WT5cfi9yVkHEsLx1vxC1iEiSN4UekFPMCSDXXcB+UyQq2pYjqhljJBheAGEWxgp4KWRF8 +QHFm0SUhrAq9nvx73jduZVjO12eaEHPKtH0p1h5RfwKK56BLzmHeDN79Ie2yosjMdTG/qYf 9AedTdkcBXHZVtIJ0sTD5U92uyvgxETcRUB8A7T+fVxvDOVkFEZPLvFabI5fvSjQ8lPk1nej WXB52njWTkRNcCFyCrD+XWp7gPKtXOkB9pIRebnnhJsqAyUny8RFS9KbgS+ndyi20SHYYh+C FNBr0LCqoB3riRHVOLVXRe1vXqFtR40QMdLHqsx7wTl4rrZ5UOVC3YJShZFacc6r4kmSDoyz FiLktj1Qzt1v9W9S2+Z97qShSO/P24SN2BqTTQfUQIP7t3noYcyphHCVNBuFOiylNKdMS706 yCHqm45nbp7pcQGzbmh9FbLxTelvIHUTxUd7x/SGGmi62tReomhYIC57EnB2vxJJo2ZU1qps WANno6V6+VmMH2WvCmEQeFIELT34f+AaGHYmQQ3Q8Rn8Cmx8Xm+e4wW+Ct5OEpiLscDf3nuf VPXvgRSopRUORNGcJNKXm54MOxypYCIKDgvfqq8ggZmCnSpSDK6wQ==
- Ironport-hdrordr: A9a23:ynbWS6gVekjedD9wSXBn1JYqaHBQXssji2hC6mlwRA09TyX4rb HMoB1/73SftN9/Yh0dcK+7Scu9qB/nm6KdgrNwAV7BZmTbUQKTRelfBODZrAEIdReeygdV79 YET5RD
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHZDudxkldNMZdm+EWY9M6n0vcTdK5wawGA
- Thread-topic: [PATCH 2/2] NUMA: replace phys_to_nid()
On 13/12/2022 11:38 am, Jan Beulich wrote:
> All callers convert frame numbers (perhaps in turn derived from struct
> page_info pointers) to an address, just for the function to convert it
> back to a frame number (as the first step of paddr_to_pdx()). Replace
> the function by mfn_to_nid() plus a page_to_nid() wrapper macro. Replace
> call sites by the respectively most suitable one.
>
> While there also introduce a !NUMA stub, eliminating the need for Arm
> (and potentially other ports) to carry one individually.
Thanks. This will help RISC-V too.
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, albeit with one
deletion.
> --- a/xen/include/xen/numa.h
> +++ b/xen/include/xen/numa.h
> @@ -1,6 +1,7 @@
> #ifndef _XEN_NUMA_H
> #define _XEN_NUMA_H
>
> +#include <xen/mm-frame.h>
> #include <asm/numa.h>
>
> #define NUMA_NO_NODE 0xFF
> @@ -68,12 +69,15 @@ struct node_data {
>
> extern struct node_data node_data[];
>
> -static inline nodeid_t __attribute_pure__ phys_to_nid(paddr_t addr)
> +static inline nodeid_t __attribute_pure__ mfn_to_nid(mfn_t mfn)
> {
> nodeid_t nid;
> - ASSERT((paddr_to_pdx(addr) >> memnode_shift) < memnodemapsize);
> - nid = memnodemap[paddr_to_pdx(addr) >> memnode_shift];
> + unsigned long pdx = mfn_to_pdx(mfn);
> +
> + ASSERT((pdx >> memnode_shift) < memnodemapsize);
> + nid = memnodemap[pdx >> memnode_shift];
> ASSERT(nid < MAX_NUMNODES && node_data[nid].node_spanned_pages);
> +
> return nid;
> }
>
> @@ -102,6 +106,15 @@ extern bool numa_update_node_memblks(nod
> paddr_t start, paddr_t size, bool
> hotplug);
> extern void numa_set_processor_nodes_parsed(nodeid_t node);
>
> +#else
> +
> +static inline nodeid_t __attribute_pure__ mfn_to_nid(mfn_t mfn)
> +{
> + return 0;
> +}
pure is useless on a stub like this, whereas its false on the non-stub
form (uses several non-const variables) in a way that the compiler can
prove (because it's static inline), and will discard.
As you're modifying both lines anyway, just drop the attribute.
~Andrew
|