Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3037962pxb; Tue, 12 Jan 2021 05:00:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJyl1j2ike5lPZcziyPDTAnzUDOQQJUZu1mdq+7RN2aaRbU/t4E6Hr4pXzxcS5L6wxAPc2gw X-Received: by 2002:a17:906:3711:: with SMTP id d17mr3066199ejc.121.1610456427476; Tue, 12 Jan 2021 05:00:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610456427; cv=none; d=google.com; s=arc-20160816; b=k2Lsv+Nzzw841ir1Jf7056TR3R4+21NZy1qATFrJqWM6sXuirRk17N+8R+W4I8IOVY 0vmFXTgEkVg67EwbevYZho/LYYONU2YNQKphFdv7PVlNdqtqF0Q22ZT9e76nX6KzjOIZ pQ1qjSBO7M8p7XU8TM06OaVdQy7JI6/4R1NZgyNDClDzstBuYfIiYNjBlVluWl7gQ8W/ hFlx+EtH1LVLgIvD/CCbOCfUkZSqUVR+snS+0f+mqDAtMK3t2cXvrKbE45uTjH9v43j/ ccVksfeH2y+pxAxCz5smRCk2b3D5JVXUeiY+51iKqOJYDsW1dlQHV2naeeIUTYEfcNdd 7zTg== 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; bh=Q5QLMJfuqq4rmTBzohdrsyX0S7aB10pibCTBJ/bMQtk=; b=CjXCacrs3hVmey9o5HO4/D/UI8/udLCz5DJPqZn9o2neduKbWCIKEIy0ahgHd3cRcx t8wepWNFTH1vgLJgGEqqSm2Zr08eGNdBb8jhzCA2wY40dCdmCkasm0N2xd65fUYBGqjz uSzeO9Z4QLWaXTZy8+WianGbERxvpxtdHnRboVtDI3FlWCsru4Z7xfEGVnx2mqMfsWBE dg5q5M/73b9IM+ejrHuAxm81KTvB9cxOCCytIh7C04KO6OyDI7kf+OW2Oxsa68usKj5v mfeFsfd+jjBokFzZz2MQnB8620bxFnaK1GC/w0u5aPCLmZ5lRfF/XV9xV8gEAoCDx8uR leBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz13si1105795ejc.437.2021.01.12.05.00.03; Tue, 12 Jan 2021 05:00:27 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728096AbhALLBM (ORCPT + 99 others); Tue, 12 Jan 2021 06:01:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:55310 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbhALLBM (ORCPT ); Tue, 12 Jan 2021 06:01:12 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1D567AD18; Tue, 12 Jan 2021 11:00:31 +0000 (UTC) Date: Tue, 12 Jan 2021 12:00:28 +0100 From: Oscar Salvador To: Dan Williams Cc: linux-mm@kvack.org, Andrew Morton , Michal Hocko , David Hildenbrand , vishal.l.verma@intel.com, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/5] mm: Teach pfn_to_online_page() about ZONE_DEVICE section collisions Message-ID: <20210112110028.GB12956@linux> References: <161044407603.1482714.16630477578392768273.stgit@dwillia2-desk3.amr.corp.intel.com> <161044409294.1482714.434561066315039753.stgit@dwillia2-desk3.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <161044409294.1482714.434561066315039753.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 12, 2021 at 01:34:53AM -0800, Dan Williams wrote: > While pfn_to_online_page() is able to determine pfn_valid() at > subsection granularity it is not able to reliably determine if a given > pfn is also online if the section is mixes ZONE_{NORMAL,MOVABLE} with > ZONE_DEVICE. This means that pfn_to_online_page() may return invalid > @page objects. For example with a memory map like: > > 100000000-1fbffffff : System RAM > 142000000-143002e16 : Kernel code > 143200000-143713fff : Kernel rodata > 143800000-143b15b7f : Kernel data > 144227000-144ffffff : Kernel bss > 1fc000000-2fbffffff : Persistent Memory (legacy) > 1fc000000-2fbffffff : namespace0.0 > > This command: > > echo 0x1fc000000 > /sys/devices/system/memory/soft_offline_page > > ...succeeds when it should fail. When it succeeds it touches > an uninitialized page and may crash or cause other damage (see > dissolve_free_huge_page()). [...] > Because the collision case is rare, and for simplicity, the > SECTION_TAINT_ZONE_DEVICE flag is never cleared once set. > > Fixes: ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug") > Cc: Andrew Morton > Reported-by: Michal Hocko > Reported-by: David Hildenbrand > Signed-off-by: Dan Williams Reviewed-by: Oscar Salvador -- Oscar Salvador SUSE L3