public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	Doug Ledford <dledford@redhat.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH] IB/mlx5: Convert to use vm_map_pages_zero()
Date: Wed, 28 Aug 2019 08:00:09 +0300	[thread overview]
Message-ID: <20190828050009.GB4725@mtr-leonro.mtl.com> (raw)
In-Reply-To: <CAFqt6zb3VzXXnooowpQpTqhvmkB6qxhFHT1C87=3XcwaoP6V5w@mail.gmail.com>

On Wed, Aug 28, 2019 at 08:57:19AM +0530, Souptick Joarder wrote:
> On Tue, Aug 27, 2019 at 9:19 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> >
> > On Tue, Aug 27, 2019 at 01:48:57AM +0530, Souptick Joarder wrote:
> > > On Mon, Aug 26, 2019 at 5:50 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> > > >
> > > > On Mon, Aug 26, 2019 at 01:32:09AM +0530, Souptick Joarder wrote:
> > > > > On Mon, Aug 26, 2019 at 1:13 AM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> > > > > >
> > > > > > On Sun, Aug 25, 2019 at 11:37:27AM +0530, Souptick Joarder wrote:
> > > > > > > First, length passed to mmap is checked explicitly against
> > > > > > > PAGE_SIZE.
> > > > > > >
> > > > > > > Second, if vma->vm_pgoff is passed as non zero, it would return
> > > > > > > error. It appears like driver is expecting vma->vm_pgoff to
> > > > > > > be passed as 0 always.
> > > > > >
> > > > > > ? pg_off is not zero
> > > > >
> > > > > Sorry, I mean, driver has a check against non zero to return error -EOPNOTSUPP
> > > > > which means in true scenario driver is expecting vma->vm_pgoff should be passed
> > > > > as 0.
> > > >
> > > > get_index is masking vm_pgoff, it is not 0
> > >
> > > Sorry, I missed this part. Further looking into code,
> > > in mlx5_ib_mmap(), vma_vm_pgoff is used to get command and
> > > inside mlx5_ib_mmap_clock_info_page() entire *dev->mdev->clock_info*
> > > is mapped.
> > >
> > > Consider that, the below modification will only take care of vma length
> > > error check inside vm_map_pages_zero() and an extra check for vma
> > > length is not needed.
> >
> > What is the point of vm_map_pages_zero() Is there some reason we should
> > prefer it for mapping a single page?
>
> vm_map_pages_zero() can be used to map single/ multiple pages both.
> There were drivers previously which either check length and pg_off explicitly
> or didn't check for incorrect value of length /pg_off passed to it at
> all. Calling
> vm_map_pages_zero() in those places were more appropriate as it has
> internal check for both.
>
> Now considering this patch, avoiding an extra check for length
> explicitly is the only
> part which can be avoided if converted to use vm_map_pages_zero()
> because pg_off
> is used in different context ( to identify command). So yes,
> improvement wise convert
> to use vm_map_pages_zero() is not making much difference here.

So let's drop it, please.

Thanks

      reply	other threads:[~2019-08-28  5:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-25  6:07 [PATCH] IB/mlx5: Convert to use vm_map_pages_zero() Souptick Joarder
2019-08-25 19:43 ` Jason Gunthorpe
2019-08-25 20:02   ` Souptick Joarder
2019-08-26 12:20     ` Jason Gunthorpe
2019-08-26 20:18       ` Souptick Joarder
2019-08-27 15:49         ` Jason Gunthorpe
2019-08-28  3:27           ` Souptick Joarder
2019-08-28  5:00             ` Leon Romanovsky [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=20190828050009.GB4725@mtr-leonro.mtl.com \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=jrdr.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --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