Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2902132rwb; Thu, 17 Nov 2022 18:36:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf4YJoHQXbayYrgx3JHolnpwDanctxTV3GeBbQ/AkcjatldTgFjhraPvGOCvV7M2lB9uNcJQ X-Received: by 2002:a17:906:6d7:b0:781:951:2fb with SMTP id v23-20020a17090606d700b00781095102fbmr4292995ejb.64.1668739016553; Thu, 17 Nov 2022 18:36:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668739016; cv=none; d=google.com; s=arc-20160816; b=iASoDsJ6KgM/0XwEjgDCBWEXF82ytsjgjL81MgdnCpl8UIJkc6fvoyRbbuFpQqGyxb axTo3rqpZlUMaHir3J2JTjAX8ZIsylsx3bhOP0r72tujOzMbE9Aq2/5HxnG/W2RNOjuy wfri/6xEBf+BLU1QgoEH7CajCkNdf1bZlx2jKHp/VQ0SMszsviB1lzw3F3tYjWX0mdoV 3tjBDGkyp8PRLtV0V8xj0Vz+z0ojNTP8XP6yYZVoWwk4FiXCDlTgjcthroC2+FyLh5Ap YQlmNwGsvXJUyqnBIlKlDe4WRWIn0P3VyS5WgwD1U1/jlklXLptyWIfw6O3FVgXFFyf6 /hJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ZQW7EJ9eJ3AI4uQYGbmB9y5OJ7c4Huh2ZC5cQT+rt4E=; b=yH5+cgt3GXl9j/Wrs5Ll+4csW7LeW6ZpnYxtJVp0FkHSS+GtwnhbfkXfhJWOLQDpQq W/8fCUWKULyb0c0wvz79WrvlC1aJ7GPq5H6RnCXumT8E4/AqNJCegEHhtCZQ5FMV2lyt 443q/Il3jpCde9+4gdvFAmHhmkZeo6DsbbsMjCcQkfdK662L8RNSLSut0of7yqHP1ltx B9WE1UVpl2mjscsb399h7bFnGwsJg/ZhZZ+RL9fTZDM/E8fvdNTBnRSdtHRctgN0Ckxa AB2vDCVSSOehrSHKteWRyCTtdB/4vqSW7rv8cOGKioUi7tRjofFlzcsj7MS5nRjkpGQ0 3VLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Be7mD39R; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v16-20020a056402175000b00462352ef503si2080758edx.518.2022.11.17.18.36.28; Thu, 17 Nov 2022 18:36:56 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=Be7mD39R; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241018AbiKRCVc (ORCPT + 92 others); Thu, 17 Nov 2022 21:21:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240719AbiKRCVW (ORCPT ); Thu, 17 Nov 2022 21:21:22 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDC0374AAA for ; Thu, 17 Nov 2022 18:20:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668738028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZQW7EJ9eJ3AI4uQYGbmB9y5OJ7c4Huh2ZC5cQT+rt4E=; b=Be7mD39R8ZbCcWvb9VQ72H8zjeCuzmbv5lDoM7QAU5MVtKbJwf86Sw/al68nQ9J7Z5vIDx mhoJpNKLIakncA3gATBoQ+2tcR5la3/LEz/dOhcgPQ7OYN8abdMoLfg/wC8/cY9QGGlolg AIXbLB0E2XJc7ehpyNXj67yOLx/jKTQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-627-8PrljJU3PV605bKQE2JGcA-1; Thu, 17 Nov 2022 21:20:23 -0500 X-MC-Unique: 8PrljJU3PV605bKQE2JGcA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F970101A528; Fri, 18 Nov 2022 02:20:23 +0000 (UTC) Received: from llong.com (unknown [10.22.16.250]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38F3D49BB60; Fri, 18 Nov 2022 02:20:22 +0000 (UTC) From: Waiman Long To: Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng Cc: linux-kernel@vger.kernel.org, john.p.donnelly@oracle.com, Hillf Danton , Mukesh Ojha , =?UTF-8?q?Ting11=20Wang=20=E7=8E=8B=E5=A9=B7?= , Waiman Long Subject: [PATCH v6 0/6] lockinig/rwsem: Fix rwsem bugs & enable true lock handoff Date: Thu, 17 Nov 2022 21:20:10 -0500 Message-Id: <20221118022016.462070-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 v6: - Fix an error in patch 2 reported by kernel test robot. v5: - Drop patch 2 and replace it with 2 new patches disabling preemption on all reader functions and writer functions respectively. The other patches are adjusted accordingly. v4: - Update patch descriptions in patches 1 & 2 to make clear the live lock conditions that are being fixed by these patches. There is no code change from v3. It turns out the current waiter optimistic spinning code does not work that well if we have RT tasks in the mix. This patch series include two different fixes to resolve those issues. The last 3 patches modify the handoff code to implement true lock handoff similar to that of mutex. Waiman Long (6): locking/rwsem: Prevent non-first waiter from spinning in down_write() slowpath locking/rwsem: Disable preemption at all down_read*() and up_read() code paths locking/rwsem: Disable preemption at all down_write*() and up_write() code paths locking/rwsem: Change waiter->hanodff_set to a handoff_state enum locking/rwsem: Enable direct rwsem lock handoff locking/rwsem: Update handoff lock events tracking kernel/locking/lock_events_list.h | 6 +- kernel/locking/rwsem.c | 240 ++++++++++++++++++++++-------- 2 files changed, 182 insertions(+), 64 deletions(-) -- 2.31.1