From: Amit Machhiwal <amachhiw@linux.ibm.com>
To: Ritesh Harjani <ritesh.list@gmail.com>
Cc: Amit Machhiwal <amachhiw@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Vaibhav Jain <vaibhav@linux.ibm.com>,
Anushree Mathur <anushree.mathur@linux.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Nicholas Piggin <npiggin@gmail.com>,
Michael Ellerman <mpe@ellerman.id.au>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, Gautam Menghani <gautam@linux.ibm.com>
Subject: Re: [PATCH v8 4/4] KVM: PPC: Document KVM_PPC_GET_COMPAT_CAPS ioctl
Date: Sat, 8 Aug 2026 21:24:41 +0530 [thread overview]
Message-ID: <20260808211732.f0cb80c2-50-amachhiw@linux.ibm.com> (raw)
In-Reply-To: <zeyxjtus.ritesh.list@gmail.com>
On 2026/08/08 06:45 AM, Ritesh Harjani wrote:
> Amit Machhiwal <amachhiw@linux.ibm.com> writes:
>
> > Add documentation for the KVM_PPC_GET_COMPAT_CAPS ioctl to the KVM API
> > documentation.
<snip>
> > +
> > +The ioctl uses ``copy_struct_from_user()`` and ``copy_struct_to_user()``
> > +to support extensible versioning across three cases:
> > +
> > +- If ``size`` is smaller than the kernel's struct size (old userspace,
> > + new kernel), the kernel zero-pads the unknown trailing fields before
> > + returning, and writes back ``size`` unchanged so userspace knows how
> > + many bytes were filled.
>
> I agree with Sashiko comment here. This para is slightly misleading.
> This sounds like we are zero padding to userspace struct before
> returning. Whereas what we intend to say here is, when we copy user
> struct into kernel (copy_struct_from_user()), we zero pad the trailing
> bytes in kernel's struct.
>
> > +- If ``size`` equals the kernel's struct size, the struct is copied
> > + verbatim.
> > +- If ``size`` is larger than the kernel's struct size (new userspace,
> > + old kernel) and the unknown trailing bytes are all zero, the call
> > + succeeds as if the sizes matched. If any trailing bytes are non-zero,
> > + the kernel returns ``-E2BIG`` and writes back its own struct size into
> > + the ``size`` field so userspace can retry with the correct size.
> >
>
> BTW - I anyway feel this is too much. We can get rid of all 3 points
> which explains how struct copying is working. We have more than enough
> documentation around how copy_struct_{from|to}_user() works and we have
> also added the comments around the code. So I think this is just
> unnecessary.
Agreed on both counts. I'll drop the three-bullet block in the next
version - v9 is on the way!
>
> We can just say:
> +The ioctl uses ``copy_struct_from_user()`` and ``copy_struct_to_user()``
> +to support extensible versioning.
Sure, makes sense.
>
>
> With that taken care, please feel free to add:
> Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Thanks again for the detailed reviews on the series. Will carry the R-b
in v9.
~Amit
prev parent reply other threads:[~2026-08-08 15:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 17:24 [PATCH v8 0/4] KVM: PPC: Expose CPU compatibility modes for nested guests Amit Machhiwal
2026-08-07 17:24 ` [PATCH v8 1/4] KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl Amit Machhiwal
2026-08-07 17:34 ` sashiko-bot
2026-08-08 1:00 ` Ritesh Harjani
2026-08-08 15:47 ` Amit Machhiwal
2026-08-07 17:24 ` [PATCH v8 2/4] KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM on PowerVM Amit Machhiwal
2026-08-07 17:39 ` sashiko-bot
2026-08-07 17:24 ` [PATCH v8 3/4] KVM: PPC: Book3S HV: Add support for compat CPU capabilities for KVM on PowerNV Amit Machhiwal
2026-08-07 17:24 ` [PATCH v8 4/4] KVM: PPC: Document KVM_PPC_GET_COMPAT_CAPS ioctl Amit Machhiwal
2026-08-07 17:37 ` sashiko-bot
2026-08-08 1:15 ` Ritesh Harjani
2026-08-08 15:54 ` Amit Machhiwal [this message]
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=20260808211732.f0cb80c2-50-amachhiw@linux.ibm.com \
--to=amachhiw@linux.ibm.com \
--cc=anushree.mathur@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=corbet@lwn.net \
--cc=gautam@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=pbonzini@redhat.com \
--cc=ritesh.list@gmail.com \
--cc=skhan@linuxfoundation.org \
--cc=vaibhav@linux.ibm.com \
/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