From nobody Tue Nov 11 09:01:50 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1565074923; cv=none; d=zoho.com; s=zohoarc; b=fB57/Ku6EVgWXzKuLQIYP3Nhc9711EzO2/vno7M7+WQ1QC6pHbAuYtXrtxlHUPyxZD/NJabQYVgtJVs0cF1ZYV1TPBi8Fdp0t6RO5fhbGBvvpXiF9IGO7yfce2qd6haxDI+77+16eU5dYHImHbtTIQvp+oAx1TUuq76nGcpv0ho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565074923; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=+lbfaHQ0ZSePQHB3BSuiw/8qfA01XwlvHy7DAPpQipw=; b=INBWYGlCv429ADEzfSFONA7zTAsR+BQJGGzwEmw+Zx1XAghcwJkE8OOTIT3NUlzMDQ6DeX4pXHNuk5O6mgOFzHiC6v+538yJfg3AzxRCYws071g6V1Ps30x60rxe9CDVYt6LBEwq8ZTWpnty44ssre0aL1Q2fMYJSka9qFDJ/LY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) 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 1565074923480650.656631298417; Tue, 6 Aug 2019 00:02:03 -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 1hutS4-0002kl-Ef; Tue, 06 Aug 2019 07:00:08 +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 1hutS3-0002kg-KN for xen-devel@lists.xenproject.org; Tue, 06 Aug 2019 07:00:07 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d0546c04-b817-11e9-8224-0336220bd45e; Tue, 06 Aug 2019 07:00:03 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8FA7AAD7F; Tue, 6 Aug 2019 07:00:02 +0000 (UTC) X-Inumbo-ID: d0546c04-b817-11e9-8224-0336220bd45e X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Tue, 6 Aug 2019 09:00:00 +0200 Message-Id: <20190806070000.13718-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH] xen/x86: lock cacheline for add_sized() 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 , Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" add_sized() should use an atomic update of the memory word, as it is used by spin_unlock(). With ticket locks unlocking needs to be atomic in order to avoid very rare races when someone tries to get the lock while the lock holder is just releasing it. Signed-off-by: Juergen Gross --- xen/include/asm-x86/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/asm-x86/atomic.h b/xen/include/asm-x86/atomic.h index 682bcf91b1..0ef6a60e69 100644 --- a/xen/include/asm-x86/atomic.h +++ b/xen/include/asm-x86/atomic.h @@ -21,7 +21,7 @@ static inline void name(volatile type *addr, type val) \ #define build_add_sized(name, size, type, reg) \ static inline void name(volatile type *addr, type val) \ { \ - asm volatile("add" size " %1,%0" \ + asm volatile("lock; add" size " %1,%0" \ : "=3Dm" (*addr) \ : reg (val)); \ } --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel