Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10300404rwb; Fri, 25 Nov 2022 03:22:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5hhztrXFhWcbbq/U3vIQIX81GvNze8lcnN+ZLMFm7tZ7Ifwt1w8gvZjJxA5N0ew2YeHbyP X-Received: by 2002:a17:906:124d:b0:7ad:b822:d2e4 with SMTP id u13-20020a170906124d00b007adb822d2e4mr31417578eja.35.1669375364801; Fri, 25 Nov 2022 03:22:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669375364; cv=none; d=google.com; s=arc-20160816; b=ehhK7dX1MFmOon2bYs2JfynAFJ/IpX7VoWoYetGQPF5Vq8b47c4yir4DTHEARtbZCf +YsO3fHOGIq13DMxsqSDqXR3BATzh/NnsOrVSLzJH7mPRAVqcI5MQt60loptTE5/9+tm odZUlI7zs6rKRdvWh+YG/BvMU71I1rMQ5CBLb8IkxwRcVjUYGtzmrpq6eASXpl16tSkx auEGKM4jzOkAUYIOpv+YdK9hS9hP3/37A/sfq/tt0IYGnu9NMQTj1XvHdFTldt0LGr6G Iqy1cWwGNIbWK7n69QG6lzclCuvlEreyIsTtsUPRcuaL0unpKgYxNFtg2Xy+Ufhj0jMF LJYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=ksDDcmQCY+1As7J2HctVpfMXUOEO/R8OEqcyPN1HAtc=; b=pzZSLuxI2onfZ2bZngAtl3tT5LiL/mAVFq2ydV7J8FxL7rQBXxXpKD7lVl3PFMOnvH h2SfijMf/0ZUnGo5XzWZmrJajnau++866oI7y5lqu4YiwyACn9wYb2rGv/SpsyBBYP7U nPTV4seLf5JKLOZ/2rlz7hCDXFcBkpva9wcBU3DrhZNngLPGec5sGRS248BQ+sXTJOEm 1kPw9CgEzpTSUDw870MUo6ZriS57D3Srmxj1Gy0XtJ/r3e3lTUI4CJtiB+9h5MFLR3Ps pWSy+pnjwYJnShrDS+5qSzCZgwad25BOySck4AEsyKgnRlrFb+cVgaESKTgquHLHa/0Z fP8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=sV3Ks6Wn; dkim=neutral (no key) header.i=@linutronix.de header.b=dGP36mBt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa38-20020a1709076d2600b007815ca78c38si2931418ejc.235.2022.11.25.03.22.23; Fri, 25 Nov 2022 03:22:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=sV3Ks6Wn; dkim=neutral (no key) header.i=@linutronix.de header.b=dGP36mBt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229863AbiKYJnA (ORCPT + 86 others); Fri, 25 Nov 2022 04:43:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229775AbiKYJmo (ORCPT ); Fri, 25 Nov 2022 04:42:44 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FDBB23BF9 for ; Fri, 25 Nov 2022 01:42:39 -0800 (PST) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669369357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ksDDcmQCY+1As7J2HctVpfMXUOEO/R8OEqcyPN1HAtc=; b=sV3Ks6WnkZ68pgk95VzupBIV3V6E8bwuylnssY4zHQwhs0VzeWVz3mq+F3DpVZmvr6RXC0 FyEifY8N1A2E3UQzxkJaS9OuijDNpIz/Bzn1b0H8eeoucEpBSGVRcYvgt3LQTR2ooxBI+f iogtYQ9zLp4PR3xG0tUVeAwIcjrQLIPh8m4fd6Zhm9qIHcGaqgSmK6MZc7bYWrbH7nqJaj gApVZUYjEg5JdGWG8H12V2q832ho0b5NSbcszudy5JxvW7qAXXrkIDHrbif3PEwye+P7lc DnvG27Dj6+vrh+qMLKwEmTGzthj5ulN43WArk0AheUHGMXKN2DatzcH0KTOxUg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669369357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ksDDcmQCY+1As7J2HctVpfMXUOEO/R8OEqcyPN1HAtc=; b=dGP36mBtjGK+hzexrC2h0GV58AMU2lCv//tdl3WWVpcD5QvjxW3lrHK6uuc3d8caDFXHjD 1XY/wPu77bAOe1Bw== To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Roland Mainz , "H. Peter Anvin" , Borislav Petkov , Dave Hansen , Ingo Molnar , Thomas Gleixner , Sebastian Andrzej Siewior Subject: [PATCH 2/3] x86/vdso: Provide getcpu for x86-32. Date: Fri, 25 Nov 2022 10:42:15 +0100 Message-Id: <20221125094216.3663444-3-bigeasy@linutronix.de> In-Reply-To: <20221125094216.3663444-1-bigeasy@linutronix.de> References: <20221125094216.3663444-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wire up __vdso_getcpu() for x86-32. The version for 64bit can be reused. The defines must no be faked (like it is done for vclock_gettime.c) because we need the 64bit defines for the 32bit VDSO because the segment number of the host kernel is required. Reuse the vgetcpu.c for vdso32. Remove the time* header files which lead to compile errors on 32bit. Add segment.h which provides vdso_read_cpunode() and its requirements. Signed-off-by: Sebastian Andrzej Siewior --- arch/x86/entry/vdso/Makefile | 3 ++- arch/x86/entry/vdso/vdso32/vdso32.lds.S | 1 + arch/x86/entry/vdso/vdso32/vgetcpu.c | 2 ++ arch/x86/entry/vdso/vgetcpu.c | 3 +-- 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 arch/x86/entry/vdso/vdso32/vgetcpu.c diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index 3e88b9df8c8f1..fcbcfc2b4e1a7 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -29,7 +29,7 @@ VDSO32-$(CONFIG_IA32_EMULATION) :=3D y # files to link into the vdso vobjs-y :=3D vdso-note.o vclock_gettime.o vgetcpu.o vobjs32-y :=3D vdso32/note.o vdso32/system_call.o vdso32/sigreturn.o -vobjs32-y +=3D vdso32/vclock_gettime.o +vobjs32-y +=3D vdso32/vclock_gettime.o vdso32/vgetcpu.o vobjs-$(CONFIG_X86_SGX) +=3D vsgx.o =20 # files to link into kernel @@ -103,6 +103,7 @@ $(vobjs): KBUILD_AFLAGS +=3D -DBUILD_VDSO CFLAGS_REMOVE_vclock_gettime.o =3D -pg CFLAGS_REMOVE_vdso32/vclock_gettime.o =3D -pg CFLAGS_REMOVE_vgetcpu.o =3D -pg +CFLAGS_REMOVE_vdso32/vgetcpu.o =3D -pg CFLAGS_REMOVE_vsgx.o =3D -pg =20 # diff --git a/arch/x86/entry/vdso/vdso32/vdso32.lds.S b/arch/x86/entry/vdso/= vdso32/vdso32.lds.S index c7720995ab1af..8a3be07006bb6 100644 --- a/arch/x86/entry/vdso/vdso32/vdso32.lds.S +++ b/arch/x86/entry/vdso/vdso32/vdso32.lds.S @@ -28,6 +28,7 @@ VERSION __vdso_time; __vdso_clock_getres; __vdso_clock_gettime64; + __vdso_getcpu; }; =20 LINUX_2.5 { diff --git a/arch/x86/entry/vdso/vdso32/vgetcpu.c b/arch/x86/entry/vdso/vds= o32/vgetcpu.c new file mode 100644 index 0000000000000..b777f84ffae9b --- /dev/null +++ b/arch/x86/entry/vdso/vdso32/vgetcpu.c @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "../vgetcpu.c" diff --git a/arch/x86/entry/vdso/vgetcpu.c b/arch/x86/entry/vdso/vgetcpu.c index b88a82bbc3593..0a9007c240568 100644 --- a/arch/x86/entry/vdso/vgetcpu.c +++ b/arch/x86/entry/vdso/vgetcpu.c @@ -7,8 +7,7 @@ =20 #include #include -#include -#include +#include =20 notrace long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) --=20 2.38.1