From patchwork Fri Sep 23 22:05:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12987242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24780C6FA83 for ; Fri, 23 Sep 2022 22:06:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7783980025; Fri, 23 Sep 2022 18:06:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 726DC80016; Fri, 23 Sep 2022 18:06:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EE8780025; Fri, 23 Sep 2022 18:06:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4B7C780016 for ; Fri, 23 Sep 2022 18:06:01 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1BE2F1A0317 for ; Fri, 23 Sep 2022 22:06:01 +0000 (UTC) X-FDA: 79944733722.01.FD9BA5D Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by imf08.hostedemail.com (Postfix) with ESMTP id D424116001B for ; Fri, 23 Sep 2022 22:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663970759; x=1695506759; h=subject:from:to:cc:date:message-id:mime-version: content-transfer-encoding; bh=5RPs/JpeWjIw9SBDcGjffvbJdKw3Fxq8yxwf7Ewx05M=; b=K8MapA4mUJ6l2cHJyvCC3b94rEDj0j9QjijeSJUq6Y1Hn9KNR5DfScFe MmIeYZP+bTAyhvK8fyRWpDroxtWYd54jlZEynkw6eGPhVK0mlO83aquBV 9swVDrb2aq4GUhwg3Z834kHKpZbl4JfSxMvVJwdD2Cr7F8XsCagXNzo2i gPLEgSIQGtpaVffsC2fiRAOQrAJ2OdkG9iMLkULzpHk0mxFQP/y4Zq0Ju 7D+NV0ueVHALMaGCRHrWWDmqLnM/lQfsEML+uELz4l24gYH9BM2RXlk/z 564Eaf9tVPACXj+/FqLA6NVV7H6d113nGX4hzXFXNB+SwlF3b9fQFsMT2 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10479"; a="362524643" X-IronPort-AV: E=Sophos;i="5.93,340,1654585200"; d="scan'208";a="362524643" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 15:05:57 -0700 X-IronPort-AV: E=Sophos;i="5.93,340,1654585200"; d="scan'208";a="795663612" Received: from tsellis-mobl.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.209.14.35]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 15:05:57 -0700 Subject: [PATCH] devdax: Fix soft-reservation memory description From: Dan Williams To: nvdimm@lists.linux.dev Cc: Ricardo Sandoval Torres , Ricardo Sandoval Torres , stable@vger.kernel.org, Tony Luck , Omar Avelar , "Rafael J. Wysocki" , Mark Gross , linux-mm@kvack.org Date: Fri, 23 Sep 2022 15:05:56 -0700 Message-ID: <166397075670.389916.7435722208896316387.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663970759; a=rsa-sha256; cv=none; b=vfs7MI+V45atPZYxVgwQy3UmsNnn8YbaLZ6P0G0neJ4ai+soZn5OqqcnS39xje+xFtAqMH sPXaZLCVpF09ZtiUk+74LxdXn0g7c7WVFNyAzoXKj1nA+ktyAcmGi58GOJz8Igq7nIMAsr XGjQJSEI8bzBk91VYTm6xskIhN0GKC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663970759; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=k54i2tn8lq4IH4AEbZwoXncJOWFOJTrEfB+ikPUSTuo=; b=xtc7st1h5MmYzSs2WAWO14zDV/e+2cn7kNTgdnxW7J8VWK2NGuyCXrsfOejS/fNlpjio2z YnUEfwcnXMiGeEWuW1pU8QcKbATBwTuln9xXwlEmeNQMLbKX7EK1VYIliRuzHHmgHAA8XN LtugbSUiLREiQlVPMeZv4l6dgrrFrtc= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=K8MapA4m; spf=pass (imf08.hostedemail.com: domain of dan.j.williams@intel.com designates 134.134.136.31 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Stat-Signature: p68pp9pja44sqgf9aagc9yt8qwcbhmmf X-Rspamd-Queue-Id: D424116001B Authentication-Results: imf08.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=K8MapA4m; spf=pass (imf08.hostedemail.com: domain of dan.j.williams@intel.com designates 134.134.136.31 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam02 X-Rspam-User: X-HE-Tag: 1663970758-458763 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: The "hmem" platform-devices that are created to represent the platform-advertised "Soft Reserved" memory ranges end up inserting a resource that causes the iomem_resource tree to look like this: 340000000-43fffffff : hmem.0 340000000-43fffffff : Soft Reserved 340000000-43fffffff : dax0.0 This is because insert_resource() reparents ranges when they completely intersect an existing range. This matters because code that uses region_intersects() to scan for a given IORES_DESC will only check that top-level 'hmem.0' resource and not the 'Soft Reserved' descendant. So, to support EINJ (via einj_error_inject()) to inject errors into memory hosted by a dax-device, be sure to describe the memory as IORES_DESC_SOFT_RESERVED. This is a follow-on to: commit b13a3e5fd40b ("ACPI: APEI: Fix _EINJ vs EFI_MEMORY_SP") ...that fixed EINJ support for "Soft Reserved" ranges in the first instance. Fixes: 262b45ae3ab4 ("x86/efi: EFI soft reservation to E820 enumeration") Reported-by: Ricardo Sandoval Torres Tested-by: Ricardo Sandoval Torres Cc: Cc: Tony Luck Cc: Omar Avelar Cc: Rafael J. Wysocki Cc: Mark Gross Signed-off-by: Dan Williams --- drivers/dax/hmem/device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dax/hmem/device.c b/drivers/dax/hmem/device.c index cb6401c9e9a4..acf31cc1dbcc 100644 --- a/drivers/dax/hmem/device.c +++ b/drivers/dax/hmem/device.c @@ -15,6 +15,7 @@ void hmem_register_device(int target_nid, struct resource *r) .start = r->start, .end = r->end, .flags = IORESOURCE_MEM, + .desc = IORES_DESC_SOFT_RESERVED, }; struct platform_device *pdev; struct memregion_info info;