From patchwork Thu Mar 25 11:53:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 12163883 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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 BBA17C433DB for ; Thu, 25 Mar 2021 11:53:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 46EFB619EE for ; Thu, 25 Mar 2021 11:53:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46EFB619EE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CA7A26B0078; Thu, 25 Mar 2021 07:53:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C57436B007B; Thu, 25 Mar 2021 07:53:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD17E6B007D; Thu, 25 Mar 2021 07:53:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 91EB36B0078 for ; Thu, 25 Mar 2021 07:53:50 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4D1A480E5D92 for ; Thu, 25 Mar 2021 11:53:50 +0000 (UTC) X-FDA: 77958237420.10.88D4640 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf24.hostedemail.com (Postfix) with ESMTP id B9DBCA000245 for ; Thu, 25 Mar 2021 11:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616673229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=OKm/yMe9JPqkg6bnMU/NOUh68uziwvUbg4w2huISSCU=; b=h61kaHWzfdsmi2kF2GBYKQhrA5VHzZ5OXfSsGi46qqBsGh41FfdCO/S9IHWcLpWhWGgQ5a tAuCka/kIonmE1j3CChKCATMaXPKmMvE8izWOD9048KFPXFWzVXy4jMUQDz2kOm1OQDAR/ ZeQaREbLV6BaLxVbMWHOa23j7NVOw2w= 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-541-q4xul75oP0-WnyZJqub_zw-1; Thu, 25 Mar 2021 07:53:45 -0400 X-MC-Unique: q4xul75oP0-WnyZJqub_zw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 067BE81620; Thu, 25 Mar 2021 11:53:42 +0000 (UTC) Received: from t480s.redhat.com (ovpn-115-72.ams2.redhat.com [10.36.115.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7007860855; Thu, 25 Mar 2021 11:53:27 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Andy Shevchenko , Baoquan He , Borislav Petkov , Brijesh Singh , Daniel Vetter , Dan Williams , Dave Hansen , Dave Young , Eric Biederman , Greg Kroah-Hartman , "H. Peter Anvin" , Ingo Molnar , Keith Busch , Mauro Carvalho Chehab , Michal Hocko , Oscar Salvador , Qian Cai , Thomas Gleixner , Tom Lendacky , Vivek Goyal Subject: [PATCH v2 0/3] kernel/resource: make walk_system_ram_res() and walk_mem_res() search the whole tree Date: Thu, 25 Mar 2021 12:53:23 +0100 Message-Id: <20210325115326.7826-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Stat-Signature: jgdaobg74gmxznstc1e4gkfcycr5s55q X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B9DBCA000245 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=216.205.24.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616673227-231582 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: Playing with kdump+virtio-mem I noticed that kexec_file_load() does not consider System RAM added via dax/kmem and virtio-mem when preparing the elf header for kdump. Looking into the details, the logic used in walk_system_ram_res() and walk_mem_res() seems to be outdated. walk_system_ram_range() already does the right thing, let's change walk_system_ram_res() and walk_mem_res(), and clean up. Loading a kdump kernel via "kexec -p -s" ... will result in the kdump kernel to also dump dax/kmem and virtio-mem added System RAM now. Note: kexec-tools on x86-64 also have to be updated to consider this memory in the kexec_load() case when processing /proc/iomem. v1 -> v2: - Added fixes tags to patch #1 and #2 - Refined the patch descriptions - Added acks/rbs David Hildenbrand (3): kernel/resource: make walk_system_ram_res() find all busy IORESOURCE_SYSTEM_RAM resources kernel/resource: make walk_mem_res() find all busy IORESOURCE_MEM resources kernel/resource: remove first_lvl / siblings_only logic kernel/resource.c | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) base-commit: 0d02ec6b3136c73c09e7859f0d0e4e2c4c07b49b