diff mbox series

kvm: mmu: fix typos in struct kvm_arch

Message ID CAPm50aKursUrDpgqLt7RT-VoSfBJswsnR2w1sVAt5mburmdd8g@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series kvm: mmu: fix typos in struct kvm_arch | expand

Commit Message

Hao Peng July 27, 2022, 10:58 a.m. UTC
From: Peng Hao <flyingpeng@tencent.com>

No 'kvmp_mmu_pages', it should be 'kvm_mmu_page'. And
struct kvm_mmu_pages and struct kvm_mmu_page are different structures,
here should be kvm_mmu_page.
kvm_mmu_pages is defined in arch/x86/kvm/mmu/mmu.c.

Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
 arch/x86/include/asm/kvm_host.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--
2.27.0

Comments

David Matlack July 27, 2022, 4:32 p.m. UTC | #1
On Wed, Jul 27, 2022 at 3:58 AM Hao Peng <flyingpenghao@gmail.com> wrote:
>
> From: Peng Hao <flyingpeng@tencent.com>
>
> No 'kvmp_mmu_pages', it should be 'kvm_mmu_page'. And
> struct kvm_mmu_pages and struct kvm_mmu_page are different structures,
> here should be kvm_mmu_page.
> kvm_mmu_pages is defined in arch/x86/kvm/mmu/mmu.c.
>
> Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> ---
>  arch/x86/include/asm/kvm_host.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index e8281d64a431..205a9f374e14 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1272,8 +1272,8 @@ struct kvm_arch {
>         bool tdp_mmu_enabled;
>
>         /*
> -        * List of struct kvm_mmu_pages being used as roots.
> -        * All struct kvm_mmu_pages in the list should have
> +        * List of struct kvm_mmu_page being used as roots.

I agree that "struct <name>s" is a bad/misleading way to make a struct
plural in comments. The way I prefer to do it is "<name> structs".
That avoids changing the <name> and still makes it clear it's plural.
So in this case the comment would be:

/*
 * List of kvm_mmu_page structs being used as roots.
 * All kvm_mmu_page structs in the list should have
 * tdp_mmu_page set.
 */

> +        * All struct kvm_mmu_page in the list should have
>          * tdp_mmu_page set.
>          *
>          * For reads, this list is protected by:
> @@ -1292,8 +1292,8 @@ struct kvm_arch {
>         struct list_head tdp_mmu_roots;
>
>         /*
> -        * List of struct kvmp_mmu_pages not being used as roots.
> -        * All struct kvm_mmu_pages in the list should have
> +        * List of struct kvm_mmu_page not being used as roots.
> +        * All struct kvm_mmu_page in the list should have
>          * tdp_mmu_page set and a tdp_mmu_root_count of 0.
>          */
>         struct list_head tdp_mmu_pages;
> --
> 2.27.0
Sean Christopherson July 27, 2022, 5:51 p.m. UTC | #2
On Wed, Jul 27, 2022, David Matlack wrote:
> On Wed, Jul 27, 2022 at 3:58 AM Hao Peng <flyingpenghao@gmail.com> wrote:
> >
> > From: Peng Hao <flyingpeng@tencent.com>
> >
> > No 'kvmp_mmu_pages', it should be 'kvm_mmu_page'. And
> > struct kvm_mmu_pages and struct kvm_mmu_page are different structures,
> > here should be kvm_mmu_page.
> > kvm_mmu_pages is defined in arch/x86/kvm/mmu/mmu.c.
> >
> > Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> > ---
> >  arch/x86/include/asm/kvm_host.h | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> > index e8281d64a431..205a9f374e14 100644
> > --- a/arch/x86/include/asm/kvm_host.h
> > +++ b/arch/x86/include/asm/kvm_host.h
> > @@ -1272,8 +1272,8 @@ struct kvm_arch {
> >         bool tdp_mmu_enabled;
> >
> >         /*
> > -        * List of struct kvm_mmu_pages being used as roots.
> > -        * All struct kvm_mmu_pages in the list should have
> > +        * List of struct kvm_mmu_page being used as roots.
> 
> I agree that "struct <name>s" is a bad/misleading way to make a struct
> plural in comments. The way I prefer to do it is "<name> structs".
> That avoids changing the <name> and still makes it clear it's plural.

+1, I like that approach.  FWIW, "struct kvm_mmu_pages" will likely be renamed in
the not-too-distant future[*], but I think it's still worth changing this to follow
David's suggestion.

[*] https://lore.kernel.org/all/20220605064342.309219-13-jiangshanlai@gmail.com
diff mbox series

Patch

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index e8281d64a431..205a9f374e14 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1272,8 +1272,8 @@  struct kvm_arch {
        bool tdp_mmu_enabled;

        /*
-        * List of struct kvm_mmu_pages being used as roots.
-        * All struct kvm_mmu_pages in the list should have
+        * List of struct kvm_mmu_page being used as roots.
+        * All struct kvm_mmu_page in the list should have
         * tdp_mmu_page set.
         *
         * For reads, this list is protected by:
@@ -1292,8 +1292,8 @@  struct kvm_arch {
        struct list_head tdp_mmu_roots;

        /*
-        * List of struct kvmp_mmu_pages not being used as roots.
-        * All struct kvm_mmu_pages in the list should have
+        * List of struct kvm_mmu_page not being used as roots.
+        * All struct kvm_mmu_page in the list should have
         * tdp_mmu_page set and a tdp_mmu_root_count of 0.
         */
        struct list_head tdp_mmu_pages;