From nobody Sat Apr 20 06:06:58 2024 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=1565163209; cv=none; d=zoho.com; s=zohoarc; b=h0vknkoWvj+wHDUN4x7aF1wfGm0mQKyrIFnAB0ttcVPlRtfw6XGuzgpziLGJJ/imU2SsGhqtNZVq9oBfN7XhLafB4rMXSnUhK9/D8MX9upOvG7Ya53uCL6C8prBotaiXzdl8WCv9kaXf9HRvz6pJYFBxHbz/aBc+amZULnuKD6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565163209; 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=Q5NrmgvaW/pY4Ilk55YYWNJkRORON5GN20fOoXg0Qv4=; b=EA8N1LPJ9ezX+x78+f37B8rQjWLM/mMjxlkJF6lp39l1ewe9CWd+sSvEzYZsViE2MyVysHrxp+Gs6HuyjU6AdqhaCdBD9EMOIXTfgoNLLG5JQq5h78knAZxqRupen3wnk2SosF+m3oCmDwl+y7dnhSLggZ0aPtZRSO+b+tbDjQo= 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 1565163209247680.5459324519536; Wed, 7 Aug 2019 00:33:29 -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 1hvGQo-0004Gk-BV; Wed, 07 Aug 2019 07:32:22 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvGQn-0004Gf-QC for xen-devel@lists.xenproject.org; Wed, 07 Aug 2019 07:32:21 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 7cd3709f-b8e5-11e9-8980-bc764e045a96; Wed, 07 Aug 2019 07:32:19 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BF2AFAF97; Wed, 7 Aug 2019 07:32:18 +0000 (UTC) X-Inumbo-ID: 7cd3709f-b8e5-11e9-8980-bc764e045a96 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 7 Aug 2019 09:32:16 +0200 Message-Id: <20190807073216.3239-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH v2] 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(). Ticket locks are using a read-modify-write operation on parts of the lockword for unlocking, while trying to lock is done by an atomic update of the complete lockword. This requires the unlock operation to be atomic, too, as otherwise the unlock might not write back the correct data. 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..897f661191 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