From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: Gregory Price <gregory.price@memverge.com>
Cc: zhiting zhu <zhitingz@cs.utexas.edu>, <qemu-devel@nongnu.org>,
<linux-cxl@vger.kernel.org>,
Viacheslav A.Dubeyko <viacheslav.dubeyko@bytedance.com>
Subject: Re: CXL 2.0 memory pooling emulation
Date: Thu, 16 Feb 2023 18:00:57 +0000 [thread overview]
Message-ID: <20230216180057.00006c49@huawei.com> (raw)
In-Reply-To: <Y+yhfFaQ4Kky93mc@memverge.com>
On Wed, 15 Feb 2023 04:10:20 -0500
Gregory Price <gregory.price@memverge.com> wrote:
> On Wed, Feb 15, 2023 at 03:18:54PM +0000, Jonathan Cameron via wrote:
> > On Wed, 8 Feb 2023 16:28:44 -0600
> > zhiting zhu <zhitingz@cs.utexas.edu> wrote:
> >
> > > Hi,
> > >
> > > I saw a PoC:
> > > https://lore.kernel.org/qemu-devel/20220525121422.00003a84@Huawei.com/T/ to
> > > implement memory pooling and fabric manager on qemu. Is there any further
> > > development on this? Can qemu emulate a memory pooling on a simple case
> > > that two virtual machines connected to a CXL switch where some memory
> > > devices are attached to?
> > >
> > > Best,
> > > Zhiting
> > [... snip ...]
> >
> > Note though that there is a long way to go before we can do what you
> > want. The steps I'd expect to see along the way:
> >
> > 1) Emulate an Multi Headed Device.
> > Initially connect two heads to different host bridges on a single QEMU
> > machine. That lets us test most of the code flows without needing
> > to handle tests that involve multiple machines.
> > Later, we could add a means to connect between two instances of QEMU.
>
> I've been playing with this a bit.
>
> Hackiest way to do this is to connect the same memory backend to two
> type-3 devices, with the obvious caveat that the device state will not
> be consistent between views.
>
> But we could, for example, just put the relevant shared state into an
> optional shared memory area instead of a normally allocated region.
>
> i can imagine this looking something like
>
> memory-backend-file,id=mem0,mem-path=/tmp/mem0,size=4G,share=true
> cxl-type3,bus=rp0,volatile-memdev=mem0,id=cxl-mem0,shm_token=mytoken
>
> then you can have multiple qemu instances hook their relevant devices up
> to a a backend that points to the same file, and instantiate their
> shared state in the region shmget(mytoken).
That's not pretty. For local instance I was thinking a primary device
which also has the FM-API tunneled access via mailbox, and secondary devices
that don't. That would also apply to remote. The secondary device would
then just receive some control commands on what to expose up to it's host.
Not sure what convention on how to do that is in QEMU. Maybe a socket
interface like is done for swtpm? With some ordering constraints on startup.
>
> Additionally, these devices will require a set of what amounts to
> vendor-specific mailbox commands - since the spec doesn't really define
> what multi-headed devices "should do" to manage exclusivity.
The device shouldn't manage exclusivity. That's a job for the fabric
manager + DCD presentation of the memory with device enforcing some rules
+ if it supports some of the capacity adding types, it might need a
simple allocator.
If we need vendor specific commands then we need to take that to the
relevant body. I'm not sure what they would be though.
>
> Not sure if this would be upstream-worthy, or if we'd want to fork
> mem/cxl-type3.c into like mem/cxl-type3-multihead.c or something.
>
> The base type3 device is going to end up overloaded at some point i
> think, and we'll want to look at trying to abstract it.
Sure. Though we might end up with the normal type3 implementation being
(optionally) the primary device for a MHD (the one with the FM-API
tunneling available on it's mailbox). Would need a secondary
device though which you instantiate with a link to the primary one
or with a socket. (assuming primary opens socket as well).
Jonathan
>
> ~Gregory
next prev parent reply other threads:[~2023-02-16 18:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 22:28 CXL 2.0 memory pooling emulation zhiting zhu
2023-02-15 15:18 ` Jonathan Cameron via
2023-02-15 9:10 ` Gregory Price
2023-02-16 18:00 ` Jonathan Cameron via [this message]
2023-02-16 20:52 ` Gregory Price
2023-02-17 11:14 ` Jonathan Cameron via
2023-02-17 11:02 ` Gregory Price
2025-03-10 8:02 ` CXL memory pooling emulation inqury Junjie Fu
2025-03-12 18:05 ` Jonathan Cameron
2025-03-12 18:05 ` Jonathan Cameron via
2025-03-12 19:33 ` Gregory Price
2025-03-13 16:03 ` Fan Ni
2025-04-08 4:47 ` Fan Ni
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=20230216180057.00006c49@huawei.com \
--to=qemu-devel@nongnu.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=gregory.price@memverge.com \
--cc=linux-cxl@vger.kernel.org \
--cc=viacheslav.dubeyko@bytedance.com \
--cc=zhitingz@cs.utexas.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.