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 746D7C636CA for ; Mon, 19 Jul 2021 02:27:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0A6E0610C7 for ; Mon, 19 Jul 2021 02:27:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A6E0610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 876206B0161; Sun, 18 Jul 2021 22:27:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84D7B6B0163; Sun, 18 Jul 2021 22:27:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7152A6B0164; Sun, 18 Jul 2021 22:27:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id 509DE6B0161 for ; Sun, 18 Jul 2021 22:27:57 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E919E8249980 for ; Mon, 19 Jul 2021 02:27:55 +0000 (UTC) X-FDA: 78377752110.05.2A20BD6 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by imf10.hostedemail.com (Postfix) with ESMTP id AE63D60019BB for ; Mon, 19 Jul 2021 02:27:55 +0000 (UTC) Received: by mail-ed1-f49.google.com with SMTP id k27so21733964edk.9 for ; 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=T4CHxE1h9UbKkWR8cVy/zn/bMp3F3LlBPNgRIt1DXk6GpUQqY9Eno9St7vRbjxGcme Mb2Dy95Uf5/Ze9Wbw2Amq3ugjgkTX5j9PYZ2aiMSFQk9v49eMrBEVRpj3iSkLxEhQqr4 ZzxIhlTyam9acjmiVSdnOjYgENrKR+ZFH5VsLCmfoIuXv+72TM+lgYmF82zpymvlMkrF DHo4KqSUM5MdyMyPSJOV+sNz3eSVZhe4LDebfzUyFFIu5eFXpKPgLWed/IWj4TF4C17p KlcLyMSOq+vYjhGiu4Wn1RWuEXLNRdQSzv7qTM89Y2OvyZNGfBOjK4n8WTkO+akksSQJ qnDA== X-Gm-Message-State: AOAM531/cFhsQKkwOBefu2os8ZNcpQP/eW/uYwAopOxcvPFPrsF5XVjC 1EUGJiX2amCTY4U5cKJA61hqkPSQJSJNNwse3ok= 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" Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=WCAyRpCc; spf=pass (imf10.hostedemail.com: domain of zhouzhouyi@gmail.com designates 209.85.208.49 as permitted sender) smtp.mailfrom=zhouzhouyi@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: oaa47dkfiuis3w3ahkwjepyqbpc8g334 X-Rspamd-Queue-Id: AE63D60019BB X-Rspamd-Server: rspam01 X-HE-Tag: 1626661675-420119 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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