Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2509187lqz; Tue, 2 Apr 2024 23:00:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUC2NcnHWGUofNwT4VAh1uJ/DbLYUrFA2/JAR+pxSmU7jIR8RgMjoYmpqUx/HoVKFo97YbB2F3gvCQK8jlQtUQGpRQYxgTV8kAE6GJ7qQ== X-Google-Smtp-Source: AGHT+IE5D7bjzEoEgttoPNzX6KiORGvpR+kyqIvJG/CWDyvIVeoOPSJ6dHmF/5W43O2yU1C67Hcc X-Received: by 2002:a1f:cd85:0:b0:4d4:1551:6ef6 with SMTP id d127-20020a1fcd85000000b004d415516ef6mr10261174vkg.2.1712124043937; Tue, 02 Apr 2024 23:00:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712124043; cv=pass; d=google.com; s=arc-20160816; b=ARZCYeYp2FlNRk9F+xXx29KSzGTvAMQofCybG0Eagr7zQ5ClGVtYiUJQGPA544R9MX +9CqvUdejHqIgq/ovCV3AgZm4IOzo6LFrOFx/Vn3QhYejmqbT+itGGzbNjoWQ4Fl80qZ gL/stLdUSTuxkUl4f4vkf8sGgZmujq4gXfU8XyOdGlOYJ45XB5xH+cT14LX18Z1LljEn gwOZszyJoH55sNY7sW8BJduBvVrQW3oQ8ocTnfGG/+xEgHNs/Vmd/CV5+NzlrvHETYhf 6bBAQ+7YAzeOJpxrv7FzU9k6yXC15Q/f+OsCdEEhbcgsf48Dp5iu841MnAGCfO7UqQiT k/qQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=jeN7BH7FX/UdYJqsptGEzUMzeVN4Ecw1to7ZT4gs+X4=; fh=2DGW9aee1Z5KsOod+0Zj+zi7jAFHoR1qah60ViPJNWE=; b=mwr3riTjMTftAZ59C3cbPep9n6RaJnX8GMAvcmY1okVZMAkRQ+f446vxvxL4Slm1es JR/IUtX8Cy+paqS4AbJCIqAMRRlblMF6Y/0l6Q/BejmqGqDPsRAg6bdNpxPYa6mzJTZW o2S+ZJZu+nq3TsiHa1Z4ioy3az5H15lnqzhq1AG+bnNZvSvDjqbdRnVgdWt/r21NdsNx KLSFoS1gZFqKaLUIuEXAg8B7VOv/T6EuTrzbgTkFZaNYaSTnSzF4JbDj7erWyThrUlpg GL6exooUFXxfL08QRc6o1MFO53jPnAvzBJqrj1l/oaDjoSuKtkGE6/iE3AzFx8DLF+SH MDKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LFJJK1ml; 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-129070-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129070-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 3-20020a0562140cc300b00699267f0b70si1154642qvx.47.2024.04.02.23.00.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 23:00:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129070-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=LFJJK1ml; 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-129070-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129070-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 99C2F1C21D87 for ; Wed, 3 Apr 2024 06:00:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39A204D9E3; Wed, 3 Apr 2024 06:00:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LFJJK1ml" Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 B8D764CB41 for ; Wed, 3 Apr 2024 06:00:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712124037; cv=none; b=UiIfgpUxTT2rEYHwyQ3XDb8JK0YBLf36tg2vsxBU7A7Uma35HrCm3Gm9pVHZzZ1kHaopatvuli0tsS06GJmJPjqD6RMsuOL6gRFbqwjt6aJAgJcB+dR7WIW7G70tO4ZGkoCU66DSMehDyPicTn91CqKdUefwI7t+j3j1kSiEKWI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712124037; c=relaxed/simple; bh=RvRmCihrPR6nqu0uOGLjEw2g7U2DBNWoL9Lnv/JHcvA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=frnN8DO0I5rlt8SozswkkBs4dKRQp+Ys6D5iDJb63bS5rYIsKH8yyRYstF9q56Rc/lDcyBhOUClY2tm9JQU+jIyQlCBK5Ww2AMcDn5QBmJKopwPMh2S+h+8iWSyLQGeX6dqhLSBHHn6C6CDsMm4usTLt4WV6KAHp8fl8ya3tRTg= 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=LFJJK1ml; arc=none smtp.client-ip=209.85.221.44 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-wr1-f44.google.com with SMTP id ffacd0b85a97d-3436ffe05c9so958441f8f.1 for ; Tue, 02 Apr 2024 23:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712124034; x=1712728834; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jeN7BH7FX/UdYJqsptGEzUMzeVN4Ecw1to7ZT4gs+X4=; b=LFJJK1ml25esA5RtsGvoQrb6hJEnpww1f673N733qdfjrNWsKj10ozcwVHZrTHekjI SGm9tq/HcVknbEel6ca/9jXJNEHQj5AkzjpvlUQhBUL8N9o5IcegWywTqsGYmGWbu+f+ +oj3L9EYEs5slu17ylruwJWll3ZppIZ8zd/tzHKfXdASvUNmCZay3TS5YeTsN0LqiPm5 YDuBhTLoXDE302gSRVdc1GhAfURSaUFqWnYFHL57EEiJD3WwQKq6hIfpCf0AX0775O4l iwFLCrx+/7dEZWP14AK4iGYhu2hXDykdzZ4PH4i0T6CZUn/pczJMX3gxWLFgK6WiEWt2 cUAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712124034; x=1712728834; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jeN7BH7FX/UdYJqsptGEzUMzeVN4Ecw1to7ZT4gs+X4=; b=vQAQDFHs9qozwUR02n5ujWn0GQ9+S52yGJxDOOoKhy3ctelH6HCml6pId+ozWoax+E aIPLU6ZpsI6Ey2gUmWMWUn76M2MaRUiMkyzqzgkcP/xwElzkeYSAsxRSqegjoi1Kc6ah Ctv77+djeXF1a6tsWS4Hf6SNMreu8zkP5Z3SoJ3Wi7/gCWo1ImFm+9LPpiV/IqU2D007 NgynnGFkzGXV6UJeXxKrF+1A/zxs8OOqEC3tSYkRY5oqerGjtUmKYIxe6iMZWDw3iBwg rM4QWFjceLdyECl268UAi7YB3VTHreZUJOCU1uUMdZOFpNQMuiyNNvhOYVr9pRNuy1aI Xskw== X-Forwarded-Encrypted: i=1; AJvYcCVNzvh3vIo+BMzRIdL/ONa+76ahdA+ZmziXECtL8hguMK89ZBVR8BaGume0/TLW71sL0LNpyiiqic9XTfwSpgxjMTEWIP+OqtZIG9AM X-Gm-Message-State: AOJu0Yw8u7S8cZls5FciQ86Q/xjIvpLatK/JXSRQNQQz+9A+OvZKkekJ sonE4Atv6p+uaQcIAsN0/JaTHj8y6gDBNMyGZnlF08WRs4b83IXX9opYQIHPAfvYPmre8pwphBF BxV4I/uJwvtj7k2sFJhtNJvTlcLfVPZqrHis= X-Received: by 2002:a5d:5590:0:b0:341:b26f:8929 with SMTP id i16-20020a5d5590000000b00341b26f8929mr1083115wrv.37.1712124033796; Tue, 02 Apr 2024 23:00:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1707219895-31977-1-git-send-email-zhiguo.niu@unisoc.com> In-Reply-To: From: Zhiguo Niu Date: Wed, 3 Apr 2024 14:00:22 +0800 Message-ID: Subject: Re: [PATCH V4] lockdep: fix deadlock issue between lockdep and rcu To: Carlos Llamas Cc: Zhiguo Niu , peterz@infradead.org, mingo@redhat.com, will@kernel.org, longman@redhat.com, boqun.feng@gmail.com, bvanassche@acm.org, linux-kernel@vger.kernel.org, ke.wang@unisoc.com, xuewen.yan@unisoc.com, hongyu.jin@unisoc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 2, 2024 at 11:41=E2=80=AFPM Carlos Llamas = wrote: > > On Tue, Feb 06, 2024 at 07:44:55PM +0800, Zhiguo Niu wrote: > > There is a deadlock scenario between lockdep and rcu when > > rcu nocb feature is enabled, just as following call stack: > > > > rcuop/x > > -000|queued_spin_lock_slowpath(lock =3D 0xFFFFFF817F2A8A80, val =3D ?) > > -001|queued_spin_lock(inline) // try to hold nocb_gp_lock > > -001|do_raw_spin_lock(lock =3D 0xFFFFFF817F2A8A80) > > -002|__raw_spin_lock_irqsave(inline) > > -002|_raw_spin_lock_irqsave(lock =3D 0xFFFFFF817F2A8A80) > > -003|wake_nocb_gp_defer(inline) > > -003|__call_rcu_nocb_wake(rdp =3D 0xFFFFFF817F30B680) > > -004|__call_rcu_common(inline) > > -004|call_rcu(head =3D 0xFFFFFFC082EECC28, func =3D ?) > > -005|call_rcu_zapped(inline) > > -005|free_zapped_rcu(ch =3D ?)// hold graph lock > > -006|rcu_do_batch(rdp =3D 0xFFFFFF817F245680) > > -007|nocb_cb_wait(inline) > > -007|rcu_nocb_cb_kthread(arg =3D 0xFFFFFF817F245680) > > -008|kthread(_create =3D 0xFFFFFF80803122C0) > > -009|ret_from_fork(asm) > > > > rcuop/y > > -000|queued_spin_lock_slowpath(lock =3D 0xFFFFFFC08291BBC8, val =3D 0) > > -001|queued_spin_lock() > > -001|lockdep_lock() > > -001|graph_lock() // try to hold graph lock > > -002|lookup_chain_cache_add() > > -002|validate_chain() > > -003|lock_acquire > > -004|_raw_spin_lock_irqsave(lock =3D 0xFFFFFF817F211D80) > > -005|lock_timer_base(inline) > > -006|mod_timer(inline) > > -006|wake_nocb_gp_defer(inline)// hold nocb_gp_lock > > -006|__call_rcu_nocb_wake(rdp =3D 0xFFFFFF817F2A8680) > > -007|__call_rcu_common(inline) > > -007|call_rcu(head =3D 0xFFFFFFC0822E0B58, func =3D ?) > > -008|call_rcu_hurry(inline) > > -008|rcu_sync_call(inline) > > -008|rcu_sync_func(rhp =3D 0xFFFFFFC0822E0B58) > > -009|rcu_do_batch(rdp =3D 0xFFFFFF817F266680) > > -010|nocb_cb_wait(inline) > > -010|rcu_nocb_cb_kthread(arg =3D 0xFFFFFF817F266680) > > -011|kthread(_create =3D 0xFFFFFF8080363740) > > -012|ret_from_fork(asm) > > > > rcuop/x and rcuop/y are rcu nocb threads with the same nocb gp thread. > > This patch release the graph lock before lockdep call_rcu. > > > > Fixes: a0b0fd53e1e6 ("locking/lockdep: Free lock classes that are no lo= nger in use") > > Cc: > > Cc: Boqun Feng > > Cc: Waiman Long > > Cc: Carlos Llamas > > Cc: Bart Van Assche > > Signed-off-by: Zhiguo Niu > > Signed-off-by: Xuewen Yan > > Reviewed-by: Boqun Feng > > Reviewed-by: Waiman Long > > Reviewed-by: Carlos Llamas > > Reviewed-by: Bart Van Assche > > --- > > This patch should be good to go. Maybe it just slipped through the > cracks. Ingo, will you be taking this? Hi Carlos, Thanks for restoring this mail and now this patch can only be temporarily included in my code locally when I do related jobs. and hope someone can help merge it if there are no review suggestions. > > -- > Carlos Llamas