Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4299831pxf; Tue, 23 Mar 2021 07:35:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn8+1c2NlxStCuQWZQ++9llKYIrob0bHzdVzpckCkYbnmtasf0tBzZaC9dZsR/gkWYiSbC X-Received: by 2002:a17:906:eb4e:: with SMTP id mc14mr5073537ejb.169.1616510134388; Tue, 23 Mar 2021 07:35:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616510134; cv=none; d=google.com; s=arc-20160816; b=Bh1NMxpwTH8NtNBXpusryuyYsAh1jqel3xOEXje3U4S/ih0sgwalRo2BingJD587xh rU9TgVNmG2mQZdH9DgipG3xl5rQ9V6Mozz+fCE9xKcs7aMlaVVeHaGNaHuIFK3Jx3OiH Bx+8lR9V1dJtUTrw8oCGVaN8vDCq5EUnqUzQC24GAxBK0dvoBhDjKnYuUCrLcQl/wEcl cUJXNeNiwG/E1EFUsHtu3Qkzst/R98fzEoIjFzgpF5vOnbDkKGEMXIvgfsdSdD/BYWCw 8GGO3+Kk0ME7B6ZW4jEiqVW7p9Vp9K35MWdw+veM3Z34BK52O0rWPnCWD8JX5lXswVaU edjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=QvoP2f+nB/4FZFCRnx7s5l2cyw/nZg7tcWFs3fUsWM4=; b=ufF+H9IMxIQbvVzjSLOBglyv4UHLmxKzn7LvcYw1gqdvOYZGn0275TuISuClP5BzXt gl8KOB4ylAyuyIFyKB28xv0qqdjM3YLF32sMVNqiAAx9mWpabvRPlWaPwAy14ouoGLTE cnMV2jfCNIQaWTZYchoC/XLal+8G61e3dV3BOiPPm2ZrbmFre7H+W/SluNnk7t2Ha5nv +eESq/OGxk54opoSQL2gWpww0eQG7vwSj8bluz5jFro4xc0pXzgKoGA+hSHIV74u8CFF pIMptVyxOmL4YDOSbESTXhRSKVwwsxyuEuahKnaXhia2J/pENAS9Kl4vWzZH0La8lavs cuCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a5L4WKXb; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b14si13477357eju.424.2021.03.23.07.35.10; Tue, 23 Mar 2021 07:35:34 -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=@redhat.com header.s=mimecast20190719 header.b=a5L4WKXb; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232223AbhCWOeB (ORCPT + 99 others); Tue, 23 Mar 2021 10:34:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32926 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231718AbhCWOd2 (ORCPT ); Tue, 23 Mar 2021 10:33:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616510003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QvoP2f+nB/4FZFCRnx7s5l2cyw/nZg7tcWFs3fUsWM4=; b=a5L4WKXbQ5VhVLN2Oe4kEdgU/QLJDbuqv8RZp6g4RC5UDlTBJ7I6qY7w8ktsxXoiyH18ZC h6HmyggIGt4r+Z14Su3WdPWLqyeY9+cT/fwFKSeiyxDIxBWYat5CCpOBZiT6ep42CMl7ZY TcEQwTllDbbVXDlPgTDDPFklGamztQ4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-430-LQEUgcSuOYKYFPPElPHZ3Q-1; Tue, 23 Mar 2021 10:33:21 -0400 X-MC-Unique: LQEUgcSuOYKYFPPElPHZ3Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 655641B18BD3; Tue, 23 Mar 2021 14:33:17 +0000 (UTC) Received: from localhost (ovpn-13-5.pek2.redhat.com [10.72.13.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D41C1972B; Tue, 23 Mar 2021 14:33:06 +0000 (UTC) Date: Tue, 23 Mar 2021 22:33:03 +0800 From: Baoquan He To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Greg Kroah-Hartman , Dan Williams , Daniel Vetter , Andy Shevchenko , Mauro Carvalho Chehab , Dave Young , 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 1/3] kernel/resource: make walk_system_ram_res() find all busy IORESOURCE_SYSTEM_RAM resources Message-ID: <20210323143303.GC13786@MiWiFi-R3L-srv> References: <20210322160200.19633-1-david@redhat.com> <20210322160200.19633-2-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322160200.19633-2-david@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/22/21 at 05:01pm, David Hildenbrand wrote: > It used to be true that we can have busy system RAM only on the first level > in the resourc tree. However, this is no longer holds for driver-managed > system RAM (i.e., added via dax/kmem and virtio-mem), which gets added on > lower levels. > > We have two users of walk_system_ram_res(), which currently only > consideres the first level: > a) kernel/kexec_file.c:kexec_walk_resources() -- We properly skip > IORESOURCE_SYSRAM_DRIVER_MANAGED resources via > locate_mem_hole_callback(), so even after this change, we won't be > placing kexec images onto dax/kmem and virtio-mem added memory. No > change. > b) arch/x86/kernel/crash.c:fill_up_crash_elf_data() -- we're currently > not adding relevant ranges to the crash elf info, resulting in them > not getting dumped via kdump. > > This change fixes loading a crashkernel via kexec_file_load() and including > dax/kmem and virtio-mem added System RAM in the crashdump on x86-64. Note > that e.g,, arm64 relies on memblock data and, therefore, always considers > all added System RAM already. > > Let's find all busy IORESOURCE_SYSTEM_RAM resources, making the function > behave like walk_system_ram_range(). > > 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 627e61b0c124..4efd6e912279 100644 > --- a/kernel/resource.c > +++ b/kernel/resource.c > @@ -457,7 +457,7 @@ int walk_system_ram_res(u64 start, u64 end, void *arg, > { > unsigned long flags = IORESOURCE_SYSTEM_RAM | 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); Thanks, David, this is a good fix. Acked-by: Baoquan He > } > > -- > 2.29.2 >