public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Alan Mikhak <alan.mikhak@sifive.com>
Cc: linux-kernel@vger.kernel.org, martin.petersen@oracle.com,
	alexios.zavras@intel.com, ming.lei@redhat.com,
	gregkh@linuxfoundation.org, tglx@linutronix.de,
	christophe.leroy@c-s.fr, thellstrom@vmware.com,
	galpress@amazon.com, palmer@sifive.com, paul.walmsley@sifive.com
Subject: Re: [PATCH] scatterlist: Comment on pages for sg_set_page()
Date: Wed, 2 Oct 2019 11:27:31 -0300	[thread overview]
Message-ID: <20191002142731.GC17152@ziepe.ca> (raw)
In-Reply-To: <1569954770-11477-1-git-send-email-alan.mikhak@sifive.com>

On Tue, Oct 01, 2019 at 11:32:50AM -0700, Alan Mikhak wrote:
> From: Alan Mikhak <alan.mikhak@sifive.com>
> 
> Update the description of sg_set_page() to communicate current
> requirements for the page pointer parameter.
> 
> Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
>  include/linux/scatterlist.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
> index 6eec50fb36c8..6dda865893aa 100644
> +++ b/include/linux/scatterlist.h
> @@ -112,6 +112,12 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
>   *   of the page pointer. See sg_page() for looking up the page belonging
>   *   to an sg entry.
>   *
> + *   Scatterlist currently expects the page parameter to be a pointer to
> + *   a page that is backed by a page struct.
> + *
> + *   Page pointers derived from addresses obtained from ioremap() are
> + *   currently not supported since they require use of iomem safe memcpy.
> + *
>   **/
>  static inline void sg_set_page(struct scatterlist *sg, struct page *page,
>  			       unsigned int len, unsigned int offset)

It seems a bit weird to have a comment explaining that 'struct page
*page' must actually be a valid pointer. Of course it must.

Computing a 'struct page *' to something that doesn't actually have a
struct page is simply a bug in whoever did that.

Code should never be interchanging ioremap results with the struct
page* world.

Jason

  reply	other threads:[~2019-10-02 14:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 18:32 [PATCH] scatterlist: Comment on pages for sg_set_page() Alan Mikhak
2019-10-02 14:27 ` Jason Gunthorpe [this message]
2019-10-02 16:18   ` Alan Mikhak

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=20191002142731.GC17152@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=alan.mikhak@sifive.com \
    --cc=alexios.zavras@intel.com \
    --cc=christophe.leroy@c-s.fr \
    --cc=galpress@amazon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    --cc=palmer@sifive.com \
    --cc=paul.walmsley@sifive.com \
    --cc=tglx@linutronix.de \
    --cc=thellstrom@vmware.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