Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4153846pxf; Tue, 23 Mar 2021 04:13:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxQcvT4HpYZ+gFUOMLRHMUzT4fZc7m9P1tkknNGpJVku2aXAhxWq++yvQSeTw6VRpVwcAs X-Received: by 2002:a17:906:bccc:: with SMTP id lw12mr4299771ejb.268.1616498004785; Tue, 23 Mar 2021 04:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616498004; cv=none; d=google.com; s=arc-20160816; b=kFs1316Gxd6s0V2RPeUez8dLWLoTPMQJsm3NHeBkivoJIaI5Azk5FodcGiYNXyGC1g NiDnd8QpBirc2L1LgfkJkp0YbYkVazwQbQgaxRx5OSA4VGNAwIaFh0sXdSsR5ZC/3SAq X98ptN+egMnJLiq7UF5MfFsmhbiSWoNK5r42VSD45nhPpBq8pjvQkHQT47GEtEpCP6Lo KYsBnilmIx3x/YlSMFBv1VsqaP2HpHjsgXhO/oYWrr9uFtoivBjWtUn7QRRMPn0Orxav nRjBR5Le2yBUHnKtQoJXHkAmDBtFDCgLnbQ24EhA5VTbwjFUwzr1J3e4Pv+y3Ha4+drW 3PuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=/ozkk2GcYQ+141+3URqvPhOaJu51YWd41y079vTvs8M=; b=gqkakzcVF6V2UXqcbDjtKI5Y8ddfavkgarwMyejQWenRhdGm+7T5f1Ai1NsAQroboZ zyndDyJxA85XQDOJgZxXeC8U9JmXZC1g3lYVxe8dD9eoYFSPIeofIYY0G9O3h9IvPG9k 1FzmkW1WYq0RDrtpW1fE4ylylIhPsEi4YW51uV2Ha4R6D1JxBYDvSTA+zdR2xMd0kzdE I2hbM/6Ks/89UA6HwbjX9gSawlDPP/PJMn0VBSeiqGAWq0Oosf+UwN0e6/cXRgDmtd0Q /otE0+TPWZA/QX8jRjvQS2509gMk+RJIcr0nWScy70cMMcqaa3pzBlZ3WOXigt+sUdAk PNyA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ec10si13052938ejb.386.2021.03.23.04.13.00; Tue, 23 Mar 2021 04:13:24 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230290AbhCWLIw (ORCPT + 99 others); Tue, 23 Mar 2021 07:08:52 -0400 Received: from mga06.intel.com ([134.134.136.31]:4766 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230436AbhCWLIt (ORCPT ); Tue, 23 Mar 2021 07:08:49 -0400 IronPort-SDR: C0P2P18Yt+0wrq1OmDwdFTTF34bZVIZPQTm//7GnYvYyuW0UjWrC5cRZV7NeMB7bPFBj2aN2QN kbfHjjqT7Rag== X-IronPort-AV: E=McAfee;i="6000,8403,9931"; a="251809068" X-IronPort-AV: E=Sophos;i="5.81,271,1610438400"; d="scan'208";a="251809068" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 04:08:49 -0700 IronPort-SDR: lbaINAHh1CRWNiOOuf/ZQzF5Y+Xkbthj3gVNoPusQ5T0hjDgqNl/TzlYV3XpFqsX+XjGgDSDxS EG/6Zt8NDv/w== X-IronPort-AV: E=Sophos;i="5.81,271,1610438400"; d="scan'208";a="413347877" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 04:08:44 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lOets-00Ezjz-6J; Tue, 23 Mar 2021 13:08:40 +0200 Date: Tue, 23 Mar 2021 13:08:40 +0200 From: Andy Shevchenko To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Greg Kroah-Hartman , Dan Williams , Daniel Vetter , Mauro Carvalho Chehab , Dave Young , Baoquan He , Vivek Goyal , Dave Hansen , Keith Busch , Michal Hocko , Qian Cai , Oscar Salvador , Eric Biederman , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Tom Lendacky , Brijesh Singh , x86@kernel.org, kexec@lists.infradead.org Subject: Re: [PATCH v1 2/3] kernel/resource: make walk_mem_res() find all busy IORESOURCE_MEM resources Message-ID: References: <20210322160200.19633-1-david@redhat.com> <20210322160200.19633-3-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322160200.19633-3-david@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 22, 2021 at 05:01:59PM +0100, David Hildenbrand wrote: > It used to be true that we can have system RAM only on the first level > in the resourc tree. However, this is no longer holds for driver-managed > system RAM (i.e., dax/kmem and virtio-mem). > > The function walk_mem_res() only consideres the first level and is > used in arch/x86/mm/ioremap.c:__ioremap_check_mem() only. We currently > fail to identify System RAM added by dax/kmem and virtio-mem as > "IORES_MAP_SYSTEM_RAM", for example, allowing for remapping of such > "normal RAM" in __ioremap_caller(). Here I dunno, but consider to add Fixes tag if it fixes known bad behaviour. > Let's find all busy IORESOURCE_MEM resources, making the function > behave similar to walk_system_ram_res(). > > Cc: Andrew Morton > Cc: Greg Kroah-Hartman > Cc: Dan Williams > Cc: Daniel Vetter > Cc: Andy Shevchenko > Cc: Mauro Carvalho Chehab > Cc: Signed-off-by: David Hildenbrand > Cc: Dave Young > Cc: Baoquan He > Cc: Vivek Goyal > Cc: Dave Hansen > Cc: Keith Busch > Cc: Michal Hocko > Cc: Qian Cai > Cc: Oscar Salvador > Cc: Eric Biederman > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: "H. Peter Anvin" > Cc: Tom Lendacky > Cc: Brijesh Singh > Cc: x86@kernel.org > Cc: kexec@lists.infradead.org > Signed-off-by: David Hildenbrand > --- > kernel/resource.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/resource.c b/kernel/resource.c > index 4efd6e912279..16e0c7e8ed24 100644 > --- a/kernel/resource.c > +++ b/kernel/resource.c > @@ -470,7 +470,7 @@ int walk_mem_res(u64 start, u64 end, void *arg, > { > unsigned long flags = IORESOURCE_MEM | IORESOURCE_BUSY; > > - return __walk_iomem_res_desc(start, end, flags, IORES_DESC_NONE, true, > + return __walk_iomem_res_desc(start, end, flags, IORES_DESC_NONE, false, > arg, func); > } > > -- > 2.29.2 > -- With Best Regards, Andy Shevchenko