From patchwork Wed Mar 25 10:55:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 11457477 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D29EC1731 for ; Wed, 25 Mar 2020 10:56:20 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BA33D206F6 for ; Wed, 25 Mar 2020 10:56:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA33D206F6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org 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 X-Inumbo-ID: 1bca7f90-6e87-11ea-b34e-bc764e2007e4 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) X-Virus-Scanned: by amavisd-new at test-mx.suse.de 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) 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_Pau_Monn?= =?utf-8?q?=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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 @@ #define smp_wmb() dmb(ishst) +#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 = value; smp_wmb(); } while (0) +#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