Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3336243pxv; Sun, 18 Jul 2021 19:30:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwP0MYfi+4nhkrM1R3dgAIvO6nAMcicXrwyNYiJkcXPr2AvPD2SMyfbgZ+Cop8UppLzIv6I X-Received: by 2002:a05:6402:b4e:: with SMTP id bx14mr31642388edb.158.1626661827723; Sun, 18 Jul 2021 19:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626661827; cv=none; d=google.com; s=arc-20160816; b=UXeOce8djxd8z8ofUwu1GDUj4UqwdFv7tNRBigbu0dKwWyx9OmVfKjOlcXdy5aeyXq urmVAFBJUmaWEO5sbpXt7cnQtgtju+ILHPUIFwQCK75b7XeNmAL4drE/7KFNxUjpBEKI pNSFRSR9JsjXdI6erTei0fglYIyUyoFqQXwEOeawXgKyf5aIL5WdqP22emnX7y/ao90z AlY7kXGCLMGjxihv1vDmB3tu9V6wlMvvulceUyb5On685+BuP/L5itX91SNsh2aLrBvp DzRuvrNpLSB3L/WopL1k08CDpvkove0BqQos2u0QW2zwy4I1rwxL8D/pbWRUikUPuT8e FkaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=vU0E8MKFRQc5K71Zlz7p0MAFOgnAONKIzFrXpHRGGi0=; b=LhWKjVYoqRAgSQAExnh0ERMWWtRVNHEcfI7sK5TbW2e3s78+PKDaXQ7gsT3U78rvIW F2Gd3ijQtfn886Ky/ghqXFNsalcZCPZRE+UoIZ/SwDMIs8J5/SBP+knbE24aK5YHJPqG qvNQ7Hv+Ra2RafxILnkzuFr7c59/CyD4NoBRbh0/ra4+n13qr1fSc3+AT+agfT7Q9cpi hbRgTXKZ0NGgzAm5fOV2o2sAtHt+SJg3vkZT9VpwQ2dbDKgG575eyOlpQaM45/iT0GcD q4lBt8QPzAI3oNzMRu8AW2oMv9ZG5O7EoPcKqjTTd5v6ohi+FgZf0NbqUDrERWAAqI0q Cn5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WCAyRpCc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn9si10347717ejc.461.2021.07.18.19.30.04; Sun, 18 Jul 2021 19:30:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WCAyRpCc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234179AbhGSCa4 (ORCPT + 99 others); Sun, 18 Jul 2021 22:30:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233713AbhGSCa4 (ORCPT ); Sun, 18 Jul 2021 22:30:56 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12066C061762; Sun, 18 Jul 2021 19:27:56 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id ca14so21778748edb.2; Sun, 18 Jul 2021 19:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vU0E8MKFRQc5K71Zlz7p0MAFOgnAONKIzFrXpHRGGi0=; b=WCAyRpCcs5d/MKa3u46Yycnh4a/Gp4yK2fPNhcjjD90KeXiO34OHhGmg5Xh3yPYbs0 ase1rSVB43YnUk2XvDiWIm9gVhy2ccVjB7dpgs4jSd4abfCBxtqJCkNdf1CmtP8vKoXX P1ykNsaOu4GNsHdxzjATRdt83cQnd/f3ZCCULc2l7HXNTqtd8bnUdPt4si5W+zGhuXjT EeT9skFcR4xjdLJJhVemI1LnFATXXrJkmhxsflqXeU5RReUMeVqu6L5Tg+Cj0xRtKJw2 g5bw6BvntBw0Q3qySpLZ+bl0M0fkCsCc37UeYR8ZvKg6E4lyabXLqwYRt6JJQztc9XoM gSag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vU0E8MKFRQc5K71Zlz7p0MAFOgnAONKIzFrXpHRGGi0=; b=aj3ZBUa1G9YqlQncmHukzxsdySxagy0ISq7MK6pXeRHQ4D1yEbXfczPDSEOraWrVLA iBC6ohLpS17PHPCs3zmHGFeyFiJDPIkinvd5xzOWHWA4oXyAZhEaxU2+0xONg4eTqiEt 5CCJxE4+nj7YsDhzROocj1ZoknNDVKyCoRxahDqtIBBg+l2DiJFrei0DJeG2gHxtspCk /zkD5s8/h4HgldQrGhovGuY7+rwpvzUUytEP9kJgI6SNIKYteWLqOr6egU0KVSqDwmUt 9V9310XUD3WRT4Gmp3IPe/hk8QjifszOUvWDL2SdGGZ5PXuKOlWw+xE6+pnweyy7swox wqlg== X-Gm-Message-State: AOAM533AQk2gOIBIVkV0743wtmSvvsOfhpfLSfN+N8bZH4SpvO8MAZaP TFMgtdq8WTTgNWfCJy2v6o3nRBC+guI2xPKc5/Y= X-Received: by 2002:aa7:c7d0:: with SMTP id o16mr31528943eds.75.1626661674680; Sun, 18 Jul 2021 19:27:54 -0700 (PDT) MIME-Version: 1.0 References: <2245518.LNIG0phfVR@natalenko.name> <6698965.kvI7vG0SvZ@natalenko.name> <20210718215914.GQ4397@paulmck-ThinkPad-P17-Gen-1> <20210719015313.GS4397@paulmck-ThinkPad-P17-Gen-1> In-Reply-To: From: Zhouyi Zhou Date: Mon, 19 Jul 2021 10:27:43 +0800 Message-ID: Subject: Re: linux-5.13.2: warning from kernel/rcu/tree_plugin.h:359 To: paulmck@kernel.org Cc: Matthew Wilcox , Oleksandr Natalenko , linux-kernel , stable@vger.kernel.org, Chris Clayton , Chris Rankin , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , rcu , Andrew Morton , Linux-MM Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 19, 2021 at 10:24 AM Zhouyi Zhou wrote: > > On Mon, Jul 19, 2021 at 9:53 AM Paul E. McKenney wrote: > > > > On Sun, Jul 18, 2021 at 11:51:36PM +0100, Matthew Wilcox wrote: > > > On Sun, Jul 18, 2021 at 02:59:14PM -0700, Paul E. McKenney wrote: > > > > > > https://lore.kernel.org/lkml/CAK2bqVK0Q9YcpakE7_Rc6nr-E4e2GnMOgi5jJj=_Eh_1k > > > > > > EHLHA@mail.gmail.com/ > > > > > > > > But this one does show this warning in v5.12.17: > > > > > > > > WARN_ON_ONCE(!preempt && rcu_preempt_depth() > 0); > > > > > > > > This is in rcu_note_context_switch(), and could be caused by something > > > > like a schedule() within an RCU read-side critical section. This would > > > > of course be RCU-usage bugs, given that you are not permitted to block > > > > within an RCU read-side critical section. > > > > > > > > I suggest checking the functions in the stack trace to see where the > > > > rcu_read_lock() is hiding. CONFIG_PROVE_LOCKING might also be helpful. > > > > > > I'm not sure I see it in this stack trace. > > > > > > Is it possible that there's something taking the rcu read lock in an > > > interrupt handler, then returning from the interrupt handler without > > > releasing the rcu lock? Do we have debugging that would fire if > > > somebody did this? > > > > Lockdep should complain, but in the absence of lockdep I don't know > > that anything would gripe in this situation. > I think Lockdep should complain. > Meanwhile, I examined the 5.12.17 by naked eye, and found a suspicious place I examined 5.13.2 the unpaired rcu_read_lock is still there > that could possibly trigger that problem: > > struct swap_info_struct *get_swap_device(swp_entry_t entry) > { > struct swap_info_struct *si; > unsigned long offset; > > if (!entry.val) > goto out; > si = swp_swap_info(entry); > if (!si) > goto bad_nofile; > > rcu_read_lock(); > if (data_race(!(si->flags & SWP_VALID))) > goto unlock_out; > offset = swp_offset(entry); > if (offset >= si->max) > goto unlock_out; > > return si; > bad_nofile: > pr_err("%s: %s%08lx\n", __func__, Bad_file, entry.val); > out: > return NULL; > unlock_out: > rcu_read_unlock(); > return NULL; > } > I guess the function "return si" without a rcu_read_unlock. > > However the get_swap_device has changed in the mainline tree, > there is no rcu_read_lock anymore. > > > > > Also, this is a preemptible kernel, so it is possible to trace > > __rcu_read_lock(), if that helps. > > > > Thanx, Paul > Thanx > Zhouyi