From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
"Wei Liu" <wl@xen.org>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Julien Grall" <julien.grall@arm.com>,
"Jan Beulich" <JBeulich@suse.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH v3 08/10] xen/nodemask: Introduce unlocked __nodemask_{set, clear}() helpers
Date: Mon, 29 Jul 2019 13:12:02 +0100 [thread overview]
Message-ID: <20190729121204.13559-9-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20190729121204.13559-1-andrew.cooper3@citrix.com>
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 <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
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);
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-07-29 12:12 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 12:11 [Xen-devel] [PATCH v3 00/10] xen/nodemask: API cleanup and fixes Andrew Cooper
2019-07-29 12:11 ` [Xen-devel] [PATCH v3 01/10] page-alloc: Clamp get_free_buddy() to online nodes Andrew Cooper
2019-07-29 15:48 ` Jan Beulich
2019-07-29 17:26 ` Andrew Cooper
2019-07-30 8:09 ` Jan Beulich
2019-07-30 17:32 ` Andrew Cooper
2019-07-31 8:22 ` Jan Beulich
2019-07-31 9:01 ` Andrew Cooper
2019-07-29 12:11 ` [Xen-devel] [PATCH v3 02/10] xen/bitmap: Drop {bitmap, cpumask, nodes}_shift_{left, right}() Andrew Cooper
2019-07-29 15:50 ` Jan Beulich
2019-07-29 12:11 ` [Xen-devel] [PATCH v3 03/10] xen/nodemask: Drop any_online_node() and first_unset_node() Andrew Cooper
2019-07-29 15:51 ` Jan Beulich
2019-07-29 12:11 ` [Xen-devel] [PATCH v3 04/10] xen/mask: Convert {cpu, node}mask_test() to be static inline Andrew Cooper
2019-07-30 8:52 ` Jan Beulich
2019-07-30 9:03 ` Andrew Cooper
2019-07-29 12:11 ` [Xen-devel] [PATCH v3 05/10] xen/cpumask: Introduce a CPUMASK_PR() wrapper for printing Andrew Cooper
2019-07-30 8:55 ` Jan Beulich
2019-07-29 12:12 ` [Xen-devel] [PATCH v3 06/10] xen/nodemask: Introduce a NODEMASK_PR() " Andrew Cooper
2019-07-30 8:58 ` Jan Beulich
2019-07-30 9:09 ` Andrew Cooper
2019-07-29 12:12 ` [Xen-devel] [PATCH v3 07/10] xen/nodemask: Drop nodes_{setall, clear}() and improve the initialisers Andrew Cooper
2019-07-30 9:44 ` Jan Beulich
2019-07-31 12:49 ` Andrew Cooper
2019-07-31 13:12 ` Jan Beulich
2019-07-31 13:32 ` Andrew Cooper
2019-07-29 12:12 ` Andrew Cooper [this message]
2019-07-30 11:26 ` [Xen-devel] [PATCH v3 08/10] xen/nodemask: Introduce unlocked __nodemask_{set, clear}() helpers Jan Beulich
2019-07-30 17:48 ` Andrew Cooper
2019-07-31 8:41 ` Jan Beulich
2019-07-29 12:12 ` [Xen-devel] [PATCH v3 09/10] xen/nodemask: Sanitise the remainder of the nodemask API Andrew Cooper
2019-07-30 11:43 ` Jan Beulich
2019-07-29 12:12 ` [Xen-devel] [PATCH v3 10/10] xen/nodemask: Drop remaining refeces to linux Andrew Cooper
2019-07-30 11:44 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190729121204.13559-9-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=julien.grall@arm.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.