From patchwork Tue Mar 28 15:53:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijay Kilari X-Patchwork-Id: 9650061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 72175602C8 for ; Tue, 28 Mar 2017 15:56:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63105283E8 for ; Tue, 28 Mar 2017 15:56:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5800828405; Tue, 28 Mar 2017 15:56:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6B722283E8 for ; Tue, 28 Mar 2017 15:56:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cstRj-0006pj-Pt; Tue, 28 Mar 2017 15:54:11 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cstRi-0006pP-MU for xen-devel@lists.xen.org; Tue, 28 Mar 2017 15:54:10 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id A2/6F-03648-2278AD85; Tue, 28 Mar 2017 15:54:10 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRWlGSWpSXmKPExsXiVRvsoqvYfiv C4ORJIYslHxezODB6HN39mymAMYo1My8pvyKBNePK9r+MBWuSK56ebWNrYPwW0MXIxSEkMIFR 4uqCPSwgDovASxaJXaevsII4EgL9rBJPj14DcjiBnBiJJy3tjBB2lcSjn/eZQGwhAVWJjv9v2 SHsb4wSS+ekgthsAjISR54fAKsREZCWuPb5MiPIUGaBZiaJvt1L2EASwgKuEpeezQQbygI0aO b1k2BxXgE3iR8v24EWcwAtU5CYM8kGJMwp4C6x6claZohdbhK3z1xknMAosICRYRWjRnFqUVl qka6xkV5SUWZ6RkluYmaOrqGBmV5uanFxYnpqTmJSsV5yfu4mRmBoMQDBDsbT6wIPMUpyMCmJ 8n4IuhUhxJeUn1KZkVicEV9UmpNafIhRhoNDSYL3dStQTrAoNT21Ii0zBxjkMGkJDh4lEd46k DRvcUFibnFmOkTqFKMux4f+w2+YhFjy8vNSpcR5n4IUCYAUZZTmwY2ARdwlRlkpYV5GoKOEeA pSi3IzS1DlXzGKczAqCfOmtAFN4cnMK4Hb9AroCCagI8RtwI4oSURISTUw9hvWXnl/0fut1E9 jLY8bjzoyImcqt7xw3OV55/7r7slVbEJBK37sn7vDyXwvI5umqNLZR90zS2/dqc9omJXPwzJt trV0wIHpycv4Lmafn1+TV7RAYY/5+5aXQpuaj4Wc4jF/tkBzelDsHdWJch7CBvHs57fvFeEU4 t6+zH/P4Wh3pin6hsy8SizFGYmGWsxFxYkAUfaAf7MCAAA= X-Env-Sender: vijay.kilari@gmail.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1490716448!93874767!1 X-Originating-IP: [74.125.83.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28905 invoked from network); 28 Mar 2017 15:54:09 -0000 Received: from mail-pg0-f68.google.com (HELO mail-pg0-f68.google.com) (74.125.83.68) by server-3.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Mar 2017 15:54:09 -0000 Received: by mail-pg0-f68.google.com with SMTP id g2so22264142pge.2 for ; Tue, 28 Mar 2017 08:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WiYYUHxttVSbomPhf+BjVdBgAzJ5H2V6+owrZzQbW+g=; b=YpJJ+ou1h40WkFU6QIrjDejSa/szPKHGRLmesNqLlbU4dKKLIhZnuQtx5ExJBEgqbB pkFWZvk6rC5jJQFDo1BAD0Y9BQw7yMK3BefbCkx6AA3vHTQJ6YXGxzgt/p2RNymdUBox HSfLRn/TpDxJsupEPyy1plEd/6qUH3tWyyg9eayXno4YAsE5L4Bwud4bMFFhblEGrNVp YvE/KwjDCSErG30su7iVprCKDrswcCXPTok7qVTvLepvzeabJS7CkVNLKmk5ahFp7cN3 CWPkq5daUS/+clPC18HozkxHQR1Ff/0DqBUIw55PF3MTM8hdQvTj8U2r2s3l1i2IBQZT Jm0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WiYYUHxttVSbomPhf+BjVdBgAzJ5H2V6+owrZzQbW+g=; b=p3A58n3BqpTmjJLtdybhkfBrfsupAdr0MQG8stUU3m2xoxC/Ca3YoruvnHEHaDVZSQ rMOqsqToxDFLDVaS1rbVPD71VxAK1Gi/B1bEGKIfY1aguioBw5JCWt7JYtLPno3MVmlO ZL4nQZfb51KFVQX+/fBuXk7yk5euPEtp2qTfK5FH5qIhK6IMjWrb/DLTE5HM/swzw6Fx BbbZLA6g4yyGQkXPWr0vuTnOu29nXyejRGIOpY6xL9cFfWrxPcsdL7ZehIQRyBXFpHh1 EzCnOpHxTVH8Bbu+gwJZN4Beh6pUZb2/tbPDdmwecSWcKc6rHcLrfzF8eKI8h51sThIM EAFQ== X-Gm-Message-State: AFeK/H0TIyJuI9NiAdvyXf57IfKhiEdO+7+DM0R/x37/XG2z27gthF0A9Dvpdds1u/n+dQ== X-Received: by 10.98.74.154 with SMTP id c26mr32428080pfj.236.1490716447413; Tue, 28 Mar 2017 08:54:07 -0700 (PDT) Received: from localhost.localdomain ([14.140.2.178]) by smtp.gmail.com with ESMTPSA id y7sm8298867pfk.93.2017.03.28.08.54.03 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Mar 2017 08:54:06 -0700 (PDT) From: vijay.kilari@gmail.com To: xen-devel@lists.xen.org Date: Tue, 28 Mar 2017 21:23:10 +0530 Message-Id: <1490716413-19796-3-git-send-email-vijay.kilari@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1490716413-19796-1-git-send-email-vijay.kilari@gmail.com> References: <1490716413-19796-1-git-send-email-vijay.kilari@gmail.com> Cc: sstabellini@kernel.org, wei.liu2@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, julien.grall@arm.com, jbeulich@suse.com, Vijaya Kumar K Subject: [Xen-devel] [RFC PATCH v2 02/25] x86: NUMA: Fix datatypes and attributes X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Vijaya Kumar K Change u{8,32,64} to uint{8,32,64}_t and bool_t to bool. Fix attributes coding styles. Also change memnodeshift to unsigned int. Signed-off-by: Vijaya Kumar K --- xen/arch/x86/numa.c | 40 +++++++++++++++++------------------ xen/arch/x86/srat.c | 52 +++++++++++++++++++++++----------------------- xen/include/asm-arm/numa.h | 2 +- xen/include/asm-x86/numa.h | 17 ++++++++------- 4 files changed, 56 insertions(+), 55 deletions(-) diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index 8ee2302..8ed31cb 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -24,12 +24,12 @@ custom_param("numa", numa_setup); struct node_data node_data[MAX_NUMNODES]; /* Mapping from pdx to node id */ -int memnode_shift; +unsigned int memnode_shift; static typeof(*memnodemap) _memnodemap[64]; unsigned long memnodemapsize; -u8 *memnodemap; +uint8_t *memnodemap; -nodeid_t cpu_to_node[NR_CPUS] __read_mostly = { +nodeid_t __read_mostly cpu_to_node[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; /* @@ -38,11 +38,11 @@ nodeid_t cpu_to_node[NR_CPUS] __read_mostly = { nodeid_t apicid_to_node[MAX_LOCAL_APIC] = { [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE }; -cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly; +cpumask_t __read_mostly node_to_cpumask[MAX_NUMNODES]; nodemask_t __read_mostly node_online_map = { { [0] = 1UL } }; -bool_t numa_off = 0; +bool numa_off = 0; s8 acpi_numa = 0; int srat_disabled(void) @@ -166,7 +166,7 @@ int __init compute_hash_shift(struct node *nodes, int numnodes, return shift; } /* initialize NODE_DATA given nodeid and start/end */ -void __init setup_node_bootmem(nodeid_t nodeid, u64 start, u64 end) +void __init setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end) { unsigned long start_pfn, end_pfn; @@ -201,19 +201,19 @@ void __init numa_init_array(void) } #ifdef CONFIG_NUMA_EMU -static int numa_fake __initdata = 0; +static int __initdata numa_fake = 0; /* Numa emulation */ -static int __init numa_emulation(u64 start_pfn, u64 end_pfn) +static int __init numa_emulation(uint64_t start_pfn, uint64_t end_pfn) { int i; struct node nodes[MAX_NUMNODES]; - u64 sz = ((end_pfn - start_pfn) << PAGE_SHIFT) / numa_fake; + uint64_t sz = ((end_pfn - start_pfn) << PAGE_SHIFT) / numa_fake; /* Kludge needed for the hash function */ if ( hweight64(sz) > 1 ) { - u64 x = 1; + uint64_t x = 1; while ( (x << 1) < sz ) x <<= 1; if ( x < sz / 2 ) @@ -260,8 +260,8 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) #endif #ifdef CONFIG_ACPI_NUMA - if ( !numa_off && !acpi_scan_nodes((u64)start_pfn << PAGE_SHIFT, - (u64)end_pfn << PAGE_SHIFT) ) + if ( !numa_off && !acpi_scan_nodes((uint64_t)start_pfn << PAGE_SHIFT, + (uint64_t)end_pfn << PAGE_SHIFT) ) return; #endif @@ -269,8 +269,8 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) numa_off ? "NUMA turned off" : "No NUMA configuration found"); printk(KERN_INFO "Faking a node at %016"PRIx64"-%016"PRIx64"\n", - (u64)start_pfn << PAGE_SHIFT, - (u64)end_pfn << PAGE_SHIFT); + (uint64_t)start_pfn << PAGE_SHIFT, + (uint64_t)end_pfn << PAGE_SHIFT); /* setup dummy node covering all memory */ memnode_shift = BITS_PER_LONG - 1; memnodemap = _memnodemap; @@ -279,8 +279,8 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) for ( i = 0; i < nr_cpu_ids; i++ ) numa_set_node(i, 0); cpumask_copy(&node_to_cpumask[0], cpumask_of(0)); - setup_node_bootmem(0, (u64)start_pfn << PAGE_SHIFT, - (u64)end_pfn << PAGE_SHIFT); + setup_node_bootmem(0, (paddr_t)start_pfn << PAGE_SHIFT, + (paddr_t)end_pfn << PAGE_SHIFT); } void numa_add_cpu(int cpu) @@ -294,7 +294,7 @@ void numa_set_node(int cpu, nodeid_t node) } /* [numa=off] */ -static __init int numa_setup(char *opt) +static int __init numa_setup(char *opt) { if ( !strncmp(opt,"off",3) ) numa_off = 1; @@ -339,7 +339,7 @@ void __init init_cpu_to_node(void) for ( i = 0; i < nr_cpu_ids; i++ ) { - u32 apicid = x86_cpu_to_apicid[i]; + uint32_t apicid = x86_cpu_to_apicid[i]; if ( apicid == BAD_APICID ) continue; node = apicid < MAX_LOCAL_APIC ? apicid_to_node[apicid] : NUMA_NO_NODE; @@ -380,7 +380,7 @@ static void dump_numa(unsigned char key) const struct vnuma_info *vnuma; printk("'%c' pressed -> dumping numa info (now-0x%X:%08X)\n", key, - (u32)(now >> 32), (u32)now); + (uint32_t)(now >> 32), (uint32_t)now); for_each_online_node ( i ) { @@ -507,7 +507,7 @@ static void dump_numa(unsigned char key) rcu_read_unlock(&domlist_read_lock); } -static __init int register_numa_trigger(void) +static int __init register_numa_trigger(void) { register_keyhandler('u', dump_numa, "dump NUMA info", 1); return 0; diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index d270b75..800a7c3 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -23,12 +23,12 @@ static struct acpi_table_slit *__read_mostly acpi_slit; -static nodemask_t memory_nodes_parsed __initdata; -static nodemask_t processor_nodes_parsed __initdata; -static struct node nodes[MAX_NUMNODES] __initdata; +static nodemask_t __initdata memory_nodes_parsed; +static nodemask_t __initdata processor_nodes_parsed; +static struct node __initdata nodes[MAX_NUMNODES]; struct pxm2node { - unsigned pxm; + unsigned int pxm; nodeid_t node; }; static struct pxm2node __read_mostly pxm2node[MAX_NUMNODES] = @@ -41,15 +41,15 @@ static struct node node_memblk_range[NR_NODE_MEMBLKS]; static nodeid_t memblk_nodeid[NR_NODE_MEMBLKS]; static __initdata DECLARE_BITMAP(memblk_hotplug, NR_NODE_MEMBLKS); -static inline bool_t node_found(unsigned idx, unsigned pxm) +static inline bool node_found(unsigned idx, unsigned pxm) { return ((pxm2node[idx].pxm == pxm) && (pxm2node[idx].node != NUMA_NO_NODE)); } -nodeid_t pxm_to_node(unsigned pxm) +nodeid_t pxm_to_node(unsigned int pxm) { - unsigned i; + unsigned int i; if ((pxm < ARRAY_SIZE(pxm2node)) && node_found(pxm, pxm)) return pxm2node[pxm].node; @@ -64,9 +64,9 @@ nodeid_t pxm_to_node(unsigned pxm) nodeid_t setup_node(unsigned pxm) { nodeid_t node; - unsigned idx; - static bool_t warned; - static unsigned nodes_found; + unsigned int idx; + static bool warned; + static unsigned int nodes_found; BUILD_BUG_ON(MAX_NUMNODES >= NUMA_NO_NODE); @@ -103,7 +103,7 @@ nodeid_t setup_node(unsigned pxm) return node; } -int valid_numa_range(u64 start, u64 end, nodeid_t node) +int valid_numa_range(paddr_t start, paddr_t end, nodeid_t node) { int i; @@ -118,7 +118,7 @@ int valid_numa_range(u64 start, u64 end, nodeid_t node) return 0; } -static __init int conflicting_memblks(u64 start, u64 end) +static int __init conflicting_memblks(paddr_t start, paddr_t end) { int i; @@ -134,7 +134,7 @@ static __init int conflicting_memblks(u64 start, u64 end) return -1; } -static __init void cutoff_node(int i, u64 start, u64 end) +static void __init cutoff_node(int i, paddr_t start, paddr_t end) { struct node *nd = &nodes[i]; if (nd->start < start) { @@ -149,7 +149,7 @@ static __init void cutoff_node(int i, u64 start, u64 end) } } -static __init void bad_srat(void) +static void __init bad_srat(void) { int i; printk(KERN_ERR "SRAT: SRAT not used.\n"); @@ -167,13 +167,13 @@ static __init void bad_srat(void) * distance than the others. * Do some quick checks here and only use the SLIT if it passes. */ -static __init int slit_valid(struct acpi_table_slit *slit) +static int __init slit_valid(struct acpi_table_slit *slit) { int i, j; int d = slit->locality_count; for (i = 0; i < d; i++) { for (j = 0; j < d; j++) { - u8 val = slit->entry[d*i + j]; + uint8_t val = slit->entry[d*i + j]; if (i == j) { if (val != 10) return 0; @@ -274,7 +274,7 @@ acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *pa) void __init acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma) { - u64 start, end; + uint64_t start, end; unsigned pxm; nodeid_t node; int i; @@ -311,8 +311,8 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma) if (i < 0) /* everything fine */; else if (memblk_nodeid[i] == node) { - bool_t mismatch = !(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) != - !test_bit(i, memblk_hotplug); + bool mismatch = !(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) != + !test_bit(i, memblk_hotplug); printk("%sSRAT: PXM %u (%"PRIx64"-%"PRIx64") overlaps with itself (%"PRIx64"-%"PRIx64")\n", mismatch ? KERN_ERR : KERN_WARNING, pxm, start, end, @@ -401,7 +401,7 @@ static int __init nodes_cover_memory(void) void __init acpi_numa_arch_fixup(void) {} -static u64 __initdata srat_region_mask; +static uint64_t __initdata srat_region_mask; static int __init srat_parse_region(struct acpi_subtable_header *header, const unsigned long end) @@ -428,9 +428,9 @@ static int __init srat_parse_region(struct acpi_subtable_header *header, return 0; } -void __init srat_parse_regions(u64 addr) +void __init srat_parse_regions(uint64_t addr) { - u64 mask; + uint64_t mask; unsigned int i; if (acpi_disabled || acpi_numa < 0 || @@ -453,7 +453,7 @@ void __init srat_parse_regions(u64 addr) } /* Use the information discovered above to actually set up the nodes. */ -int __init acpi_scan_nodes(u64 start, u64 end) +int __init acpi_scan_nodes(uint64_t start, uint64_t end) { int i; nodemask_t all_nodes_parsed; @@ -485,7 +485,7 @@ int __init acpi_scan_nodes(u64 start, u64 end) /* Finally register nodes */ for_each_node_mask(i, all_nodes_parsed) { - u64 size = nodes[i].end - nodes[i].start; + uint64_t size = nodes[i].end - nodes[i].start; if ( size == 0 ) printk(KERN_WARNING "SRAT: Node %u has no memory. " "BIOS Bug or mis-configured hardware?\n", i); @@ -514,10 +514,10 @@ static unsigned node_to_pxm(nodeid_t n) return 0; } -u8 __node_distance(nodeid_t a, nodeid_t b) +uint8_t __node_distance(nodeid_t a, nodeid_t b) { unsigned index; - u8 slit_val; + uint8_t slit_val; if (!acpi_slit) return a == b ? 10 : 20; diff --git a/xen/include/asm-arm/numa.h b/xen/include/asm-arm/numa.h index a2c1a34..53f99af 100644 --- a/xen/include/asm-arm/numa.h +++ b/xen/include/asm-arm/numa.h @@ -1,7 +1,7 @@ #ifndef __ARCH_ARM_NUMA_H #define __ARCH_ARM_NUMA_H -typedef u8 nodeid_t; +typedef uint8_t nodeid_t; /* Fake one node for now. See also node_online_map. */ #define cpu_to_node(cpu) 0 diff --git a/xen/include/asm-x86/numa.h b/xen/include/asm-x86/numa.h index da8a459..748cdfd 100644 --- a/xen/include/asm-x86/numa.h +++ b/xen/include/asm-x86/numa.h @@ -5,7 +5,7 @@ #define NODES_SHIFT 6 -typedef u8 nodeid_t; +typedef uint8_t nodeid_t; extern int srat_rev; @@ -18,7 +18,8 @@ extern cpumask_t node_to_cpumask[]; #define node_to_cpumask(node) (node_to_cpumask[node]) struct node { - u64 start,end; + paddr_t start; + paddr_t end; }; extern int compute_hash_shift(struct node *nodes, int numnodes, @@ -37,13 +38,13 @@ extern void numa_set_node(int cpu, nodeid_t node); extern nodeid_t setup_node(unsigned int pxm); extern void srat_detect_node(int cpu); -extern void setup_node_bootmem(nodeid_t nodeid, u64 start, u64 end); +extern void setup_node_bootmem(nodeid_t nodeid, paddr_t start, paddr_t end); extern nodeid_t apicid_to_node[]; extern void init_cpu_to_node(void); /* Simple perfect hash to map pdx to node numbers */ -extern int memnode_shift; -extern u8 *memnodemap; +extern unsigned int memnode_shift; +extern uint8_t *memnodemap; struct node_data { unsigned long node_start_pfn; @@ -64,10 +65,10 @@ static inline __attribute__((pure)) nodeid_t phys_to_nid(paddr_t addr) #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ NODE_DATA(nid)->node_spanned_pages) -extern int valid_numa_range(u64 start, u64 end, nodeid_t node); +extern int valid_numa_range(paddr_t start, paddr_t end, nodeid_t node); -void srat_parse_regions(u64 addr); -extern u8 __node_distance(nodeid_t a, nodeid_t b); +void srat_parse_regions(uint64_t addr); +extern uint8_t __node_distance(nodeid_t a, nodeid_t b); unsigned int arch_get_dma_bitsize(void); #endif