From patchwork Wed Aug 19 12:13:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 247958 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:522:0:0:0:0 with SMTP id h2csp404576ils; Wed, 19 Aug 2020 05:14:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs0dt5lOpFJe8n+xOZfzBOFlA51BdLs3y8TAVerJPch44/kYcg2YmN1//3140cF8q3aD90 X-Received: by 2002:a17:907:100f:: with SMTP id ox15mr4159322ejb.125.1597839250629; Wed, 19 Aug 2020 05:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597839250; cv=none; d=google.com; s=arc-20160816; b=Zxhtt57uttzqv6glb7UumbjGGT06kYiKqXY6Sh4htTI9UeK9ryiw3udIcXa6hwpCpA Nq1XZFeAQQBKIWN9BO/TqGSgrVwnFVY+HrGmLLevhka88CCNXaFChtutyU0KgIhHqBnI wjHz5EVDJOYd8btdnrdatXgABGtb9+GEUfGWUyG9LCMrEuajw4uvGXDin6+mmHqtJy8L EkJuWHVpUv4DL9h8DdC188YzxVzZQ2B9c2K9SBFq84+BQcf4WS+lyKXfEEr7/icKJlH0 d1g8eu6MdkwFdQebHl8QVhQAP8u9ObLTg+fvrTSxomIOnikhMsgyzceYYB8+oh8m87+4 lq/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=X8lkUvX5IkIr5hd2D2n/jqShANSuHR5K3yAONjn5VZk=; b=mkWxHTpxGGkMqc7sWzDlkd4fCQBGX7ysVwp9QULgKsFyJE0NOz2icBAme0xO+NlAL/ 3ZHdjjTit4OpIM63Y6s9wEYiTpspT6qgvQbwDUCN02PBPYEQuszjgLf9YOgCkQXyoinM pSOD5wL6lXauK6/J8VXsf0Mc4rwLHzJzCDIPPFcptt88zQHqp0Nc7pCdomX2wt52RHG7 QzEgey3VQ8ChzGW7YyxMD7rCrLLEE2CgrRtgjRDj6+6T7gPkCngpwe7mQ0cuSbTtZKqM dF4pNH0AsSzDWjYINEEe32b5n7XnWV3XPRhddIYvgGgKmy8eIc3M7vApWOBtpWzh5sVs XZfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hGdWwUzz; spf=pass (google.com: domain of linux-kselftest-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kselftest-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si16772273eja.559.2020.08.19.05.14.10; Wed, 19 Aug 2020 05:14:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kselftest-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hGdWwUzz; spf=pass (google.com: domain of linux-kselftest-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kselftest-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726798AbgHSMOJ (ORCPT + 6 others); Wed, 19 Aug 2020 08:14:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:51382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbgHSMOH (ORCPT ); Wed, 19 Aug 2020 08:14:07 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 874C6206DA; Wed, 19 Aug 2020 12:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597839246; bh=Ftm+BgFLcJzi0bjTiz8IjEJjLINWXFqX3Rrl97pTpb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hGdWwUzzLPnSon0iOKaq9SG/crBOPwsDLkl71Tmfh0jMLTfAf5jQ4WHrDimzHvqzI OLN3vtTxqe9E7ih91kchWM5gj1ra76v0Nyi+KCdk8cnu3GXosZ+xi8pK9yc/Yw0CjH GdTJGU0vhRSRF45VGT10z4h5NCYSpUPUYb7Hs2sA= From: Mark Brown To: Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, Vincenzo Frascino , linux-kselftest@vger.kernel.org, Shuah Khan , Mark Brown Subject: [PATCH v3 3/5] arm64: vdso: Initialise the per-CPU vDSO data Date: Wed, 19 Aug 2020 13:13:16 +0100 Message-Id: <20200819121318.52158-4-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200819121318.52158-1-broonie@kernel.org> References: <20200819121318.52158-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Register with the CPU hotplug system to initialise the per-CPU data for getcpu(). Signed-off-by: Mark Brown --- arch/arm64/kernel/vdso.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) -- 2.20.1 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 #include +#include #include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -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);