Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5435531rwr; Tue, 9 May 2023 01:07:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6WQFil9nxQYyLf5GRVuqxFuWQf4vJoyoqXckiLz6d9l2bblNx/j08rY08u30eS9LYgKRae X-Received: by 2002:a17:902:c202:b0:1ab:2758:c893 with SMTP id 2-20020a170902c20200b001ab2758c893mr13626736pll.47.1683619674784; Tue, 09 May 2023 01:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683619674; cv=none; d=google.com; s=arc-20160816; b=xBsPnjhJIjePHh4iKOAG6jLijRcE7m56vnTyC1zOY12iwmGAiQ/NoGPQLbw0gEsg+j FdkrWXEj8WQFal3VZu8btGWpejIhNhmQ37mpJEQfrtQPOeraMrWTzdWhs8VgJ3v61vGu iChe0VNzoKTH0qsdI8ZI2kMQNbaqhuQOdByltR5rSD/WxNUgsGLlFXV3fCuDBgItUTYw WO/iEsbXBAZ6GzkBNymiBA1c+GnOl74CpOhTggvX2nebO83w5xnRYPoH/25ScVCe118W UwCpemzwluFz7QncUgrF0dlS5DG3WkkPViwbVOzsUGAEjl7heVHTp80vh/MBQm3Aydbq fEOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=+yz0oIqeg8LRuhEHe9sbgg1CuYYh2O72eMwJWWXNmA0=; b=EOgmkcuRjvcWMpqGcGCxN0BgJP3oVuvIp/CJfOs2blcwLQch8hWwrXX39kdvpJ68KW 018cNmF0H13zuUf416BHT12ea/0TEfntDUVGw1wfQgl+kmJ+zvVcJjf8NbVw44XP/b9A 4SFKOrka8drVIYpfINa/hbjqlMLZ9W3pUQCgV9GhXTa+Q34+0DnOTW+IHw778IDlJbug iuH9/vWAxKqKRIzP4g13BlAR+nl7HZ66kAiZglwLfMykrS+3PnwPPlQg5gDQydfskBKQ VAkz+PFmduRSA3HkQjD1pHv6BIxB+218xAMAnlGtDpVZSKgtgZhNbpa3DyDHklZYmXdJ MpBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RDIv5oe9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h2-20020a170902748200b001aafaf1a917si913253pll.472.2023.05.09.01.07.40; Tue, 09 May 2023 01:07:54 -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=@intel.com header.s=Intel header.b=RDIv5oe9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233301AbjEIH3j (ORCPT + 99 others); Tue, 9 May 2023 03:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232223AbjEIH3g (ORCPT ); Tue, 9 May 2023 03:29:36 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 889B1210D for ; Tue, 9 May 2023 00:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683617375; x=1715153375; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=n3xp3Oxep/6XUd0YYFwl+lzYWyDoeEYTha+L0N5Dz7U=; b=RDIv5oe9Eg3/QICIbXiZY5ruLcbJTgvPv8KocUecJBOa4FtwFrPQm1cs RnwHEm6iDQosrJn45Z5+3z3v6Pg0umcF0bHPHMi4NkoAIwgsvemnCyFi7 VLNH0q60EyDxQ4XlKrTyfFvl1g10K/UCcG2kjvEgGEtTw1nl+nttWQqd0 3noLbymqgSBTDT7P480hy9+ruRG/e90Q7jh1eCcY8nF+Sdzmw32J65fKm iglEcKReEl3o5nQcovcj2YEi/i5Wy/HkcHMa6lgaPdG+15Fmt8GLQHFmu +DRtQDsE4TvIIrL94UqFyRA+9hyRyybef7DCqwiHlC5jJ5SJKh7Jyb5XC g==; X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="377926191" X-IronPort-AV: E=Sophos;i="5.99,261,1677571200"; d="scan'208";a="377926191" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2023 00:29:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="822963526" X-IronPort-AV: E=Sophos;i="5.99,261,1677571200"; d="scan'208";a="822963526" Received: from qiuxu-clx.sh.intel.com ([10.239.53.109]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2023 00:29:31 -0700 From: Qiuxu Zhuo To: Peter Zijlstra , Waiman Long , Ingo Molnar , Will Deacon Cc: Qiuxu Zhuo , Boqun Feng , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/1] locking/qspinlock: Fix state-transition changes in comments Date: Tue, 9 May 2023 15:29:02 +0800 Message-Id: <20230509072902.66284-1-qiuxu.zhuo@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 1. set_locked() only sets the locked field to 1 and doesn't touch the pending field. So the correct lock state transition is: *,*,0 -> *,*,1 2. The initial lock state when calling clear_pending_set_locked() is the state just after waiting for the locker goes away. So the state transition for clear_pending_set_locked() is: *,1,0 -> *,0,1 Signed-off-by: Qiuxu Zhuo --- v1->v2: - Drop the state transition comments fixes (viewed from the current lock word value). - Update the commit message accordingly. kernel/locking/qspinlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c index ebe6b8ec7cb3..256021c87ac1 100644 --- a/kernel/locking/qspinlock.c +++ b/kernel/locking/qspinlock.c @@ -257,7 +257,7 @@ static __always_inline u32 queued_fetch_set_pending_acquire(struct qspinlock *lo * set_locked - Set the lock bit and own the lock * @lock: Pointer to queued spinlock structure * - * *,*,0 -> *,0,1 + * *,*,0 -> *,*,1 */ static __always_inline void set_locked(struct qspinlock *lock) { @@ -385,7 +385,7 @@ void __lockfunc queued_spin_lock_slowpath(struct qspinlock *lock, u32 val) /* * take ownership and clear the pending bit. * - * 0,1,0 -> 0,0,1 + * *,1,0 -> *,0,1 */ clear_pending_set_locked(lock); lockevent_inc(lock_pending); -- 2.17.1