Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp677701lqj; Sun, 2 Jun 2024 17:41:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXsrKz7dVyfFUtyk8M688uS/xu9qA3fTLp4x7xthbKT81ve3QDZAsFUbE4Xb/uCIgW6OCsHyQ8dwtIkf1Bz+e5Qr5E3VrvwcOODWgyhbw== X-Google-Smtp-Source: AGHT+IGTUNCdvEMAYNPTZoZRobsUG8qjFvxyTdcJx7y+j+ZdMLp6Q01gJM16flWZNo1PR2l9pIGW X-Received: by 2002:a25:68c7:0:b0:deb:9839:797f with SMTP id 3f1490d57ef6-dfa7f89f41bmr6408009276.25.1717375313900; Sun, 02 Jun 2024 17:41:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717375313; cv=pass; d=google.com; s=arc-20160816; b=QIusbBClIbMn5VXKvsnJyhLImRGi6fFqxZZ/4Dd1m71nfuq11OZ/51dvi6SmD8Fze2 L2rfll3qk3tAwGmgmiF7vNcQ9l2AoUlp1vJuhPHrPRWJMf+WN0kqtcwCadLnAVFXZH5V Y1c81hwlSnBlau67s4hHLrC9yDB52+MrhukI84ue4dBCGCSZvVpSxAuNPGg97ItKMQYf 9Fopafxgj8p0n3TeXEJ1c+sNmn/GwNsKBetxqYlApTd3d82RGxZMrc+Ot948rmWCQMGY BNxEm3pmpQnAdTEBGXuX0dXquYkSpNeqJdBmSPEf2a04+hLBzwuIR9NI1UTDf2sh/+3j S86Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=B1o/b1gFrtS3NBgE2MlOGvvhrWq5km+KT0/u0XHiWDI=; fh=VyOWNrZrBv4mmWtZ99vCQx78nkXZ4mcqnGJxQqXT4WM=; b=c7XhTTUvNaionpdYCidPQ8elIoDl9rEwwdmJOrCo9K63fdXQNbCMfSyZwep1gBcGew VXobwY//HemLWW8N+LSu6z3BBYAKvVktr5WZtEv7STJm50ewGqrh1AewE6dGHqv4pEpL XznlpCMEkvO/fXzpka/+zXWDZTRfS+Kf6jfXrOU44l363MFZLIchMTrRGk1t2vCmEXzO C3nx4Y6gUQD/1ex2odnpXXx0lMXXxFE6QOFl1joDPNRFe9oUUEqDLwsmeKLC3GtpmrRR M/FuZ/G5QgKzzTkTFGPCKo7zYT4ugIZ6JpIzKfaQ0BcNE9WCEqAecTVtisJfSYj0+c5d aKyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CNylfbfV; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-198508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198508-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4a737967si74733416d6.66.2024.06.02.17.41.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 17:41:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CNylfbfV; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-198508-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198508-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 920FB1C2037F for ; Mon, 3 Jun 2024 00:41:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8548C17C9; Mon, 3 Jun 2024 00:41:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CNylfbfV" Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A632EBB; Mon, 3 Jun 2024 00:41:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717375305; cv=none; b=Gz0FN5BIBnEJTyk8sS7ooeiDdmhlfA69osE3AWOg6igAdFFFwLDV534Sjp88AgXZRaMkW+cNmAcZIxejk8+uaUcswGS2g4aH2edUHhBw9wyjBpz3iEfccjn9PJfB8g0N6VXI7f4x040JG2sb0QidcmhgXNkUBnGC6k1BY1m3Eu0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717375305; c=relaxed/simple; bh=zNI6H31zSexVbT2WSd9vhwqSF1Rqr5qSWm/aHU5mw9M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bePVatLnkhH9uEkFiNmAxxHdVLzUJY3+bCW9v7snNLIC7OKhNqWHQom6h1a+2sVAihMg8yBqveOEZKJBbzygSkOqPVsC4BTOWeNwFHgRXOBaNrPqRXDzmxxBUjia4O4I8alnkfKL10cqa0wHVNpUkm4WpbMc6re0KCIJaO3F7tc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CNylfbfV; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-42139c66027so5409465e9.3; Sun, 02 Jun 2024 17:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717375302; x=1717980102; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=B1o/b1gFrtS3NBgE2MlOGvvhrWq5km+KT0/u0XHiWDI=; b=CNylfbfVVuMlK2m0uiqdmFUc/d9eTkfhQA4WXMxBbdiSg+vJUc20I6Cyxfane4vPTN X3zXYA3BTROqoODPnoPMatf7N8OUIFrnUHkz0p4WssZl8wcbM/MVUEXzIqzTNF0wxwza y5LxKPc8T+/U59MZa9NAhrlccbtQz6+acarQ4wH51a6r4KU6ZIX4DH22EQMfxR2HtuPG 1UjywgDGkZF4h/vyRpzEvVbi6SBLH8SUzkBSx87gKqixW/QMMKCI9GLlm11H8oF4AN+3 rG/YSwWXZ2rqcxIEv3OvgCQEYbicWXHMlRGzdWEtVy5UqpIGhLwJjCOTn3ttGO9UEuoO ei4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717375302; x=1717980102; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=B1o/b1gFrtS3NBgE2MlOGvvhrWq5km+KT0/u0XHiWDI=; b=cVsWXMO3auy56lqdb2BdGjYCi/Y38IxI/7iFJ7JqPGBU+zXOwcJLXkbfmbNpOGjk8I RY9Lkpiwkxj4ObBM7qxDI2SA5uOJ16a9RQjekt2gBy1xbI+rV+IaRCB0P0eOYLw/nA1f M4CCPl50cM+tp/GAA6aamEEHzcE8+auMmEN0mw2e29QuN+KfcLnKdyltfFiqstwVzbUk HKvQDhx4kWgB+SFhMyZCbC37GbSpNi9ew6GBSWmv7N7rXHSz+ZTL2Ea9cjSg6Arx8uWD KQ4wVI6BfkE8FI2/DEZe2geXxvrnQkGFusXC7eRvhEwXuhtmb3WFecYFgqNuqx+o7rSb khFw== X-Forwarded-Encrypted: i=1; AJvYcCVyxYFz0z5ZaIljBBTCwWxhthkhymGcLBrODCFZpNp4lKZ+TiFxyJ+B30V2RzZM9YNUtP+c2HQv69GuE0HsU+b7kvocvFCf+I8N4QDRB/EYY/1PRlTtK4naMz/wu+iilos70qUEKKeDE5sYtdNWZNBz+cpE5ekF8eaGJN9gEV6AsqGfOQ== X-Gm-Message-State: AOJu0Ywoo8SYURqKcW1NqqCWXRKGQ1PvaLk/JSfwt7cogzo30z4Tu5LO 6GPmEXgb7HuzTUlVamcUIh2Y99Y+ZUPyIaBTltLslxpOhthltsX7 X-Received: by 2002:a05:600c:8a7:b0:41b:e4dd:e320 with SMTP id 5b1f17b1804b1-4212e09b9camr55984695e9.26.1717375302255; Sun, 02 Jun 2024 17:41:42 -0700 (PDT) Received: from andrea ([151.76.32.59]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57a6522d405sm470024a12.1.2024.06.02.17.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 17:41:41 -0700 (PDT) Date: Mon, 3 Jun 2024 02:41:36 +0200 From: Andrea Parri To: Guo Ren Cc: Alexandre Ghiti , Alexandre Ghiti , Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Arnd Bergmann , Leonardo Bras , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org Subject: Re: [PATCH 7/7] riscv: Add qspinlock support based on Zabha extension Message-ID: References: <20240528151052.313031-1-alexghiti@rivosinc.com> <20240528151052.313031-8-alexghiti@rivosinc.com> <39a9b28c-2792-45ce-a8c6-1703cab0f2de@ghiti.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: > I looked at the riscv-unprivileged ppo section, seems RISC-V .rl -> > .aq has RCsc annotations. > ref: > Explicit Synchronization > 5. has an acquire annotation > 6. has a release annotation > 7. a and b both have RCsc annotations > > And for qspinlock: > unlock: > smp_store_release(&lock->locked, 0); > > lock: > if (likely(atomic_try_cmpxchg_acquire(&lock->val, &val, _Q_LOCKED_VAL))) > > If the hardware has Store-Release and CAS instructions, they all obey > Explicit Synchronization rules. Then RISC-V "UNLOCK+LOCK" pairs act as > a full barrier, right? Presuming you were thinking at CAS.aq (based on your previous remarks above), that all seems right to me. In fact, the (putative) Store.rl and an LR.aq would also do it (by the same/mentioned rules). Andrea