From patchwork Mon Jul 29 12:12:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11063721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6035D13AC for ; Mon, 29 Jul 2019 12:13:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5060F26D05 for ; Mon, 29 Jul 2019 12:13:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 447AC287E5; Mon, 29 Jul 2019 12:13:43 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C6350286F9 for ; Mon, 29 Jul 2019 12:13:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hs4Vk-0006fM-H6; Mon, 29 Jul 2019 12:12:16 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hs4Vi-0006dc-9g for xen-devel@lists.xenproject.org; Mon, 29 Jul 2019 12:12:14 +0000 X-Inumbo-ID: 19196c88-b1fa-11e9-a920-c38cce9d7243 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 19196c88-b1fa-11e9-a920-c38cce9d7243; Mon, 29 Jul 2019 12:12:13 +0000 (UTC) Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: DrraWLNbgCR9vHZf8Lr+j2mjbl3oOB4oIFPs8no0crbJy+jJ/Q4kM85d8qYfduYgPJmxNErBOz LIqIK2AJL5sLr/Jtl5o7VgfIDUANGoYAZjCRi7dhKohTv2OSO/66nY59t7NyaG6QLtU2xMYNFQ 9Lkb6uWLLoJyYvCss6sh+/6eNzIyy3kjpPGcgirqnIhxRPbVn/A6lYsdYIdcGitGRyQk0ng1RA 5MKB5KVoQD9+1qs+gErcO4Wp4hOy9z2jPVu9G5S1A4vlOffqOl0ao4a02fhkGE6W2bDy4fjLuv jas= X-SBRS: 2.7 X-MesageID: 3672667 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,322,1559534400"; d="scan'208";a="3672667" From: Andrew Cooper To: Xen-devel Date: Mon, 29 Jul 2019 13:12:02 +0100 Message-ID: <20190729121204.13559-9-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190729121204.13559-1-andrew.cooper3@citrix.com> References: <20190729121204.13559-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3 08/10] xen/nodemask: Introduce unlocked __nodemask_{set, clear}() helpers X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Andrew Cooper , Julien Grall , Jan Beulich , Volodymyr Babchuk , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP As with the cpumask side of things, there are times when we do not need locked bit operations on a nodemask. Convert appropriate callers. Three of them operate on init-time data, while domain_update_node_affinity() already has updates to the nodemask in question protected by a spinlock. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk v3: * New --- xen/arch/x86/dom0_build.c | 2 +- xen/arch/x86/srat.c | 4 ++-- xen/common/domain.c | 2 +- xen/include/xen/nodemask.h | 12 ++++++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 06500c87c6..c625e64d03 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -246,7 +246,7 @@ unsigned int __init dom0_max_vcpus(void) for ( i = 0; i < dom0_nr_pxms; ++i ) if ( (node = pxm_to_node(dom0_pxms[i])) != NUMA_NO_NODE ) - node_set(node, dom0_nodes); + __nodemask_set(node, &dom0_nodes); nodes_and(dom0_nodes, dom0_nodes, node_online_map); if ( nodes_empty(dom0_nodes) ) dom0_nodes = node_online_map; diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index 506a56d66b..5f44ac27f1 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -228,7 +228,7 @@ acpi_numa_x2apic_affinity_init(const struct acpi_srat_x2apic_cpu_affinity *pa) } apicid_to_node[pa->apic_id] = node; - node_set(node, processor_nodes_parsed); + __nodemask_set(node, &processor_nodes_parsed); acpi_numa = 1; printk(KERN_INFO "SRAT: PXM %u -> APIC %08x -> Node %u\n", pxm, pa->apic_id, node); @@ -261,7 +261,7 @@ acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *pa) return; } apicid_to_node[pa->apic_id] = node; - node_set(node, processor_nodes_parsed); + __nodemask_set(node, &processor_nodes_parsed); acpi_numa = 1; printk(KERN_INFO "SRAT: PXM %u -> APIC %02x -> Node %u\n", pxm, pa->apic_id, node); diff --git a/xen/common/domain.c b/xen/common/domain.c index 11565a64b3..5dbc68cbc3 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -617,7 +617,7 @@ void domain_update_node_affinity(struct domain *d) d->node_affinity = NODEMASK_NONE; for_each_cpu ( cpu, dom_affinity ) - node_set(cpu_to_node(cpu), d->node_affinity); + __nodemask_set(cpu_to_node(cpu), &d->node_affinity); } spin_unlock(&d->node_affinity_lock); diff --git a/xen/include/xen/nodemask.h b/xen/include/xen/nodemask.h index 9933fec5c4..1605c1bcc5 100644 --- a/xen/include/xen/nodemask.h +++ b/xen/include/xen/nodemask.h @@ -11,7 +11,9 @@ * The available nodemask operations are: * * void node_set(node, mask) turn on bit 'node' in mask + * void __nodemask_set(node, mask) turn on bit 'node' in mask (unlocked) * void node_clear(node, mask) turn off bit 'node' in mask + * void __nodemask_clear(node, mask) turn off bit 'node' in mask (unlocked) * bool nodemask_test(node, mask) true iff bit 'node' set in mask * int node_test_and_set(node, mask) test and set bit 'node' in mask * @@ -100,12 +102,22 @@ static inline void __node_set(int node, volatile nodemask_t *dstp) set_bit(node, dstp->bits); } +static inline void __nodemask_set(unsigned int node, nodemask_t *dst) +{ + __set_bit(node, dst->bits); +} + #define node_clear(node, dst) __node_clear((node), &(dst)) static inline void __node_clear(int node, volatile nodemask_t *dstp) { clear_bit(node, dstp->bits); } +static inline void __nodemask_clear(unsigned int node, nodemask_t *dst) +{ + __clear_bit(node, dst->bits); +} + static inline bool nodemask_test(unsigned int node, const nodemask_t *dst) { return test_bit(node, dst->bits);