From: Mark Brown <broonie@kernel.org>
To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
Mark Brown <broonie@kernel.org>
Subject: [PATCH v3 3/5] arm64: vdso: Initialise the per-CPU vDSO data
Date: Wed, 19 Aug 2020 13:13:16 +0100 [thread overview]
Message-ID: <20200819121318.52158-4-broonie@kernel.org> (raw)
In-Reply-To: <20200819121318.52158-1-broonie@kernel.org>
Register with the CPU hotplug system to initialise the per-CPU data for
getcpu().
Signed-off-by: Mark Brown <broonie@kernel.org>
---
arch/arm64/kernel/vdso.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 2a8d7ab76bee..d9743c659341 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -9,6 +9,7 @@
#include <linux/cache.h>
#include <linux/clocksource.h>
+#include <linux/cpuhotplug.h>
#include <linux/elf.h>
#include <linux/err.h>
#include <linux/errno.h>
@@ -18,6 +19,7 @@
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/slab.h>
+#include <linux/smp.h>
#include <linux/time_namespace.h>
#include <linux/timekeeper_internal.h>
#include <linux/vmalloc.h>
@@ -466,6 +468,26 @@ int aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
}
#endif /* CONFIG_COMPAT */
+static void vdso_cpu_init(void *p)
+{
+ struct arm64_vdso_data *data = (struct arm64_vdso_data *)vdso_data;
+ unsigned int cpu;
+
+ if (vdso_cpu_offset()) {
+ cpu = smp_processor_id();
+
+ data->cpu_data[cpu].cpu = cpu;
+ data->cpu_data[cpu].node = cpu_to_node(cpu);
+ }
+}
+
+static int vdso_cpu_online(unsigned int cpu)
+{
+ smp_call_function_single(cpu, vdso_cpu_init, NULL, 1);
+
+ return 0;
+}
+
static int vdso_mremap(const struct vm_special_mapping *sm,
struct vm_area_struct *new_vma)
{
@@ -494,6 +516,12 @@ static int __init vdso_init(void)
vdso_info[VDSO_ABI_AA64].dm = &aarch64_vdso_maps[AA64_MAP_VVAR];
vdso_info[VDSO_ABI_AA64].cm = &aarch64_vdso_maps[AA64_MAP_VDSO];
+ /*
+ * Initialize per-CPU data, callback runs for all current and
+ * future CPUs.
+ */
+ cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "vdso", vdso_cpu_online, NULL);
+
return __vdso_init(VDSO_ABI_AA64);
}
arch_initcall(vdso_init);
--
2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>
Cc: Mark Brown <broonie@kernel.org>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 3/5] arm64: vdso: Initialise the per-CPU vDSO data
Date: Wed, 19 Aug 2020 13:13:16 +0100 [thread overview]
Message-ID: <20200819121318.52158-4-broonie@kernel.org> (raw)
In-Reply-To: <20200819121318.52158-1-broonie@kernel.org>
Register with the CPU hotplug system to initialise the per-CPU data for
getcpu().
Signed-off-by: Mark Brown <broonie@kernel.org>
---
arch/arm64/kernel/vdso.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index 2a8d7ab76bee..d9743c659341 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -9,6 +9,7 @@
#include <linux/cache.h>
#include <linux/clocksource.h>
+#include <linux/cpuhotplug.h>
#include <linux/elf.h>
#include <linux/err.h>
#include <linux/errno.h>
@@ -18,6 +19,7 @@
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/slab.h>
+#include <linux/smp.h>
#include <linux/time_namespace.h>
#include <linux/timekeeper_internal.h>
#include <linux/vmalloc.h>
@@ -466,6 +468,26 @@ int aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
}
#endif /* CONFIG_COMPAT */
+static void vdso_cpu_init(void *p)
+{
+ struct arm64_vdso_data *data = (struct arm64_vdso_data *)vdso_data;
+ unsigned int cpu;
+
+ if (vdso_cpu_offset()) {
+ cpu = smp_processor_id();
+
+ data->cpu_data[cpu].cpu = cpu;
+ data->cpu_data[cpu].node = cpu_to_node(cpu);
+ }
+}
+
+static int vdso_cpu_online(unsigned int cpu)
+{
+ smp_call_function_single(cpu, vdso_cpu_init, NULL, 1);
+
+ return 0;
+}
+
static int vdso_mremap(const struct vm_special_mapping *sm,
struct vm_area_struct *new_vma)
{
@@ -494,6 +516,12 @@ static int __init vdso_init(void)
vdso_info[VDSO_ABI_AA64].dm = &aarch64_vdso_maps[AA64_MAP_VVAR];
vdso_info[VDSO_ABI_AA64].cm = &aarch64_vdso_maps[AA64_MAP_VDSO];
+ /*
+ * Initialize per-CPU data, callback runs for all current and
+ * future CPUs.
+ */
+ cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "vdso", vdso_cpu_online, NULL);
+
return __vdso_init(VDSO_ABI_AA64);
}
arch_initcall(vdso_init);
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-08-19 12:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-19 12:13 [PATCH v3 0/5] arm64: vdso: getcpu() support Mark Brown
2020-08-19 12:13 ` Mark Brown
2020-08-19 12:13 ` [PATCH v3 1/5] arm64: vdso: Provide a define when building the vDSO Mark Brown
2020-08-19 12:13 ` Mark Brown
2020-08-19 12:13 ` [PATCH v3 2/5] arm64: vdso: Add per-CPU data Mark Brown
2020-08-19 12:13 ` Mark Brown
2020-08-19 12:13 ` Mark Brown [this message]
2020-08-19 12:13 ` [PATCH v3 3/5] arm64: vdso: Initialise the per-CPU vDSO data Mark Brown
2020-08-19 12:13 ` [PATCH v3 4/5] arm64: vdso: Add getcpu() implementation Mark Brown
2020-08-19 12:13 ` Mark Brown
2020-08-19 12:13 ` [PATCH v3 5/5] selftests: vdso: Support arm64 in getcpu() test Mark Brown
2020-08-19 12:13 ` Mark Brown
2020-08-31 21:47 ` [PATCH v3 0/5] arm64: vdso: getcpu() support Shuah Khan
2020-08-31 21:47 ` Shuah Khan
2020-09-01 9:25 ` Catalin Marinas
2020-09-01 9:25 ` Catalin Marinas
2020-09-01 10:46 ` Mark Brown
2020-09-01 10:46 ` Mark Brown
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=20200819121318.52158-4-broonie@kernel.org \
--to=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=vincenzo.frascino@arm.com \
--cc=will@kernel.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.