From: Gregory Price <gregory.price@memverge.com>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Gregory Price <gourry.memverge@gmail.com>,
qemu-devel@nongnu.org, linux-cxl@vger.kernel.org,
alison.schofield@intel.com, dave@stgolabs.net,
a.manzanares@samsung.com, bwidawsk@kernel.org,
hchkuo@avery-design.com.tw, cbrowy@avery-design.com,
ira.weiny@intel.com
Subject: Re: [RFC v4 3/3] hw/cxl: Multi-Region CXL Type-3 Devices (Volatile and Persistent)
Date: Mon, 19 Dec 2022 11:12:34 -0500 [thread overview]
Message-ID: <Y6CNcuIzUVmKL0SM@memverge.com> (raw)
In-Reply-To: <20221219124211.000032b7@Huawei.com>
On Mon, Dec 19, 2022 at 12:42:11PM +0000, Jonathan Cameron wrote:
> As a process thing, when reworking a patch I picked up for the
> CXL qemu gitlab tree, drop the SOB that I added as it's not relevant
> to the new patch.
>
ack
> Still no need to post a new version unless you particularly
> want to or there are other changes to make.
ack
> > +Deprecations
> > +------------
> > +
> > +The Type 3 device [memdev] attribute has been deprecated in favor
> > +of the [persistent-memdev] and [volatile-memdev] attributes. [memdev]
>
> That's not quite correct as it sort of implies we could previously use
> memdev for the volatile case.
An early version of the patch explicitly errored out / warned the user
if they attempted to do this, but that got rebuffed. This could be
added back in.
> > - return address_space_read(&ct3d->hostmem_as, dpa_offset, attrs, data, size);
> > + if (vmr) {
> > + if (dpa_offset <= int128_get64(vmr->size)) {
> > + as = &ct3d->hostvmem_as;
>
> As a follow up it might be worth exploring if we can combine the two address spaces.
> I'm not keen to do it yet, because of no simple way to test it and it's less obviously
> correct than just having separate address spaces.
>
> Would involve mapping a the two hostmem regions into a container memory region which
> would be the one we use to build the address space. Advantage would be that we wouldn't
> need special handling for which region it was in here or the write path as QEMUs
> normal heirarchical memory regions would handle that for us.
> I'm not 100% sure it would work though!
>
Originally I had tried putting them both into one, with the thought that
since it's technically one device address space there should only be one
way to access the address space instead of two.
After investigating, the address space has to be initialized with a
memdev, and an address space only supports a single memdev, so i settled
on two address spaces in order to keep the memdevs separate (considering
each region may have different attributes).
This opens the question as to how to actually represent a persistent
memory device that can be partitioned as volatile.
Consider the following setup:
device[pmem 512mb, volatile 512 mb]
produces:
memdev(512mb, pmem) && memdev(512mb, volatile)
But if I partition the device to 256p/768v, when i access data in range
[256mb,512mb), then i have volatile data going into the persistent memory
store by nature of the fact that the capacity is located in that memdev.
An alternative would be to require a vmem region the same size as the
pmem region (+ whatever additional volatile capacity), but this
means using 2x the resources to represent the real capacity of the
device. That's not good.
Another alternative would be to create a wrapper memdev that encompasses
persistent and volatile operations, and then create the partitioning
logic on top of it, such that it can use a single memdev while handling
whatever sematics only apply to each individual region.
The tl;dr here: Going down to a single address space would probably
require writing a wrapper memdev that abstracts away all the
partitioning logic. Maybe that's worth it?
> > @@ -744,30 +891,35 @@ static void validate_lsa_access(MemoryRegion *mr, uint64_t size,
> > static uint64_t get_lsa(CXLType3Dev *ct3d, void *buf, uint64_t size,
> > uint64_t offset)
> > {
> > - return size;
> > + return 0;
>
> Hmm. Maybe this should return an error, but then we can't use the uint64_t as a return
> value. As this function would never be called with !ct3d->lsa let's leave it as it stands.
>
> > }
I originally wanted to do that, but I chose to keep the current contract
semantics so as to minimize the change set. I agree though that this
should probably return an error.
next prev parent reply other threads:[~2022-12-19 16:18 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 15:01 [RFC v4 0/3] CXL Type-3 Volatile Memory Support Gregory Price
2022-11-28 15:01 ` [RFC v4 1/3] hw/cxl: Add CXL_CAPACITY_MULTIPLIER definition Gregory Price
2022-11-28 15:01 ` [RFC v4 2/3] tests/qtest/cxl-test: whitespace, line ending cleanup Gregory Price
2023-01-05 14:38 ` Jonathan Cameron via
2023-01-30 13:11 ` Jonathan Cameron via
2023-01-30 14:38 ` Gregory Price
2022-11-28 15:01 ` [RFC v4 3/3] hw/cxl: Multi-Region CXL Type-3 Devices (Volatile and Persistent) Gregory Price
[not found] ` <CGME20221208225559uscas1p1e9e2c7c8f9a1654a5f41cef2c47859a8@uscas1p1.samsung.com>
2022-12-08 22:55 ` Fan Ni
2022-12-08 23:06 ` Gregory Price
2022-12-19 12:42 ` Jonathan Cameron via
2022-12-19 16:12 ` Gregory Price [this message]
2022-12-19 17:25 ` Jonathan Cameron via
2022-12-19 17:55 ` Gregory Price
2022-12-20 15:34 ` Jonathan Cameron via
2022-12-20 19:27 ` Gregory Price
2023-01-03 15:56 ` Jonathan Cameron via
2023-01-03 16:02 ` Gregory Price
2023-01-03 18:15 ` Jonathan Cameron via
2023-01-19 17:15 ` Gregory Price
2023-01-19 17:31 ` Jonathan Cameron via
2023-01-19 22:13 ` Gregory Price
2023-01-20 10:59 ` Jonathan Cameron via
2023-01-30 13:24 ` Jonathan Cameron via
2023-01-30 14:37 ` Gregory Price
2023-01-31 11:53 ` Jonathan Cameron via
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=Y6CNcuIzUVmKL0SM@memverge.com \
--to=gregory.price@memverge.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=a.manzanares@samsung.com \
--cc=alison.schofield@intel.com \
--cc=bwidawsk@kernel.org \
--cc=cbrowy@avery-design.com \
--cc=dave@stgolabs.net \
--cc=gourry.memverge@gmail.com \
--cc=hchkuo@avery-design.com.tw \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=qemu-devel@nongnu.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 NNTP newsgroup(s).