From patchwork Mon Dec 16 14:09:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13909814 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A159E7717F for ; Mon, 16 Dec 2024 14:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:Message-Id:Date: Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=n9/Bl2D2hGmk4e/zYH8n0iWgg6/UgfutMAW4/nnqPcg=; b=E86i4XRwMUW1kq RJL2Y74uRQbmcXN5u0r7l4jXzwsnB9f31OmfPzPF6m52L5WUjLUmmNwKxpL141sDfW/LPbYpZ3wpO YPoIftk9i44lwN3v9GHM7cSZNz3aP/UapvNOLsREc4HQ7E0n1Lvw/eAxAWBxxAmef4TpM3XTPtYum FmMoi5KtrD8QlfI343hnjvk3cgsX+HCu7YYGKEYHuYY1DcyaQD3A8QPHgI3dnpEIQAvGJ4fjSLIyK 7eh+brp5WkSFBptChHnhFXm3QbViS+rL0iUgmdMCcoNDIlP182wrc57xggAW4ehXh8c6tTo/eL683 RfxJiV6p1ge+HwNNzrMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNBwZ-0000000ADu0-3QIs; Mon, 16 Dec 2024 14:19:31 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNBoE-0000000ABNJ-1tPd; Mon, 16 Dec 2024 14:10:56 +0000 From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1734358250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HKVp/Caa3kBEDzmNrfvKYA3RNNrY0C92zVprRqMI1SE=; b=KdufFQ9yzC5Ccn77ghWA8wMSofMP42Zkq2YdPaJ2A10YNms20X7NC8Hxi+abz4ROYmqVYh CKh8+qO4oFDm3McLx4thCKwPp4d9pZkbPn7YuRT6GdMzrOCCJ9LAd+SLXp9FxXhrYc1Njf EASL4b3P4RxQ/VMcgorUj16d32fvKJI5JcWLHGxqYuOOu7tXzsGjHIKxOeEWngv8j8V1xD VqLUtnbtI3PL9fNVv0DclRhDYLLKxW9sneh1Gx5Q8jZ+EULkpYDXOXsb4FJG7BTQMCkBGb E5E9fCgAEOXWs0vcarn0iqbq9v3goh4LSx3xpzWX3C+fuKDi/c1tOtRR/bod3w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1734358250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HKVp/Caa3kBEDzmNrfvKYA3RNNrY0C92zVprRqMI1SE=; b=/u+tT8fSj1h0nM3WDlaNJH3x66iqvvap+8AtYcWufIcKOYjQK6XUnl7D/FVY+IzgCPpSQr 1E+y5++vPqqWOdDQ== Subject: [PATCH 00/17] vDSO: Introduce generic data storage Date: Mon, 16 Dec 2024 15:09:56 +0100 Message-Id: <20241216-vdso-store-rng-v1-0-f7aed1bdb3b2@linutronix.de> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIALU0YGcC/x3MywqEMAyF4VeRrCeQekVfZXAhNmo2rSQiM0jf3 eryg3P+C4xV2GAoLlA+xSSGDPcpYN6msDKKz4aSypp65/D0FtGOqIwaVmypmyo/90wNQT7tyov 83uB3zN7k2f6ffkrpBvZg+p5vAAAA X-Change-ID: 20240911-vdso-store-rng-607a3dc9e050 To: "James E.J. Bottomley" , Helge Deller , Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Anna-Maria Behnsen , Frederic Weisbecker , Andrew Morton , Catalin Marinas , Will Deacon , Theodore Ts'o , "Jason A. Donenfeld" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Huacai Chen , WANG Xuerui , Russell King , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Bogendoerfer , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Arnd Bergmann Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, loongarch@lists.linux.dev, linux-s390@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org, Nam Cao , =?utf-8?q?Thom?= =?utf-8?q?as_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1734358247; l=7632; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=djYBYaWoItcXUsVYqkOg6DhKy9XnOUI8nNrRC+z9rAU=; b=nB6k75T44i3XiBispikp3W7OCCiI+BnnKEjikbsYEp+QxVBLBTagyb2PXd9wSlsp2iNvC4Dr8 7Dg6HPvjJg+AI7LSiIsW01eZlsVkYR2FxwK80tr8AI4F5QdZPyk/VoF X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241216_061054_833247_A75DAC65 X-CRM114-Status: GOOD ( 13.59 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Currently each architecture defines the setup of the vDSO data page on its own, mostly through copy-and-paste from some other architecture. Extend the existing generic vDSO implementation to also provide generic data storage. This removes duplicated code and paves the way for further changes to the generic vDSO implementation without having to go through a lot of per-architecture changes. Based on v6.13-rc1 and intended to be merged through the tip tree. This also provides the basis for some generic vDSO reworks. The commits from this series and the upcoming reworks can be seen at: https://git.kernel.org/pub/scm/linux/kernel/git/thomas.weissschuh/linux.git/log/?h=vdso/store --- Thomas Weißschuh (17): parisc: Remove unused symbol vdso_data vdso: Introduce vdso/align.h vdso: Add generic time data storage vdso: Add generic random data storage vdso: Add generic architecture-specific data storage arm64: vdso: Switch to generic storage implementation riscv: vdso: Switch to generic storage implementation LoongArch: vDSO: Switch to generic storage implementation arm: vdso: Switch to generic storage implementation s390/vdso: Switch to generic storage implementation MIPS: vdso: Switch to generic storage implementation powerpc/vdso: Switch to generic storage implementation x86/vdso: Switch to generic storage implementation x86/vdso/vdso2c: Remove page handling vdso: Remove remnants of architecture-specific random state storage vdso: Remove remnants of architecture-specific time storage vdso: Remove kconfig symbol GENERIC_VDSO_DATA_STORE MAINTAINERS | 1 + arch/Kconfig | 4 + arch/arm/include/asm/vdso.h | 2 + arch/arm/include/asm/vdso/gettimeofday.h | 7 +- arch/arm/include/asm/vdso/vsyscall.h | 12 +- arch/arm/kernel/asm-offsets.c | 4 - arch/arm/kernel/vdso.c | 34 ++---- arch/arm/vdso/vdso.lds.S | 4 +- arch/arm64/include/asm/vdso.h | 2 +- arch/arm64/include/asm/vdso/compat_gettimeofday.h | 32 +++--- arch/arm64/include/asm/vdso/getrandom.h | 12 -- arch/arm64/include/asm/vdso/gettimeofday.h | 16 +-- arch/arm64/include/asm/vdso/vsyscall.h | 25 +---- arch/arm64/kernel/vdso.c | 90 +-------------- arch/arm64/kernel/vdso/vdso.lds.S | 7 +- arch/arm64/kernel/vdso32/vdso.lds.S | 7 +- arch/loongarch/Kconfig | 1 + arch/loongarch/include/asm/vdso.h | 1 - arch/loongarch/include/asm/vdso/arch_data.h | 25 +++++ arch/loongarch/include/asm/vdso/getrandom.h | 5 - arch/loongarch/include/asm/vdso/gettimeofday.h | 14 +-- arch/loongarch/include/asm/vdso/vdso.h | 38 +------ arch/loongarch/include/asm/vdso/vsyscall.h | 17 --- arch/loongarch/kernel/asm-offsets.c | 2 +- arch/loongarch/kernel/vdso.c | 92 +-------------- arch/loongarch/vdso/vdso.lds.S | 8 +- arch/loongarch/vdso/vgetcpu.c | 7 +- arch/mips/include/asm/vdso/gettimeofday.h | 9 +- arch/mips/include/asm/vdso/vdso.h | 19 ++-- arch/mips/include/asm/vdso/vsyscall.h | 14 +-- arch/mips/kernel/vdso.c | 47 +++----- arch/mips/vdso/vdso.lds.S | 5 +- arch/parisc/include/asm/vdso.h | 2 - arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/vdso.h | 1 + arch/powerpc/include/asm/vdso/arch_data.h | 37 ++++++ arch/powerpc/include/asm/vdso/getrandom.h | 11 +- arch/powerpc/include/asm/vdso/gettimeofday.h | 36 +++--- arch/powerpc/include/asm/vdso/vsyscall.h | 13 --- arch/powerpc/include/asm/vdso_datapage.h | 44 +------- arch/powerpc/kernel/asm-offsets.c | 1 - arch/powerpc/kernel/time.c | 2 +- arch/powerpc/kernel/vdso.c | 115 ++----------------- arch/powerpc/kernel/vdso/cacheflush.S | 2 +- arch/powerpc/kernel/vdso/datapage.S | 4 +- arch/powerpc/kernel/vdso/gettimeofday.S | 4 +- arch/powerpc/kernel/vdso/vdso32.lds.S | 4 +- arch/powerpc/kernel/vdso/vdso64.lds.S | 4 +- arch/powerpc/kernel/vdso/vgettimeofday.c | 14 +-- arch/riscv/Kconfig | 2 +- arch/riscv/include/asm/vdso.h | 2 +- .../include/asm/vdso/{time_data.h => arch_data.h} | 8 +- arch/riscv/include/asm/vdso/gettimeofday.h | 14 +-- arch/riscv/include/asm/vdso/vsyscall.h | 9 -- arch/riscv/kernel/sys_hwprobe.c | 3 +- arch/riscv/kernel/vdso.c | 90 +-------------- arch/riscv/kernel/vdso/hwprobe.c | 6 +- arch/riscv/kernel/vdso/vdso.lds.S | 7 +- arch/s390/include/asm/vdso.h | 4 +- arch/s390/include/asm/vdso/getrandom.h | 12 -- arch/s390/include/asm/vdso/gettimeofday.h | 15 +-- arch/s390/include/asm/vdso/vsyscall.h | 20 ---- arch/s390/kernel/time.c | 6 +- arch/s390/kernel/vdso.c | 97 +--------------- arch/s390/kernel/vdso32/vdso32.lds.S | 7 +- arch/s390/kernel/vdso64/vdso64.lds.S | 8 +- arch/x86/entry/vdso/vdso-layout.lds.S | 10 +- arch/x86/entry/vdso/vdso2c.c | 21 ---- arch/x86/entry/vdso/vdso2c.h | 20 ---- arch/x86/entry/vdso/vma.c | 125 ++------------------- arch/x86/include/asm/vdso.h | 6 - arch/x86/include/asm/vdso/getrandom.h | 10 -- arch/x86/include/asm/vdso/gettimeofday.h | 25 +---- arch/x86/include/asm/vdso/vsyscall.h | 22 +--- drivers/char/random.c | 6 +- include/asm-generic/vdso/vsyscall.h | 15 +-- include/linux/align.h | 10 +- include/linux/time_namespace.h | 2 - include/linux/vdso_datastore.h | 10 ++ include/vdso/align.h | 15 +++ include/vdso/datapage.h | 105 ++++++++++++++--- include/vdso/helpers.h | 8 +- kernel/time/namespace.c | 12 +- kernel/time/vsyscall.c | 19 ++-- lib/Makefile | 2 + lib/vdso/getrandom.c | 4 +- lib/vdso/gettimeofday.c | 62 +++++----- lib/vdso_kernel/Makefile | 3 + lib/vdso_kernel/datastore.c | 125 +++++++++++++++++++++ 89 files changed, 574 insertions(+), 1231 deletions(-) --- base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37 change-id: 20240911-vdso-store-rng-607a3dc9e050 Best regards,