Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1546394imw; Tue, 5 Jul 2022 11:17:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vr0jY6WnmUPMZBuq9MrPbvkanjGmnTZ2EzHzpvu1cZwCnanECGu0DnMOXv2SC9aKoVDacA X-Received: by 2002:a17:906:7309:b0:722:f9e9:3904 with SMTP id di9-20020a170906730900b00722f9e93904mr35124968ejc.198.1657045044325; Tue, 05 Jul 2022 11:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657045044; cv=none; d=google.com; s=arc-20160816; b=L9nzUq8fgqgPafVkZpTNNIDbRxMdsNNGL//sWb/XG8X2lIedcqGY4ty8eLEVJprvCC W2ipzJlGH4AdpXW8lvrdAkfEsj876JNrF6yPNTbSPL9DlUzIuaUYrube5Dtt78I+K14w KFFsu6/y4GslZC/4IxZcPSfPAakHYtNSO+ORUO88ADt/alipnAc10yy1vNOCaXUuouTK IWFeKmU0uwNBC30pb9VycIXSo21Rb3oBAOmyamfPzFIW2WApicbHuzkIGC6tAKX2czmH yCzbKtCUYUiwH4E57GVAm4Gkiej3xJZaJcJF3s5MjHwVk8+pNWTBl/ddUhEVTFhsw+on EOaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Tzh69ecxxFahzsxZMQDY6oUHv+2OxChrl1uKATDHkpk=; b=tsrZCX2owwTq3D3lFu59cCApAaW470hFqg/7QJaEQLYdgzZs0M8SwvLdFI4HOzmD/9 L6U7IpLk2GNE+pG4TO2679w8szitEgcbon4BVNjiHi7Aw1z+LPE2EZX91IbFlJbg6vom OGf9j8bErg1H6SF7SBi8AI9ruL5JN1aErdxb40fzswa+vBMuDt7QiQ+r7Wc6drTJrxpW GnG0cLCBzyeBC00qvXKt6DTNga/heueSh3Loodct2A9qkuOrpNcWTnHMe3+95n5bUelz Vlw3p2K0cFawKhMs7eZ9lKRQubYy7l7XFrhnQylSyBHkjhfffVH6PTTkneavbcR0CaOh ADgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=ppnyF68X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz43-20020a1709077dab00b0072ac7a2726esi610973ejc.474.2022.07.05.11.16.58; Tue, 05 Jul 2022 11:17:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=ppnyF68X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbiGERen (ORCPT + 99 others); Tue, 5 Jul 2022 13:34:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbiGERel (ORCPT ); Tue, 5 Jul 2022 13:34:41 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA4FD14094 for ; Tue, 5 Jul 2022 10:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Tzh69ecxxFahzsxZMQDY6oUHv+2OxChrl1uKATDHkpk=; b=ppnyF68XTBuMUOH4Lrb+xwHioL 6fqhWIfCoxux+gO1hSgHYEbpMB3yaeGK7qWw8d48v0lrkC0CLx4F8kjFbBv55BxUhSNE8HLy9TNK/ Hyb9kknb0WzYCU4W9s/1ZjkGSX5L2ebrEO+474PAVhht5N/uVGMjpD2emI1nYWn27MNDpa9IHOcsN q8tW5PvAIqP5N8Vn/cnS43X9CiJSZ4LJFcjkCO+cR6WGEfAfqwK95vnj2IJl4pd8NDxv0YMM4Dl2c 8MnCgHSv/wALrvnIcgZEPuTCk+ZS9pvqcJoE8hQPRW3DjEZ+eZyYJwk4tFm7NKrhmMeK7XMupdoqd Q4BQa3AA==; Received: from dhcp-077-249-017-003.chello.nl ([77.249.17.3] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8mRP-0004nJ-HW; Tue, 05 Jul 2022 17:34:27 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id E45D4980059; Tue, 5 Jul 2022 19:34:25 +0200 (CEST) Date: Tue, 5 Jul 2022 19:34:25 +0200 From: Peter Zijlstra To: Nicholas Piggin Cc: Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , linux-kernel@vger.kernel.org Subject: Re: [PATCH 12/13] locking/qspinlock: separate pv_wait_node from the non-paravirt path Message-ID: References: <20220704143820.3071004-1-npiggin@gmail.com> <20220704143820.3071004-13-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220704143820.3071004-13-npiggin@gmail.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 05, 2022 at 12:38:19AM +1000, Nicholas Piggin wrote: > pv_wait_node waits until node->locked is non-zero, no need for the > pv case to wait again by also executing the !pv code path. > > Signed-off-by: Nicholas Piggin > --- > kernel/locking/qspinlock.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c > index 9db168753124..19e2f286be0a 100644 > --- a/kernel/locking/qspinlock.c > +++ b/kernel/locking/qspinlock.c > @@ -862,10 +862,11 @@ static inline void queued_spin_lock_mcs_queue(struct qspinlock *lock, bool parav > /* Link @node into the waitqueue. */ > WRITE_ONCE(prev->next, node); > > + /* Wait for mcs node lock to be released */ > if (paravirt) > pv_wait_node(node, prev); > - /* Wait for mcs node lock to be released */ > - smp_cond_load_acquire(&node->locked, VAL); > + else > + smp_cond_load_acquire(&node->locked, VAL); > (from patch #6): +static void pv_wait_node(struct qnode *node, struct qnode *prev) +{ + int loop; + bool wait_early; + ... + + /* + * By now our node->locked should be 1 and our caller will not actually + * spin-wait for it. We do however rely on our caller to do a + * load-acquire for us. + */ +}