From patchwork Mon Mar 22 16:01:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 12155329 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 735C3C433E0 for ; Mon, 22 Mar 2021 16:02:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 170646198D for ; Mon, 22 Mar 2021 16:02:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 170646198D 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 0699D6B00E5; Mon, 22 Mar 2021 11:43:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0406E6B00E6; Mon, 22 Mar 2021 11:43:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E23FA6B00E7; Mon, 22 Mar 2021 11:43:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0079.hostedemail.com [216.40.44.79]) by kanga.kvack.org (Postfix) with ESMTP id C868D6B00E5 for ; Mon, 22 Mar 2021 11:43:54 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3738F5DD8 for ; Mon, 22 Mar 2021 16:02:45 +0000 (UTC) X-FDA: 77947978290.05.56D1EC6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 1CE80E007A4B for ; Mon, 22 Mar 2021 16:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616428944; 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=W0IDIfX6AJuXdpUONxZchTMRUur8djK38Sbs7ocWmH4=; b=EA/xubv4Abk7uDEXB7xrmHgLVH3WtnVQt6U9j0qOxeF/kyGEIsJf3N/sNBzz04AD9zs/9Q ukqAdaj6QHf1naaPf/Qg2NFpr3aWTpLnb3DYZ8i71dYW3mlUTOxfTh0ScvuDKqyoALmrdO /VI+gr8sgGheRo+kBGElr7An7duQ/5A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616428956; 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=W0IDIfX6AJuXdpUONxZchTMRUur8djK38Sbs7ocWmH4=; b=iGlbbgcRzEDu7oNWrlHe60NUMxZmumjC9UfxfG8mU3l6AAMaB7pjYv60uef15UMCJ0wVx7 RvxQC0WtU8nhPV6BgHztvpEBfiIl0LM0Mdwz00TlzqPuUCiYy5dwNdh7nb1yLNWabqGgMx AMG28/l7W4Gag0YCTNG688rXo44oxqQ= 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-319-voatCJxPPuOKF6jAy4Xecw-1; Mon, 22 Mar 2021 12:02:20 -0400 X-MC-Unique: voatCJxPPuOKF6jAy4Xecw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6725C81746C; Mon, 22 Mar 2021 16:02:16 +0000 (UTC) Received: from t480s.redhat.com (ovpn-115-54.ams2.redhat.com [10.36.115.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E5752C15A; Mon, 22 Mar 2021 16:02:01 +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 v1 0/3] kernel/resource: make walk_system_ram_res() and walk_mem_res() search the whole tree Date: Mon, 22 Mar 2021 17:01:57 +0100 Message-Id: <20210322160200.19633-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Stat-Signature: mtt1eigh4wokmp6yypxhkqjtuoh37e6q X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1CE80E007A4B Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf13; 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: 1616428959-504187 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. Against next-20210322. 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(-)