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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 616CCC43334 for ; Wed, 6 Jul 2022 14:25:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D56F66B0071; Wed, 6 Jul 2022 10:25:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D05C46B0073; Wed, 6 Jul 2022 10:25:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCDA36B0074; Wed, 6 Jul 2022 10:25:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AA2566B0071 for ; Wed, 6 Jul 2022 10:25:40 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7A5F4334DB for ; Wed, 6 Jul 2022 14:25:40 +0000 (UTC) X-FDA: 79656898440.21.C6DEF29 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by imf23.hostedemail.com (Postfix) with ESMTP id A512E140011 for ; Wed, 6 Jul 2022 14:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657117539; x=1688653539; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=ekAnkxlyo5a77ZXv/WDjstgTFIs6FVRj0ddynjjv0EY=; b=JiVDsltUwb5kF0K8bLMu+WBqXGHRzst6STRaB2fT7E8nJhtabCXk+rPk CZrjfw2HfCwf5c+h0APrliJEjNKRtr1r1NN4qjVboSEGOWvxFDbg9JjkY hWY055A+E9/FxKkcfG9cQs95HPpH2TNXkxHZvnw0RjqL3p/MM0cwGsjfz 6WRzu3Ocub4wv9Gx+e5QNWvAmOtCrnZtsqjo4ZxcZOncQi4HHcZEGY4e2 KYeih/JqlPuCdj7k31tKdSdyg4OeevKH6Fpm08KX5pMJ53D6NpB+5Poiq qD/+CJ02/nYaoESeWQMtfr/Nf1guoxYbv5DWKLIvudohfDnCfdUINmeZD w==; X-IronPort-AV: E=McAfee;i="6400,9594,10399"; a="266789554" X-IronPort-AV: E=Sophos;i="5.92,250,1650956400"; d="scan'208";a="266789554" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2022 07:25:38 -0700 X-IronPort-AV: E=Sophos;i="5.92,250,1650956400"; d="scan'208";a="568086315" Received: from xsang-optiplex-9020.sh.intel.com (HELO xsang-OptiPlex-9020) ([10.239.159.143]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2022 07:25:33 -0700 Date: Wed, 6 Jul 2022 22:25:30 +0800 From: Oliver Sang To: Mel Gorman Cc: Andrew Morton , 0day robot , LKML , linux-mm@kvack.org, lkp@lists.01.org, Nicolas Saenz Julienne , Marcelo Tosatti , Vlastimil Babka , Michal Hocko , Hugh Dickins Subject: Re: [mm/page_alloc] 2bd8eec68f: BUG:sleeping_function_called_from_invalid_context_at_mm/gup.c Message-ID: References: <20220613125622.18628-8-mgorman@techsingularity.net> <20220703132209.875b823d1cb7169a8d51d56d@linux-foundation.org> <20220706095535.GD27531@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220706095535.GD27531@techsingularity.net> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657117540; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ekoOE0zTEj3vzj+VTfPLl5sFYyI8NAXh5W9ve2yN8WI=; b=g/BShaVxlEdxU2a8R6Y48qxSoB+n34Q3F1xVz8P+fsDk5yFYYwyWCuTF5+v9n7uPPnalE+ r4Oc/vHjLV15Q9668fXL9EVbYDjHThqckFlY7hjXLTDEMbQosQ+kuYgETKGAF6dFciw99p auKiaIWRjcAuIDbOzFABp66FzUF0T90= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=JiVDsltU; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf23.hostedemail.com: domain of oliver.sang@intel.com has no SPF policy when checking 134.134.136.126) smtp.mailfrom=oliver.sang@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657117540; a=rsa-sha256; cv=none; b=YruVAlg20HE0BG2XYpgC5aV0kYEIZ4zI5nO23rM5Mux2iA2tpgJTWlo13o9yBlRRy3EPy6 vglti5C94HjxZ/VDYJpqQI79F04mLc/v1n11vFyGHJAT10VB/z6AdtMdgzZIDbKTZeyWBA L+cYTitAmrFdSFvZqWiVOIhmKyIs5JY= X-Rspam-User: X-Rspamd-Server: rspam07 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=JiVDsltU; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf23.hostedemail.com: domain of oliver.sang@intel.com has no SPF policy when checking 134.134.136.126) smtp.mailfrom=oliver.sang@intel.com X-Stat-Signature: bx513hukh1aox49r8fpjci6z3c56nake X-Rspamd-Queue-Id: A512E140011 X-HE-Tag: 1657117539-957125 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: hi, Mel Gorman, On Wed, Jul 06, 2022 at 10:55:35AM +0100, Mel Gorman wrote: > On Tue, Jul 05, 2022 at 09:51:25PM +0800, Oliver Sang wrote: > > Hi Andrew Morton, > > > > On Sun, Jul 03, 2022 at 01:22:09PM -0700, Andrew Morton wrote: > > > On Sun, 3 Jul 2022 17:44:30 +0800 kernel test robot wrote: > > > > > > > FYI, we noticed the following commit (built with gcc-11): > > > > > > > > commit: 2bd8eec68f740608db5ea58ecff06965228764cb ("[PATCH 7/7] mm/page_alloc: Replace local_lock with normal spinlock") > > > > url: https://github.com/intel-lab-lkp/linux/commits/Mel-Gorman/Drain-remote-per-cpu-directly/20220613-230139 > > > > base: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git b13baccc3850ca8b8cccbf8ed9912dbaa0fdf7f3 > > > > patch link: https://lore.kernel.org/lkml/20220613125622.18628-8-mgorman@techsingularity.net > > > > > > > > > > Did this test include the followup patch > > > mm-page_alloc-replace-local_lock-with-normal-spinlock-fix.patch? > > > > no, we just fetched original patch set and test upon it. > > > > now we applied the patch you pointed to us upon 2bd8eec68f and found the issue > > still exist. > > (attached dmesg FYI) > > > > Thanks Oliver. > > The trace is odd in that it hits in GUP when the page allocator is no > longer active and the context is a syscall. First, is this definitely > the first patch the problem occurs? > > Second, it's possible for IRQs to be enabled and an IRQ delivered before > preemption is enabled. It's not clear why that would be a problem other > than lacking symmetry or how it could result in the reported BUG but > might as well rule it out. This is build tested only do you want us test below patch? if so, should we apply it upon the patch "mm/page_alloc: Replace local_lock with normal spinlock" or "mm/page_alloc: replace local_lock with normal spinlock -fix"? > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 934d1b5a5449..d0141e51e613 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -192,14 +192,14 @@ static DEFINE_MUTEX(pcp_batch_high_lock); > > #define pcpu_spin_unlock(member, ptr) \ > ({ \ > - spin_unlock(&ptr->member); \ > pcpu_task_unpin(); \ > + spin_unlock(&ptr->member); \ > }) > > #define pcpu_spin_unlock_irqrestore(member, ptr, flags) \ > ({ \ > - spin_unlock_irqrestore(&ptr->member, flags); \ > pcpu_task_unpin(); \ > + spin_unlock_irqrestore(&ptr->member, flags); \ > }) > > /* struct per_cpu_pages specific helpers. */ > > >