On Thu, Jun 20, 2024 at 03:47:23PM -0700, Elliot Berman wrote: > On Thu, Jun 20, 2024 at 11:29:56AM -0300, Jason Gunthorpe wrote: > > On Thu, Jun 20, 2024 at 04:01:08PM +0200, David Hildenbrand wrote: > > > Regarding huge pages: assume the huge page (e.g., 1 GiB hugetlb) is shared, > > > now the VM requests to make one subpage private. > > > > I think the general CC model has the shared/private setup earlier on > > the VM lifecycle with large runs of contiguous pages. It would only > > become a problem if you intend to to high rate fine granual > > shared/private switching. Which is why I am asking what the actual > > "why" is here. > > > > I'd let Fuad comment if he's aware of any specific/concrete Anrdoid > usecases about converting between shared and private. One usecase I can > think about is host providing large multimedia blobs (e.g. video) to the > guest. Rather than using swiotlb, the CC guest can share pages back with > the host so host can copy the blob in, possibly using H/W accel. I > mention this example because we may not need to support shared/private > conversions at granularity finer than huge pages. I suspect the more useful thing would be to be able to allocate actual shared memory and use that to shuffle data without a copy, setup much less frequently. Ie you could allocate a large shared buffer for video sharing and stream the video frames through that memory without copy. This is slightly different from converting arbitary memory in-place into shared memory. The VM may be able to do a better job at clustering the shared memory allocation requests, ie locate them all within a 1GB region to further optimize the host side. > Jason, do you have scenario in mind? I couldn't tell if we now had a > usecase or are brainstorming a solution to have a solution. No, I'm interested in what pKVM is doing that needs this to be so much different than the CC case.. Jason