From: Juergen Gross <jgross@suse.com>
To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
"Christoph Hellwig" <hch@lst.de>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Ben Skeggs <bskeggs@redhat.com>,
Karol Herbst <kherbst@redhat.com>, Lyude Paul <lyude@redhat.com>,
xen-devel@lists.xenproject.org, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org
Subject: Re: [PATCH 2/4] x86: always initialize xen-swiotlb when xen-pcifront is enabling
Date: Mon, 22 May 2023 10:37:09 +0200 [thread overview]
Message-ID: <c5defff8-882e-3482-0de1-e50a4bcdfa99@suse.com> (raw)
In-Reply-To: <ZGdLErBzi9MANL3i@mail-itl>
[-- Attachment #1.1.1: Type: text/plain, Size: 2175 bytes --]
On 19.05.23 12:10, Marek Marczykowski-Górecki wrote:
> On Fri, May 19, 2023 at 06:04:05AM +0200, Christoph Hellwig wrote:
>> On Thu, May 18, 2023 at 08:18:39PM +0200, Marek Marczykowski-Górecki wrote:
>>> On Thu, May 18, 2023 at 03:42:51PM +0200, Christoph Hellwig wrote:
>>>> Remove the dangerous late initialization of xen-swiotlb in
>>>> pci_xen_swiotlb_init_late and instead just always initialize
>>>> xen-swiotlb in the boot code if CONFIG_XEN_PCIDEV_FRONTEND is enabled.
>>>>
>>>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>>>
>>> Doesn't it mean all the PV guests will basically waste 64MB of RAM
>>> by default each if they don't really have PCI devices?
>>
>> If CONFIG_XEN_PCIDEV_FRONTEND is enabled, and the kernel's isn't booted
>> with swiotlb=noforce, yes.
>
> That's "a bit" unfortunate, since that might be significant part of the
> VM memory, or if you have a lot of VMs, a significant part of the host
> memory - it quickly adds up.
> While I would say PCI passthrough is not very common for PV guests, can
> the decision about xen-swiotlb be delayed until you can enumerate
> xenstore to check if there are any PCI devices connected (and not
> allocate xen-swiotlb by default if there are none)? This would
> still not cover the hotplug case (in which case, you'd need to force it
> with a cmdline), but at least you wouldn't loose much memory just
> because one of your VMs may use PCI passthrough (so, you have it enabled
> in your kernel).
> Please remember that guest kernel is not always under full control of
> the host admin, so making guests loose 64MB of RAM always, in default
> setup isn't good for customers of such VMs...
>
In normal cases PCI passthrough in PV guests requires to start the guest
with e820_host=1. So it should be rather easy to limit allocating the
64MB in PV guests to the cases where the memory map has non-RAM regions
especially in the first 1MB of the memory.
This will cover even hotplug cases. The only case not covered would be a
guest started with e820_host=1 even if no PCI passthrough was planned.
But this should be rather rare (at least I hope so).
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
next prev parent reply other threads:[~2023-05-22 8:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 13:42 unexport swiotlb_active Christoph Hellwig
2023-05-18 13:42 ` [PATCH 1/4] x86: move a check out of pci_xen_swiotlb_init Christoph Hellwig
2023-05-18 13:42 ` [PATCH 2/4] x86: always initialize xen-swiotlb when xen-pcifront is enabling Christoph Hellwig
2023-05-18 18:18 ` Marek Marczykowski-Górecki
2023-05-19 4:04 ` Christoph Hellwig
2023-05-19 10:10 ` Marek Marczykowski-Górecki
2023-05-19 12:41 ` Christoph Hellwig
2023-05-19 12:49 ` Andrew Cooper
2023-05-19 12:58 ` Christoph Hellwig
2023-05-20 6:21 ` Christoph Hellwig
2023-05-22 7:52 ` Petr Tesařík
2023-05-22 7:54 ` Petr Tesařík
2023-05-22 8:37 ` Juergen Gross [this message]
2023-06-07 13:12 ` Christoph Hellwig
2023-06-09 15:38 ` Juergen Gross
2023-06-12 6:47 ` Christoph Hellwig
2023-06-12 8:08 ` Juergen Gross
2023-06-12 8:23 ` Christoph Hellwig
2023-05-18 13:42 ` [PATCH 3/4] drm/nouveau: stop using is_swiotlb_active Christoph Hellwig
2023-05-18 20:30 ` Lyude Paul
2023-06-07 13:11 ` Christoph Hellwig
2023-05-18 13:42 ` [PATCH 4/4] swiotlb: unexport is_swiotlb_active Christoph Hellwig
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=c5defff8-882e-3482-0de1-e50a4bcdfa99@suse.com \
--to=jgross@suse.com \
--cc=bp@alien8.de \
--cc=bskeggs@redhat.com \
--cc=dave.hansen@linux.intel.com \
--cc=hch@lst.de \
--cc=hpa@zytor.com \
--cc=iommu@lists.linux.dev \
--cc=kherbst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=marmarek@invisiblethingslab.com \
--cc=mingo@redhat.com \
--cc=nouveau@lists.freedesktop.org \
--cc=sstabellini@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).