Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3559088pxv; Mon, 19 Jul 2021 03:17:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6sTVLVqmZWX9oyhl58kkgNPl5MriCZmoCyGIwbUmYFo+cgVY5Yk95/Op3DhXrf6OsJZA9 X-Received: by 2002:a05:6e02:1d8d:: with SMTP id h13mr16473321ila.40.1626689857174; Mon, 19 Jul 2021 03:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626689857; cv=none; d=google.com; s=arc-20160816; b=TVi+bEEgBhYoCD1pGp8Br8DWYyy17VoSKj7xGgemx8N7Ms2EKCWnkJgH8YJgVzeGiv uJeN7cjhnz1meL2ff1MD1i8eiaE24g1bZQ8u6IP1piVpkn7k5VEbUsG0Lf7AJDWkOdyA 28VkYj+VH1cdgZKn2RMzGdZn3GJRdjoC/YTh+x1IpRcFVQ+H3ua/I0C/io/IGtGTLol9 YJe09jKqGsO5BOeW3cDX1zuZEvF474ZJ+7AEkaO29iKtEUEV59YxqHKjUIKETYk2ZFxe vn12YKVmIj8ib5wd8FPlmzzgCg78QvG4npB+0GbREqIwRt3KWxB+aeFwsQcCgY65xeYk Bi/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RsTA6lCPJUSqFkf4kI50Ly+s7/7eeHMzPSdXglSoeiU=; b=ur0s1a8LcSntyw7X92lDy2agLZYYBAghkDp7dh4QSByyowK0+xKarJ6+sVu7IWJv3k lRueu5wTeIie8EXK5SXYUK/U6k1C7nyWDCNG3JUSI8lhUivVbK0IxrGUNX5XvHw2DTIo DP3stNOo8WgZILJyl+pAiGrIL345sw5oBsN0vQaTo0AzYCB98zy7gBIcKGJ75wKLUGMD ihpCOPx5YW929bmw7NIBGk7AXGzmGLYFWXdr7VDstZ22jpazRKMwGOlvc0ksELKx9yjf ifXs6WN67HnF5USDV9RiZqX1z1XC4XAXG17yTqdg/lytc/CtLgVkasLV+NXntGCDSubb RvTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="fCF/wlFq"; 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 t16si18998359ilm.159.2021.07.19.03.17.25; Mon, 19 Jul 2021 03:17:37 -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="fCF/wlFq"; 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 S236270AbhGSJfj (ORCPT + 99 others); Mon, 19 Jul 2021 05:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236215AbhGSJfi (ORCPT ); Mon, 19 Jul 2021 05:35:38 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6E3AC061574; Mon, 19 Jul 2021 02:21:35 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id a7so15472792iln.6; Mon, 19 Jul 2021 03:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RsTA6lCPJUSqFkf4kI50Ly+s7/7eeHMzPSdXglSoeiU=; b=fCF/wlFqLzoWUG6sB7JEQhqPMSNr0qNYYHAcrGNftTyFMaAxKtbGI0v+eASFWU5I8k j8EvuDGk/sotP6K0xugNeM6wScVJaoSbC0CDpDO4otpTZb6anM/A3oAesl6KKGHeIK6p KEDxWS86n9ONQf4whk7pTCFOfK5B7tJd32LP/Ie6LvP3f6SSuG4xlmoZ1cMd4dlurc5w C12NaHMsP4Wmfawd5cuSqf7J3egAZCZFBiw9TEOmxLiGeZxmYs4JRw/Wex8r2DQLM/ZU A5gGi42MWz3AwpAJwriJp7SF7ktQXocm9Jf7FGPLRmDMYHCnIzEuNB1k3gcJl2qAMCWI dvhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RsTA6lCPJUSqFkf4kI50Ly+s7/7eeHMzPSdXglSoeiU=; b=lKU9TdY8yP6eTRQHsAHOww8UaShGEauHyeGoMkhjLVaxDqZ4bLn1XzOGPlBiFd3N9k /TMr5iNehHufgACFYxyKMejaW88l6U1T1s5+4PD8coD27s4hy8IzG3U2T2itw8tMqyMJ mFXlP2e3EcnP7qg8MIz7x6SlK3FqD2mlKgCI+2ehasgi1Km9YxsgEk03CTY/bPxac3ui vAddUinG1i8EUcj36je6dQi56Z2+teXnhWReuDi5fPiEcSapWj+Y/ShM623BMinH97T4 QOrn90w9iZhq0YILjwmH8jNA66ICAKMYpFfMthW1OI57JhoHpORxtO7sPDCmUaJ+6/Xi WLaA== X-Gm-Message-State: AOAM5320loqBtEgaoa7oAAhchdx8/YSLROW+wVVnoxR92iL/k2nQdGmD QGy7bZEkO/AGUxsiK4qmY1M= X-Received: by 2002:a05:6e02:54c:: with SMTP id i12mr16393080ils.103.1626689777961; Mon, 19 Jul 2021 03:16:17 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id l5sm10209774ion.44.2021.07.19.03.16.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 03:16:17 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 7C43C27C0054; Mon, 19 Jul 2021 06:16:16 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 19 Jul 2021 06:16:16 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrfedtgddvgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpedvleeigedugfegveejhfejveeuveeiteejieekvdfgjeefudehfefhgfegvdeg jeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsoh hquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedq udejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmh gvrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 19 Jul 2021 06:16:14 -0400 (EDT) Date: Mon, 19 Jul 2021 18:14:21 +0800 From: Boqun Feng To: Matthew Wilcox Cc: Zhouyi Zhou , paulmck@kernel.org, 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 , Miaohe Lin , "Huang, Ying" Subject: Re: linux-5.13.2: warning from kernel/rcu/tree_plugin.h:359 Message-ID: References: <2245518.LNIG0phfVR@natalenko.name> <6698965.kvI7vG0SvZ@natalenko.name> <20210718215914.GQ4397@paulmck-ThinkPad-P17-Gen-1> <20210719015313.GS4397@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 19, 2021 at 03:43:00AM +0100, Matthew Wilcox wrote: > On Mon, Jul 19, 2021 at 10:24:18AM +0800, Zhouyi Zhou wrote: > > Meanwhile, I examined the 5.12.17 by naked eye, and found a suspicious place > > 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. > > Yes, but the caller is supposed to call put_swap_device() which > calls rcu_read_unlock(). See commit eb085574a752. Right, but we need to make sure there is no sleepable function called before put_swap_device() called, and the call trace showed the following happened: do_swap_page(): si = get_swap_device(): rcu_read_lock(); lock_page_or_retry(): might_sleep(); // call a sleepable function inside RCU read-side c.s. __lock_page_or_retry(): wait_on_page_bit_common(): schedule(): rcu_note_context_switch(); // Warn here put_swap_device(); rcu_read_unlock(); , which introduced by commit 2799e77529c2a [Copy the author] Regards, Boqun