From nobody Thu Dec 18 19:08:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1765892541; cv=none; d=zohomail.com; s=zohoarc; b=R1niXam/9c9WtlvhNYdfYCo22VWYByA4dMuPuWfFVIaIOjRLe/1rtJZ2tbnyughgNK59WJk2uoVbmD+sTmuC6n7JVj6/RuiLkRaaD7TetjoBkwNJHzYJDuD00OqDZloiNMVGqZ4ntFWq976hzv3sx2r2cEMNOykr3ntknNDDITA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1765892541; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AR9YJoS/ZrGpIqMtjrLccD/9zZj/TpZQABpLh6glIqg=; b=EV1LX09it6n4FgFBLtnCqrhCeKXuf2F30osmeSOHKeijzbBYDNZtqHGXNtqZ3Bm2WAw3RmwLX9I4FzCz5C8UC+RQr/cizrfaDVaCmTPJB97Fj7DWEVlcSbrGOxWExSFXO636VuhT3WkaFzsatOnOU/5fTLfV29gytBRXstMVVSo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1765892541320933.2699438830338; Tue, 16 Dec 2025 05:42:21 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1187924.1509229 (Exim 4.92) (envelope-from ) id 1vVVJS-0008EO-HG; Tue, 16 Dec 2025 13:42:02 +0000 Received: by outflank-mailman (output) from mailman id 1187924.1509229; Tue, 16 Dec 2025 13:42:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vVVJS-0008EF-Cs; Tue, 16 Dec 2025 13:42:02 +0000 Received: by outflank-mailman (input) for mailman id 1187924; Tue, 16 Dec 2025 13:42:01 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vVVJR-00080T-3c for xen-devel@lists.xenproject.org; Tue, 16 Dec 2025 13:42:01 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id fea8dddc-da84-11f0-9cce-f158ae23cfc8; Tue, 16 Dec 2025 14:41:59 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (unknown [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 02B875BCD9; Tue, 16 Dec 2025 13:41:59 +0000 (UTC) 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 4FDEA3EA63; Tue, 16 Dec 2025 13:41:58 +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 jRe6EaZhQWmJHwAAD6G6ig (envelope-from ); Tue, 16 Dec 2025 13:41:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fea8dddc-da84-11f0-9cce-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1765892519; 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: in-reply-to:in-reply-to:references:references; bh=AR9YJoS/ZrGpIqMtjrLccD/9zZj/TpZQABpLh6glIqg=; b=DkVkBcd5mBJQwy0RPRVIJHi8UZSzCLnz2M6ZC+CBmmUp2O9YgvKple7Q3Z5ycz/89MNVQv tySgursow+vR91U+STvdo4ph0OZfaipg9r6mNnD5zxK7T9zfi+j6nLzNrgot4OneY02lFm VO9LaqLa5t9rEqzYanEyIbB8A3jUldk= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1765892519; 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: in-reply-to:in-reply-to:references:references; bh=AR9YJoS/ZrGpIqMtjrLccD/9zZj/TpZQABpLh6glIqg=; b=DkVkBcd5mBJQwy0RPRVIJHi8UZSzCLnz2M6ZC+CBmmUp2O9YgvKple7Q3Z5ycz/89MNVQv tySgursow+vR91U+STvdo4ph0OZfaipg9r6mNnD5zxK7T9zfi+j6nLzNrgot4OneY02lFm VO9LaqLa5t9rEqzYanEyIbB8A3jUldk= From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org, virtualization@lists.linux.dev, kvm@vger.kernel.org Cc: Juergen Gross , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Ajay Kaher , Alexey Makhalov , Broadcom internal kernel review list , Paolo Bonzini , Vitaly Kuznetsov , Boris Ostrovsky , xen-devel@lists.xenproject.org Subject: [PATCH v2 1/5] x86/paravirt: Replace io_delay() hook with a bool Date: Tue, 16 Dec 2025 14:41:45 +0100 Message-ID: <20251216134150.2710-2-jgross@suse.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251216134150.2710-1-jgross@suse.com> References: <20251216134150.2710-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.989]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWELVE(0.00)[17]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; R_RATELIMIT(0.00)[to_ip_from(RLfdszjqhz8kzzb9uwpzdm8png)]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:mid,suse.com:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -6.80 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1765892543159154100 Content-Type: text/plain; charset="utf-8" The io_delay() paravirt hook is in no way performance critical and all users setting it to a different function than native_io_delay() are using an empty function as replacement. This enables to replace the hook with a bool indicating whether native_io_delay() should be called. Signed-off-by: Juergen Gross --- arch/x86/include/asm/io.h | 7 +++++-- arch/x86/include/asm/paravirt.h | 11 +---------- arch/x86/include/asm/paravirt_types.h | 3 +-- arch/x86/kernel/cpu/vmware.c | 2 +- arch/x86/kernel/kvm.c | 8 +------- arch/x86/kernel/paravirt.c | 3 +-- arch/x86/xen/enlighten_pv.c | 6 +----- 7 files changed, 11 insertions(+), 29 deletions(-) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index ca309a3227c7..0448575569b9 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -245,9 +245,14 @@ extern void io_delay_init(void); #if defined(CONFIG_PARAVIRT) #include #else +#define call_io_delay() true +#endif =20 static inline void slow_down_io(void) { + if (!call_io_delay()) + return; + native_io_delay(); #ifdef REALLY_SLOW_IO native_io_delay(); @@ -256,8 +261,6 @@ static inline void slow_down_io(void) #endif } =20 -#endif - #define BUILDIO(bwl, type) \ static inline void out##bwl##_p(type value, u16 port) \ { \ diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravir= t.h index b5e59a7ba0d0..0ab798d234cc 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -53,16 +53,7 @@ static inline u64 paravirt_steal_clock(int cpu) void __init paravirt_set_cap(void); #endif =20 -/* The paravirtualized I/O functions */ -static inline void slow_down_io(void) -{ - PVOP_VCALL0(cpu.io_delay); -#ifdef REALLY_SLOW_IO - PVOP_VCALL0(cpu.io_delay); - PVOP_VCALL0(cpu.io_delay); - PVOP_VCALL0(cpu.io_delay); -#endif -} +#define call_io_delay() pv_info.io_delay =20 void native_flush_tlb_local(void); void native_flush_tlb_global(void); diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/p= aravirt_types.h index 3502939415ad..b4c15856eab5 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -36,6 +36,7 @@ struct pv_info { #ifdef CONFIG_PARAVIRT_XXL u16 extra_user_64bit_cs; /* __USER_CS if none */ #endif + bool io_delay; =20 const char *name; }; @@ -51,8 +52,6 @@ struct pv_lazy_ops { =20 struct pv_cpu_ops { /* hooks for various privileged instructions */ - void (*io_delay)(void); - #ifdef CONFIG_PARAVIRT_XXL unsigned long (*get_debugreg)(int regno); void (*set_debugreg)(int regno, unsigned long value); diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c index cb3f900c46fc..47db25d63c8d 100644 --- a/arch/x86/kernel/cpu/vmware.c +++ b/arch/x86/kernel/cpu/vmware.c @@ -338,7 +338,7 @@ arch_initcall(activate_jump_labels); static void __init vmware_paravirt_ops_setup(void) { pv_info.name =3D "VMware hypervisor"; - pv_ops.cpu.io_delay =3D paravirt_nop; + pv_info.io_delay =3D false; =20 if (vmware_tsc_khz =3D=3D 0) return; diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index df78ddee0abb..24e403cdce69 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -74,12 +74,6 @@ DEFINE_PER_CPU_DECRYPTED(struct kvm_steal_time, steal_ti= me) __aligned(64) __visi static int has_steal_clock =3D 0; =20 static int has_guest_poll =3D 0; -/* - * No need for any "IO delay" on KVM - */ -static void kvm_io_delay(void) -{ -} =20 #define KVM_TASK_SLEEP_HASHBITS 8 #define KVM_TASK_SLEEP_HASHSIZE (1<