Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1644925imu; Thu, 17 Jan 2019 00:36:16 -0800 (PST) X-Google-Smtp-Source: ALg8bN4qRXxqhZWe1DC0PKfpyiyEj+2SEnMNfFNs1ZDoY4ngiCIfXoHU5e/R1/G2BilCbRPOZTTH X-Received: by 2002:a17:902:66e6:: with SMTP id e93mr13815143plk.92.1547714176228; Thu, 17 Jan 2019 00:36:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547714176; cv=none; d=google.com; s=arc-20160816; b=hbJcLXKhToK57LFkyTMdocOfb8bJ0xFZmuWWjPhEqF+aOkty51KKwQUkcEVTh2FyJ/ HbgprWBggVj0XW8L+xGK/KiriH5ozMhhFXdbJ/iguRxmd41/DkTBbBwj38VgT5jD/Aan 8+mPUpbrZKzFnS9pW5eOhQNyXaIpsdFU4OTwLYnwAsSHQqDS82VtYe+k4WvDb6kk/Yqm kpg5GuTA+794zRFZb8hOu1fdJhlo9qgUqV+5AgdkPNXVakJW25A1VyVt86v/96Ydu6Fa 56W7paZSwLvfcaoOuth7s9KRGwyTvyAy9Rnm4tzS/I86HFwD2lmVC3kqCmSyNlXM1Nva z6Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=4E0LvuYgyt7lR8/ylu7ccyn1ZKGOjrpEXjzZ+GqkCSs=; b=pgBsEJnVKhrltizzqLK8Sid4+9sM7upSS2Jwj7/haQH60grINUrXmtnS/6bR7U8HPj YXuaZMzKGSX7GG3Qh5TSBHQwzk2e+ejFJcjEOPIpWf7sQ7KWVIn4goNOOw4oTbBqaOeW Kk69wx5bxWR4gybH+YTUGYWMrUInM5H/Z2D6FFSQMQchBhV9rfKCxSeKnJjpzy1Ds6Zk Cz+QM5trOPfxIoyNYYMdj9sjJp9GgyRPmC8nZS380XHjjdYQQ/QL8ULaeAS65+8u2AWO TGoXY29fXwBC4EahLJNHHPFKaz37uqSdhMXiEPk5B8wgwyow91q+hqv7DyXMJ3+MggD9 MqGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m15si1021287pgc.381.2019.01.17.00.36.00; Thu, 17 Jan 2019 00:36:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727554AbfAPXiz (ORCPT + 99 others); Wed, 16 Jan 2019 18:38:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51608 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727529AbfAPXiz (ORCPT ); Wed, 16 Jan 2019 18:38:55 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D45912E3; Wed, 16 Jan 2019 23:38:54 +0000 (UTC) Received: from redhat.com (ovpn-122-22.rdu2.redhat.com [10.10.122.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DDC9760BF1; Wed, 16 Jan 2019 23:38:51 +0000 (UTC) Date: Wed, 16 Jan 2019 18:38:50 -0500 From: Jerome Glisse To: Dave Hansen Cc: Dave Hansen , dave@sr71.net, dan.j.williams@intel.com, dave.jiang@intel.com, zwisler@kernel.org, vishal.l.verma@intel.com, thomas.lendacky@amd.com, akpm@linux-foundation.org, mhocko@suse.com, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ying.huang@intel.com, fengguang.wu@intel.com, bp@suse.de, bhelgaas@google.com, baiyaowei@cmss.chinamobile.com, tiwai@suse.de Subject: Re: [PATCH 2/4] mm/memory-hotplug: allow memory resources to be children Message-ID: <20190116233849.GE3617@redhat.com> References: <20190116181859.D1504459@viggo.jf.intel.com> <20190116181902.670EEBC3@viggo.jf.intel.com> <20190116191635.GD3617@redhat.com> <2b52778d-f120-eec7-3e7a-3a9c182170f0@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2b52778d-f120-eec7-3e7a-3a9c182170f0@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 16 Jan 2019 23:38:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 16, 2019 at 03:01:39PM -0800, Dave Hansen wrote: > On 1/16/19 11:16 AM, Jerome Glisse wrote: > >> We also rework the old error message a bit since we do not get > >> the conflicting entry back: only an indication that we *had* a > >> conflict. > > We should keep the device private check (moving it in __request_region) > > as device private can try to register un-use physical address (un-use > > at time of device private registration) that latter can block valid > > physical address the error message you are removing report such event. > > If a resource can't support having a child, shouldn't it just be marked > IORESOURCE_BUSY, rather than trying to somehow special-case > IORES_DESC_DEVICE_PRIVATE_MEMORY behavior? So the thing about IORES_DESC_DEVICE_PRIVATE_MEMORY is that they are not necessarily link to any real resource ie they can just be random range of physical address that at the time of registration had no resource. Now you can latter hotplug some memory that would conflict with this IORES_DESC_DEVICE_PRIVATE_MEMORY and if that happens we want to tell that to the user ie: "Sorry we registered some fake memory at fake physical address and now you have hotplug something that conflict with that." Why no existing resource ? Well it depends on the platform. In some case memory for HMM is just not accessible by the CPU _at_ all so there is obviously no physical address from CPU point of view for this kind of memory. The other case is PCIE and BAR size. If we have PCIE bar resizing working everywhere we could potentialy use the resized PCIE bar (thought i think some device have bug on that front so i need to check device side too). So when HMM was design without the PCIE resize and with totaly un-accessible memory the only option was to pick some unuse physical address range as anyway memory we are hotpluging is not CPU accessible. It has been on my TODO to try to find a better way to reserve a physical range but this is highly platform specific. I need to investigate if i can report to ACPI on x86 that i want to make sure the system never assign some physical address range. Checking PCIE bar resize is also on my TODO (on device side as i think some device are just buggy there and won't accept BAR bigger than 256MB and freakout if you try). So right now i would rather that we keep properly reporting this hazard so that at least we know it failed because of that. This also include making sure that we can not register private memory as a child of an un-busy resource that does exist but might not have yet been claim by its rightful owner. Existing code make sure of that, with your change this is a case that i would not be able to stop. Well i would have to hot unplug and try a different physical address i guess. Cheers, J?r?me