[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220301121419-mutt-send-email-mst@kernel.org>
Date: Tue, 1 Mar 2022 12:17:33 -0500
From: "Michael S. Tsirkin" <mst@...hat.com>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: Laszlo Ersek <lersek@...hat.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, qemu-devel@...gnu.org,
linux-hyperv@...r.kernel.org, linux-crypto@...r.kernel.org,
graf@...zon.com, mikelley@...rosoft.com,
gregkh@...uxfoundation.org, adrian@...ity.io, berrange@...hat.com,
linux@...inikbrodowski.net, jannh@...gle.com, rafael@...nel.org,
len.brown@...el.com, pavel@....cz, linux-pm@...r.kernel.org,
colmmacc@...zon.com, tytso@....edu, arnd@...db.de
Subject: Re: propagating vmgenid outward and upward
On Tue, Mar 01, 2022 at 05:28:48PM +0100, Jason A. Donenfeld wrote:
> Hi Laszlo,
>
> On Tue, Mar 01, 2022 at 05:15:21PM +0100, Laszlo Ersek wrote:
> > > If we had a "pull" model, rather than just expose a 16-byte unique
> > > identifier, the vmgenid virtual hardware would _also_ expose a
> > > word-sized generation counter, which would be incremented every time the
> > > unique ID changed. Then, every time we would touch the RNG, we'd simply
> > > do an inexpensive check of this memremap()'d integer, and reinitialize
> > > with the unique ID if the integer changed.
> >
> > Does the vmgenid spec (as-is) preclude the use of the 16-byte identifier
> > like this?
> >
> > After all, once you locate the identifier via the ADDR object, you could
> > perhaps consult it every time you were about to touch the RNG.
>
> No, you could in fact do this, and there'd be nothing wrong with that
> from a spec perspective. You could even vDSO it all the way through
> onward to userspace. However, doing a 16-byte atomic memcmp on
> each-and-every packet is really a non-starter. For that kind of "check
> it in the hot path" thing to be viable, you really want it to be a
> counter that is word-sized. The "pull"-model involves pulling on every
> single packet in order to be better than the "push"-model. Anyway, even
> with a word-sized counter, it's unclear whether the costs of checking on
> every packet would be worth it to everyone, but at least it's more
> tenable than a 16-byte whammy.
>
> Jason
Hmm okay, so it's a performance optimization... some batching then? Do
you really need to worry about every packet? Every 64 packets not
enough? Packets are after all queued at NICs etc, and VM fork can
happen after they leave wireguard ...
--
MST
Powered by blists - more mailing lists