From nobody Mon Feb 9 11:32:57 2026 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1585214393; cv=none; d=zohomail.com; s=zohoarc; b=fWwxCO7bvV+a3s0J+QeCzZAGKX2llHRNJIcz0QmCgl0f6NKFQiWLGM0NmZC1h24wHlGfKpkQkaSu6778ku4wRL9HwXbT9Vz1/L5LD69yEJTdZ5G7cV8/QrSaYJm5uxD1wjkIlQqUB5RlGA4OHf2hZ+Ut0kyQ9A6mU1Jhe6yQC7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585214393; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=cImG+MJX1poX1IOQ3RA6qWDZZUhB6ezjn88j6IL0VQ0=; b=PTEZTBx62I9xcMAvhsIOqqXgvqt8Y2Wodk+Q0nI/9LJoRwbkBVOajjy51qYfWnMIZO74Kyn06dcvF3eVBTWAKqDzGO1sEsJUfE1TxSscm5udk0ZyAsIGamAMF3znVyZgguIg+lH/tGaOghW4B0tVd5qZCW7HAI3nOP2U34ArdhM= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1585214393732158.58149168266175; Thu, 26 Mar 2020 02:19:53 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jHOfe-0005Yj-Gw; Thu, 26 Mar 2020 09:19:26 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jHOfd-0005YX-2K for xen-devel@lists.xenproject.org; Thu, 26 Mar 2020 09:19:25 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e0657558-6f42-11ea-877f-12813bfff9fa; Thu, 26 Mar 2020 09:19:23 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7E832AF26; Thu, 26 Mar 2020 09:19:22 +0000 (UTC) X-Inumbo-ID: e0657558-6f42-11ea-877f-12813bfff9fa X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Thu, 26 Mar 2020 10:19:14 +0100 Message-Id: <20200326091918.12388-2-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200326091918.12388-1-jgross@suse.com> References: <20200326091918.12388-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v8 1/5] xen: introduce smp_mb__[after|before]_atomic() barriers X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Jan Beulich , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When using atomic variables for synchronization barriers are needed to ensure proper data serialization. Introduce smp_mb__before_atomic() and smp_mb__after_atomic() as in the Linux kernel for that purpose. Use the same definitions as in the Linux kernel. Suggested-by: Jan Beulich Signed-off-by: Juergen Gross Acked-by: Jan Beulich Acked-by: Julien Grall --- V7: - new patch --- xen/include/asm-arm/system.h | 3 +++ xen/include/asm-x86/system.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/xen/include/asm-arm/system.h b/xen/include/asm-arm/system.h index e5d062667d..65d5c8e423 100644 --- a/xen/include/asm-arm/system.h +++ b/xen/include/asm-arm/system.h @@ -30,6 +30,9 @@ =20 #define smp_wmb() dmb(ishst) =20 +#define smp_mb__before_atomic() smp_mb() +#define smp_mb__after_atomic() smp_mb() + /* * This is used to ensure the compiler did actually allocate the register = we * asked it for some inline assembly sequences. Apparently we can't trust diff --git a/xen/include/asm-x86/system.h b/xen/include/asm-x86/system.h index 069f422f0d..7e5891f3df 100644 --- a/xen/include/asm-x86/system.h +++ b/xen/include/asm-x86/system.h @@ -233,6 +233,9 @@ static always_inline unsigned long __xadd( #define set_mb(var, value) do { xchg(&var, value); } while (0) #define set_wmb(var, value) do { var =3D value; smp_wmb(); } while (0) =20 +#define smp_mb__before_atomic() do { } while (0) +#define smp_mb__after_atomic() do { } while (0) + /** * array_index_mask_nospec() - generate a mask that is ~0UL when the * bounds check succeeds and 0 otherwise --=20 2.16.4