From nobody Mon Feb 9 10:48:24 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=1585133759; cv=none; d=zohomail.com; s=zohoarc; b=VABpCtrMUgqc+fKdUJjF4KkTR9yoWjxVSuSOVpoGMzuUzFuJDWjtFSoTkFO6trXK/kryylpSJkhtaUhp5VBvqkvM0gj/gNrF2bjVxdGHKp94kubuhhhZiEwHu5kPdd9s9F47FlVXyJtOeye0BQTBOSU7FNmgovNDBe3tdyjS5O0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585133759; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=svefMYWKrq/TyhOpvxEyGp4cn4OnSFiY8EUTdYD4AlY=; b=FGFdgWTKbj0nGJ3Kddh1dawuxuZNc6zsnZNDjh7PsaMdQ4R1ddcV18eTim4hXjM6LNuBgv8Fl/XUf8BFDPBhKTiDSO8WOmGZeMoJyuPvKNN851tuDIlPh4dZxxSXiXDezUepPEs5hMz6LNm6MFRAL1757Jr8Db6h8UQUKytoamw= 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 1585133759101936.4611496178203; Wed, 25 Mar 2020 03:55:59 -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 1jH3gs-0005Oq-3J; Wed, 25 Mar 2020 10:55:18 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jH3gq-0005Og-HS for xen-devel@lists.xenproject.org; Wed, 25 Mar 2020 10:55:16 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1bca7f90-6e87-11ea-b34e-bc764e2007e4; Wed, 25 Mar 2020 10:55:15 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D5C9BACB8; Wed, 25 Mar 2020 10:55:14 +0000 (UTC) X-Inumbo-ID: 1bca7f90-6e87-11ea-b34e-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 25 Mar 2020 11:55:07 +0100 Message-Id: <20200325105511.20882-2-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200325105511.20882-1-jgross@suse.com> References: <20200325105511.20882-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v7 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