linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Souptick Joarder <jrdr.linux@gmail.com>
To: rppt@linux.ibm.com
Cc: Matthew Wilcox <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>,
	Dan Williams <dan.j.williams@intel.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	vbabka@suse.cz, riel@redhat.com, Linux-MM <linux-mm@kvack.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: Create the new vm_fault_t type
Date: Mon, 5 Nov 2018 19:23:55 +0530	[thread overview]
Message-ID: <CAFqt6zYbb9xpnOhhoESq3BbF4aD0_UKzh=MrwJ-i+NiUqNh7+Q@mail.gmail.com> (raw)
In-Reply-To: <20181105091302.GA3713@rapoport-lnx>

On Mon, Nov 5, 2018 at 2:43 PM Mike Rapoport <rppt@linux.ibm.com> wrote:
>
> On Mon, Nov 05, 2018 at 11:14:17AM +0530, Souptick Joarder wrote:
> > Hi Matthew,
> >
> > On Sun, Nov 4, 2018 at 2:06 PM Mike Rapoport <rppt@linux.ibm.com> wrote:
> > >
> > > On Sat, Nov 03, 2018 at 05:02:36AM -0700, Matthew Wilcox wrote:
> > > > On Sat, Nov 03, 2018 at 10:35:04AM +0530, Souptick Joarder wrote:
> > > > > Page fault handlers are supposed to return VM_FAULT codes,
> > > > > but some drivers/file systems mistakenly return error
> > > > > numbers. Now that all drivers/file systems have been converted
> > > > > to use the vm_fault_t return type, change the type definition
> > > > > to no longer be compatible with 'int'. By making it an unsigned
> > > > > int, the function prototype becomes incompatible with a function
> > > > > which returns int. Sparse will detect any attempts to return a
> > > > > value which is not a VM_FAULT code.
> > > >
> > > >
> > > > > -/* Encode hstate index for a hwpoisoned large page */
> > > > > -#define VM_FAULT_SET_HINDEX(x) ((x) << 12)
> > > > > -#define VM_FAULT_GET_HINDEX(x) (((x) >> 12) & 0xf)
> > > > ...
> > > > > +/* Encode hstate index for a hwpoisoned large page */
> > > > > +#define VM_FAULT_SET_HINDEX(x) ((__force vm_fault_t)((x) << 16))
> > > > > +#define VM_FAULT_GET_HINDEX(x) (((x) >> 16) & 0xf)
> > > >
> > > > I think it's important to mention in the changelog that these values
> > > > have been changed to avoid conflicts with other VM_FAULT codes.
> > > >
> > > > > +/**
> > > > > + * typedef vm_fault_t -  __bitwise unsigned int
> > > > > + *
> > > > > + * vm_fault_t is the new unsigned int type to return VM_FAULT
> > > > > + * code by page fault handlers of drivers/file systems. Now if
> > > > > + * any page fault handlers returns non VM_FAULT code instead
> > > > > + * of VM_FAULT code, it will be a mismatch with function
> > > > > + * prototype and sparse will detect it.
> > > > > + */
> > > >
> > > > The first line should be what the typedef *means*, not repeat the
> > > > compiler's definition.  The rest of the description should be information
> > > > for someone coming to the type for the first time; what you've written
> > > > here is changelog material.
> > > >
> > > > /**
> > > >  * typedef vm_fault_t - Return type for page fault handlers.
> > > >  *
> > > >  * Page fault handlers return a bitmask of %VM_FAULT values.
> > > >  */
> > > >
> > > > > +typedef __bitwise unsigned int vm_fault_t;
> > > > > +
> > > > > +/**
> > > > > + * enum - VM_FAULT code
> > > >
> > > > Can you document an anonymous enum?  I've never tried.  Did you run this
> > > > through 'make htmldocs'?
> > >
> > > You cannot document an anonymous enum.
> >
> >
> > I assume, you are pointing to Document folder and I don't know if this
> > enum need to be documented or not.
>
> The enum should be documented, even if it's documentation is (yet) not
> linked anywhere in the Documentation/
>
> > I didn't run 'make htmldocs' as there is no document related changes.
>
> You can verify that kernel-doc can parse your documentation by running
>
> scripts/kernel-doc -none -v <filename>

I run "scripts/kernel-doc -none -v include/linux/mm_types.h" and it is showing
below error and warning which is linked to enum in discussion.

include/linux/mm_types.h:612: info: Scanning doc for typedef vm_fault_t
include/linux/mm_types.h:623: info: Scanning doc for enum
include/linux/mm_types.h:628: warning: contents before sections
include/linux/mm_types.h:660: error: Cannot parse enum!
1 errors
1 warnings

Shall I keep the documentation for enum or remove it from this patch ?

>
> > >
> > > > > + * This enum is used to track the VM_FAULT code return by page
> > > > > + * fault handlers.
> > > >
> > > >  * Page fault handlers return a bitmask of these values to tell the
> > > >  * core VM what happened when handling the fault.
> > > >
> > >
> > > --
> > > Sincerely yours,
> > > Mike.
> > >
> >
>
> --
> Sincerely yours,
> Mike.
>

  reply	other threads:[~2018-11-05 13:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-03  5:05 Souptick Joarder
2018-11-03  5:11 ` Souptick Joarder
2018-11-03 12:02 ` Matthew Wilcox
2018-11-04  8:36   ` Mike Rapoport
2018-11-05  5:44     ` Souptick Joarder
2018-11-05  9:13       ` Mike Rapoport
2018-11-05 13:53         ` Souptick Joarder [this message]
2018-11-06  6:21           ` Mike Rapoport
2018-11-06  6:29             ` Souptick Joarder

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='CAFqt6zYbb9xpnOhhoESq3BbF4aD0_UKzh=MrwJ-i+NiUqNh7+Q@mail.gmail.com' \
    --to=jrdr.linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=riel@redhat.com \
    --cc=rppt@linux.ibm.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.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