From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 85284CFD2F6 for ; Thu, 27 Nov 2025 07:09:02 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4dH6wr4DJqz2yvQ; Thu, 27 Nov 2025 18:09:00 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1764227340; cv=none; b=e8xZNQAFD+qzSoIWUcDi1m+4VvtJtMLi0vr5xgVfeTM/g9+WP2d6inkqmAc7cWM4lqX0F0YixDPyhI5pT2HjKH6v/g3W4eeGFkx3A684QnOpg3Tp8dtKST1c216zUgkebAywsNw1sFMTWB+DGSsI8lP+SoeYZQhuSnFZ8dBuzW6JSR0G1vjSTgppcu1Vy+WcKwsG0jkdy+IKc3SN6av3Rye323b9X4qjlBT1tTxHCdWnHWK209eAYVojHHgsw9rJgdQ115tgCS5forO/yp/noAPtjxHF0V8Ud8MiUG/AW5TRo/ZXA5TElceMPOJ+YK2hbcL9DJ5h4sfRD7iDXshG8g== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1764227340; c=relaxed/relaxed; bh=GkYN9sQBp6dFq1RSSSZnuQ9AZ+VFB0EPlCzVmqFi3YU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=URXBZjj8ZOgjWa/+WvKoGOulMhI4+9OQFehHloy93IXXf9AKheUkitDEETGNr8UEMWizmwsOblWnk1xhuC8w+XovIhTN+PyYnIjKu1s2z60YE2CZxo+cZ4ZkkucxWy30z1yhK3SPW0wT+tYXwXZoz+heOGaxB34wD4XHphTqmo5qoJp5AI8TgNsZHtu0K8aiWc+3oJZBSg0PkDF8yd60owXOKQ2N+IKk4ez4GFe2iigdFYtqgDGz9jECbfrKD01AyMNexh1lJB3AmEZjNJagPWFKsP04OO5tqw12Bx4sZGF3ETnXGkKz0GyYUH/ewkPMvDbRc2yHluH9Mh2iybNsDQ== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; dkim=pass (1024-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=NRFjlEQE; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=uKKXG1H+; dkim-atps=neutral; spf=pass (client-ip=195.135.223.131; helo=smtp-out2.suse.de; envelope-from=jgross@suse.com; receiver=lists.ozlabs.org) smtp.mailfrom=suse.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=NRFjlEQE; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=susede1 header.b=uKKXG1H+; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=suse.com (client-ip=195.135.223.131; helo=smtp-out2.suse.de; envelope-from=jgross@suse.com; receiver=lists.ozlabs.org) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4dH6wp5qKKz2yrX for ; Thu, 27 Nov 2025 18:08:57 +1100 (AEDT) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 508465BCC4; Thu, 27 Nov 2025 07:08:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1764227329; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GkYN9sQBp6dFq1RSSSZnuQ9AZ+VFB0EPlCzVmqFi3YU=; b=NRFjlEQEFRUF7MB0YXXuWH+hccvSptPQkIWcQIN42Eujd+3DypnWRVBsEJOEQpawsBHhRT DZCAXZ/+rWHpMsRmIsSSJO7Q0/+CGg09JHud8frJouhM+o9x2Jc+uC8CI7ytj0uFvKEN6J 1q+u7R80ryYQ3g0sjK8vydN/B0Qf08k= Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=uKKXG1H+ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1764227328; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GkYN9sQBp6dFq1RSSSZnuQ9AZ+VFB0EPlCzVmqFi3YU=; b=uKKXG1H+6MZGr/tZefnbzOsYOgrhg2akWRcpCnauAJm2xDHwX7cweR+dsw1lfTmF6IjuH5 vzBWHYIhEpeDfzWOo6Kp6y/QHgKEtErU0VGcSns5/+PZDcnsbDi9V133ATlarmPHbh0An/ TbbVvbnfugeXzU5GIet2NqMAuAkNa1o= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CCCEF3EA63; Thu, 27 Nov 2025 07:08:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +HFzMP74J2lYXAAAD6G6ig (envelope-from ); Thu, 27 Nov 2025 07:08:46 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, kvm@vger.kernel.org Cc: Juergen Gross , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Peter Zijlstra , Will Deacon , Boqun Feng , Waiman Long , Jiri Kosina , Josh Poimboeuf , Pawan Gupta , Boris Ostrovsky , xen-devel@lists.xenproject.org, Ajay Kaher , Alexey Makhalov , Broadcom internal kernel review list , Russell King , Catalin Marinas , Huacai Chen , WANG Xuerui , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , linux-arm-kernel@lists.infradead.org, Paolo Bonzini , Vitaly Kuznetsov , Stefano Stabellini , Oleksandr Tyshchenko , Daniel Lezcano , Oleg Nesterov Subject: [PATCH v4 00/21] paravirt: cleanup and reorg Date: Thu, 27 Nov 2025 08:08:23 +0100 Message-ID: <20251127070844.21919-1-jgross@suse.com> X-Mailer: git-send-email 2.51.0 X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-1.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; FREEMAIL_CC(0.00)[suse.com,kernel.org,linutronix.de,redhat.com,alien8.de,linux.intel.com,zytor.com,microsoft.com,infradead.org,gmail.com,oracle.com,lists.xenproject.org,broadcom.com,armlinux.org.uk,arm.com,xen0n.name,linux.ibm.com,ellerman.id.au,csgroup.eu,dabbelt.com,eecs.berkeley.edu,ghiti.fr,linaro.org,goodmis.org,google.com,suse.de,lists.infradead.org,epam.com]; DKIM_TRACE(0.00)[suse.com:+]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TAGGED_RCPT(0.00)[]; RCPT_COUNT_GT_50(0.00)[57]; R_RATELIMIT(0.00)[to_ip_from(RLkdkdrsxe9hqhhs5ask8616i6)]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 508465BCC4 X-Rspamd-Action: no action Some cleanups and reorg of paravirt code and headers: - The first 2 patches should be not controversial at all, as they remove just some no longer needed #include and struct forward declarations. - The 3rd patch is removing CONFIG_PARAVIRT_DEBUG, which IMO has no real value, as it just changes a crash to a BUG() (the stack trace will basically be the same). As the maintainer of the main paravirt user (Xen) I have never seen this crash/BUG() to happen. - The 4th patch is just a movement of code. - I don't know for what reason asm/paravirt_api_clock.h was added, as all archs supporting it do it exactly in the same way. Patch 5 is removing it. - Patches 6-14 are streamlining the paravirt clock interfaces by using a common implementation across architectures where possible and by moving the related code into common sched code, as this is where it should live. - Patches 15-20 are more like RFC material preparing the paravirt infrastructure to support multiple pv_ops function arrays. As a prerequisite for that it makes life in objtool much easier with dropping the Xen static initializers of the pv_ops sub- structures, which is done in patches 15-17. Patches 18-20 are doing the real preparations for multiple pv_ops arrays and using those arrays in multiple headers. - Patch 21 is an example how the new scheme can look like using the PV-spinlocks. Changes in V2: - new patches 13-18 and 20 - complete rework of patch 21 Changes in V3: - fixed 2 issues detected by kernel test robot Changes in V4: - fixed one build issue Juergen Gross (21): x86/paravirt: Remove not needed includes of paravirt.h x86/paravirt: Remove some unneeded struct declarations x86/paravirt: Remove PARAVIRT_DEBUG config option x86/paravirt: Move thunk macros to paravirt_types.h paravirt: Remove asm/paravirt_api_clock.h sched: Move clock related paravirt code to kernel/sched arm/paravirt: Use common code for paravirt_steal_clock() arm64/paravirt: Use common code for paravirt_steal_clock() loongarch/paravirt: Use common code for paravirt_steal_clock() riscv/paravirt: Use common code for paravirt_steal_clock() x86/paravirt: Use common code for paravirt_steal_clock() x86/paravirt: Move paravirt_sched_clock() related code into tsc.c x86/paravirt: Introduce new paravirt-base.h header x86/paravirt: Move pv_native_*() prototypes to paravirt.c x86/xen: Drop xen_irq_ops x86/xen: Drop xen_cpu_ops x86/xen: Drop xen_mmu_ops objtool: Allow multiple pv_ops arrays x86/paravirt: Allow pv-calls outside paravirt.h x86/paravirt: Specify pv_ops array in paravirt macros x86/pvlocks: Move paravirt spinlock functions into own header arch/Kconfig | 3 + arch/arm/Kconfig | 1 + arch/arm/include/asm/paravirt.h | 22 -- arch/arm/include/asm/paravirt_api_clock.h | 1 - arch/arm/kernel/Makefile | 1 - arch/arm/kernel/paravirt.c | 23 -- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/paravirt.h | 14 - arch/arm64/include/asm/paravirt_api_clock.h | 1 - arch/arm64/kernel/paravirt.c | 11 +- arch/loongarch/Kconfig | 1 + arch/loongarch/include/asm/paravirt.h | 13 - .../include/asm/paravirt_api_clock.h | 1 - arch/loongarch/kernel/paravirt.c | 10 +- arch/powerpc/include/asm/paravirt.h | 3 - arch/powerpc/include/asm/paravirt_api_clock.h | 2 - arch/powerpc/platforms/pseries/setup.c | 4 +- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/paravirt.h | 14 - arch/riscv/include/asm/paravirt_api_clock.h | 1 - arch/riscv/kernel/paravirt.c | 11 +- arch/x86/Kconfig | 8 +- arch/x86/entry/entry_64.S | 1 - arch/x86/entry/vsyscall/vsyscall_64.c | 1 - arch/x86/hyperv/hv_spinlock.c | 11 +- arch/x86/include/asm/apic.h | 4 - arch/x86/include/asm/highmem.h | 1 - arch/x86/include/asm/mshyperv.h | 1 - arch/x86/include/asm/paravirt-base.h | 29 ++ arch/x86/include/asm/paravirt-spinlock.h | 146 ++++++++ arch/x86/include/asm/paravirt.h | 331 +++++------------- arch/x86/include/asm/paravirt_api_clock.h | 1 - arch/x86/include/asm/paravirt_types.h | 269 +++++++------- arch/x86/include/asm/pgtable_32.h | 1 - arch/x86/include/asm/ptrace.h | 2 +- arch/x86/include/asm/qspinlock.h | 89 +---- arch/x86/include/asm/spinlock.h | 1 - arch/x86/include/asm/timer.h | 1 + arch/x86/include/asm/tlbflush.h | 4 - arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/apm_32.c | 1 - arch/x86/kernel/callthunks.c | 1 - arch/x86/kernel/cpu/bugs.c | 1 - arch/x86/kernel/cpu/vmware.c | 1 + arch/x86/kernel/kvm.c | 13 +- arch/x86/kernel/kvmclock.c | 1 + arch/x86/kernel/paravirt-spinlocks.c | 26 +- arch/x86/kernel/paravirt.c | 42 +-- arch/x86/kernel/tsc.c | 10 +- arch/x86/kernel/vsmp_64.c | 1 - arch/x86/lib/cache-smp.c | 1 - arch/x86/mm/init.c | 1 - arch/x86/xen/enlighten_pv.c | 82 ++--- arch/x86/xen/irq.c | 20 +- arch/x86/xen/mmu_pv.c | 100 ++---- arch/x86/xen/spinlock.c | 11 +- arch/x86/xen/time.c | 2 + drivers/clocksource/hyperv_timer.c | 2 + drivers/xen/time.c | 2 +- include/linux/sched/cputime.h | 18 + kernel/sched/core.c | 5 + kernel/sched/cputime.c | 13 + kernel/sched/sched.h | 3 +- tools/objtool/arch/x86/decode.c | 8 +- tools/objtool/check.c | 78 ++++- tools/objtool/include/objtool/check.h | 2 + 66 files changed, 661 insertions(+), 826 deletions(-) delete mode 100644 arch/arm/include/asm/paravirt.h delete mode 100644 arch/arm/include/asm/paravirt_api_clock.h delete mode 100644 arch/arm/kernel/paravirt.c delete mode 100644 arch/arm64/include/asm/paravirt_api_clock.h delete mode 100644 arch/loongarch/include/asm/paravirt_api_clock.h delete mode 100644 arch/powerpc/include/asm/paravirt_api_clock.h delete mode 100644 arch/riscv/include/asm/paravirt_api_clock.h create mode 100644 arch/x86/include/asm/paravirt-base.h create mode 100644 arch/x86/include/asm/paravirt-spinlock.h delete mode 100644 arch/x86/include/asm/paravirt_api_clock.h -- 2.51.0