Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3553279pxf; Mon, 22 Mar 2021 09:04:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwy3zVDRzAqCxktQh0ixmnMmvCKnnAupPZSDV9792Y2vbtVjkZWjBhO1t2R8WqYUYMZMui6 X-Received: by 2002:a17:906:2e45:: with SMTP id r5mr497775eji.380.1616429084870; Mon, 22 Mar 2021 09:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616429084; cv=none; d=google.com; s=arc-20160816; b=SiCXwRCwW4Ie/5ELwCI8KhjeTwKrZosJM9+neyyovESefyWw3gXb87UQM19dE4FTWj BSVy+oVFgrfbflh/pKy3PetsfGr9kOweVJENMxWr9OihqSuyUm9kcHxiTXGAcFniaDNZ snCwA4/P4ucQbKz/PBBnQW2g2MlX1QxL8dfo757sw8Er09WC7qzs5C2/LcQRpKSPQ4TL y4cTczhwRWzwHmsv5TbucKBtzsdGsLvSXvnljgIoBQd4Yzkenq2bxFV9lGDxz41Z59jZ D78B1LFdrPbGVgs2XQojv0Vqi/uatL9/i2d1AqIc6XoJVl62Diws9k82Yo0Rumfbt6Qn GY1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OgSSnWKGscYsapR0+NLAGjTG3+Bg1qLlRc5vidLzwP0=; b=fwjYBWUosboS/03QV3QWDUsGwtuBinDUk4m78By7UX2XX5yS6g3w0iG5B2TcZQeneR tQJ0qYBjX+NeDMW/uwlq3/F5hPxc1DOOuRQwfrc7rddavPbDcNZVdFqcGqqru8sSUVlo ppVmcZX0JeNezHHy2NpGSHsHVkLVlkhLs5ETBTGpPv7+ZbNhSSFTv/MqjJxRpiZx6NNI SuFUss4bXoAg0hozmgMuTa9jhxEnZZHcOgR26EH9t42U+aJzQOLfwEsOlqYUgWJw1QCR wD4nHQLoqpFKZ280emFptTbTIVmvBgZOTTQYJJ39D5cn1BsKsFy4DAhw86EEYaKJe+dy /uMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="UCK7Wbu/"; 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 c13si11821179eje.45.2021.03.22.09.04.22; Mon, 22 Mar 2021 09:04:44 -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="UCK7Wbu/"; 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 S230511AbhCVQDB (ORCPT + 99 others); Mon, 22 Mar 2021 12:03:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39164 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230196AbhCVQCo (ORCPT ); Mon, 22 Mar 2021 12:02:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616428964; 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: in-reply-to:in-reply-to:references:references; bh=OgSSnWKGscYsapR0+NLAGjTG3+Bg1qLlRc5vidLzwP0=; b=UCK7Wbu/+uf7J4JbXOfxMnHByiIvo4d8qscteGJNfMwNFe53jyZSBhtw+4snI03MIvkdTw L3NwIMgbDvkyERkj7ieEdwL0hGsC5VQ6vV6xZJt/+Rigs+OQZphWSG/meJKhNGkI0/Dmyg Y/A6Xop7otxqwZUy/jwfIMGaDOeeHtE= 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-147-Sn3hzdKdM_-yFzw8dtSnqg-1; Mon, 22 Mar 2021 12:02:39 -0400 X-MC-Unique: Sn3hzdKdM_-yFzw8dtSnqg-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 E1327107B768; Mon, 22 Mar 2021 16:02:36 +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 832E15946C; Mon, 22 Mar 2021 16:02:22 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Greg Kroah-Hartman , Dan Williams , Daniel Vetter , Andy Shevchenko , 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: [PATCH v1 2/3] kernel/resource: make walk_mem_res() find all busy IORESOURCE_MEM resources Date: Mon, 22 Mar 2021 17:01:59 +0100 Message-Id: <20210322160200.19633-3-david@redhat.com> In-Reply-To: <20210322160200.19633-1-david@redhat.com> References: <20210322160200.19633-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). 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