[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6b61cee4-0405-4967-afee-af934df34c5f@linux.intel.com>
Date: Thu, 4 Sep 2025 15:58:54 +0800
From: Binbin Wu <binbin.wu@...ux.intel.com>
To: Yan Zhao <yan.y.zhao@...el.com>
Cc: pbonzini@...hat.com, seanjc@...gle.com, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, x86@...nel.org, rick.p.edgecombe@...el.com,
dave.hansen@...el.com, kas@...nel.org, tabba@...gle.com,
ackerleytng@...gle.com, quic_eberman@...cinc.com, michael.roth@....com,
david@...hat.com, vannapurve@...gle.com, vbabka@...e.cz,
thomas.lendacky@....com, pgonda@...gle.com, zhiquan1.li@...el.com,
fan.du@...el.com, jun.miao@...el.com, ira.weiny@...el.com,
isaku.yamahata@...el.com, xiaoyao.li@...el.com, chao.p.peng@...el.com
Subject: Re: [RFC PATCH v2 17/23] KVM: guest_memfd: Split for punch hole and
private-to-shared conversion
On 8/7/2025 5:45 PM, Yan Zhao wrote:
[...]
>
> @@ -514,6 +554,8 @@ static int kvm_gmem_convert_should_proceed(struct inode *inode,
> struct conversion_work *work,
> bool to_shared, pgoff_t *error_index)
> {
> + int ret = 0;
> +
> if (to_shared) {
> struct list_head *gmem_list;
> struct kvm_gmem *gmem;
> @@ -522,19 +564,24 @@ static int kvm_gmem_convert_should_proceed(struct inode *inode,
> work_end = work->start + work->nr_pages;
>
> gmem_list = &inode->i_mapping->i_private_list;
> + list_for_each_entry(gmem, gmem_list, entry) {
> + ret = kvm_gmem_split_private(gmem, work->start, work_end);
> + if (ret)
> + return ret;
> + }
> list_for_each_entry(gmem, gmem_list, entry)
> - kvm_gmem_unmap_private(gmem, work->start, work_end);
> + kvm_gmem_zap(gmem, work->start, work_end, KVM_FILTER_PRIVATE);
> } else {
> unmap_mapping_pages(inode->i_mapping, work->start,
> work->nr_pages, false);
>
> if (!kvm_gmem_has_safe_refcount(inode->i_mapping, work->start,
> work->nr_pages, error_index)) {
> - return -EAGAIN;
> + ret = -EAGAIN;
> }
Not from this patch.
When if statement breaks into two lines, are curly braces needed?
> }
>
> - return 0;
> + return ret;
> }
>
[...]
> @@ -1906,8 +1926,14 @@ static int kvm_gmem_error_folio(struct address_space *mapping, struct folio *fol
> start = folio->index;
> end = start + folio_nr_pages(folio);
>
> - list_for_each_entry(gmem, gmem_list, entry)
> - kvm_gmem_invalidate_begin_and_zap(gmem, start, end);
> + /* The size of the SEPT will not exceed the size of the folio */
To me, the comment alone without the context doesn't give a direct expression that
split is not needed. If it's not too wordy, could you make it more informative?
> + list_for_each_entry(gmem, gmem_list, entry) {
> + enum kvm_gfn_range_filter filter;
> +
> + kvm_gmem_invalidate_begin(gmem, start, end);
> + filter = KVM_FILTER_PRIVATE | KVM_FILTER_SHARED;
> + kvm_gmem_zap(gmem, start, end, filter);
> + }
>
> /*
> * Do not truncate the range, what action is taken in response to the
Powered by blists - more mailing lists