From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1804DC636C8 for ; Mon, 19 Jul 2021 02:27:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1B8B6101D for ; Mon, 19 Jul 2021 02:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233894AbhGSCa4 (ORCPT ); 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-Google-Smtp-Source: ABdhPJwVqaQ0utHHnZ+CEhjr27gk3iYhwEDrNlh7JdlR+pY1ZfQfuuG3Kr4HwdgmE5P7cP1bVxJ1wHQvH4rDZh0/Qj0= 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: rcu@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