From: David Hildenbrand <david@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Miles Chen <miles.chen@mediatek.com>,
wsd_upstream@mediatek.com, Joerg Roedel <joro@8bytes.org>,
linux-kernel@vger.kernel.org, Chao Hao <chao.hao@mediatek.com>,
iommu@lists.linux-foundation.org,
linux-mediatek@lists.infradead.org,
Yong Wu <yong.wu@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
yingjoe.chen@mediatek.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] iommu/mediatek: Use totalram_pages to setup enable_4GB
Date: Fri, 5 Jun 2020 14:52:32 +0200 [thread overview]
Message-ID: <59531654-a1fd-09cf-bb33-ae3fe5363298@redhat.com> (raw)
In-Reply-To: <f62c9623-bf5c-6fdb-afa5-9ff04c8fde70@redhat.com>
On 04.06.20 17:27, David Hildenbrand wrote:
> On 04.06.20 17:06, Christoph Hellwig wrote:
>> On Thu, Jun 04, 2020 at 01:32:40PM +0200, David Hildenbrand wrote:
>>> Just a thought: If memory hotplug is applicable as well, you might
>>> either want to always assume data->enable_4GB, or handle memory hotplug
>>> events from the memory notifier, when new memory gets onlined (not sure
>>> how tricky that is).
>>
>> We probably want a highest_pfn_possible() or similar API instead of
>> having drivers poking into random VM internals.
>
> Well, memory notifiers are a reasonable api used accross the kernel to
> get notified when new memory is onlined to the buddy that could be used
> for allocations.
>
> highest_pfn_possible() would have to default to something linked to
> MAX_PHYSMEM_BITS whenever memory hotplug is configured, I am not sure
> how helpful that is (IOW, you can just default to enable_4GB=true in
> that case instead in most cases).
Correction: At least on x86-64 we have max_possible_pfn, which will
consult the ACPI SRAT table to figure out the maximum possible PFN.
(Without SRAT, max_possible_pfn will point at the end of initial boot
memory and not consider hotplug memory - something that e.g., newer QEMU
versions work around by creating SRAT tables if memory hotplug might be
possible, even if there is no actual NUMA configuration).
pci-swiotlb.c similarly relies on that to figure out if there are any
!DMA addresses to handle.
--
Thanks,
David / dhildenb
prev parent reply other threads:[~2020-06-05 12:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-04 8:01 [PATCH] iommu/mediatek: Use totalram_pages to setup enable_4GB Miles Chen
2020-06-04 8:25 ` David Hildenbrand
2020-06-04 9:49 ` Miles Chen
2020-06-04 11:32 ` David Hildenbrand
2020-06-04 15:06 ` Christoph Hellwig
2020-06-04 15:27 ` David Hildenbrand
2020-06-05 12:52 ` David Hildenbrand [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=59531654-a1fd-09cf-bb33-ae3fe5363298@redhat.com \
--to=david@redhat.com \
--cc=chao.hao@mediatek.com \
--cc=hch@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=miles.chen@mediatek.com \
--cc=wsd_upstream@mediatek.com \
--cc=yingjoe.chen@mediatek.com \
--cc=yong.wu@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).