From: Roland Dreier <rdreier@cisco.com>
To: akepner@sgi.com
Cc: linux-kernel@vger.kernel.org, tony.luck@intel.com, jes@sgi.com
Subject: Re: [PATCH] sn-ia64: allow drivers to flush in-flight DMA
Date: Thu, 16 Aug 2007 22:06:22 -0700 [thread overview]
Message-ID: <adawsvuyckx.fsf@cisco.com> (raw)
In-Reply-To: <20070816225603.GJ1813@sgi.com> (akepner@sgi.com's message of "Thu, 16 Aug 2007 15:56:03 -0700")
The overall approach looks fine to me, although I'm not the arbiter of
taste for the DMA API.
However, I think this wants to be split into at least three parts for
merging: adding the dmaflush flags stuff into the DMA API; adding the
dmaflush parameter to the ib_umem_get() API (and fixing every caller);
and using that API to fix mthca on SGI boxes. (And also there should
probably be a 4th patch to fix the same issue with mlx4 at least, and
possibly further patches for other drivers such as the cxgb3 RDMA
driver, etc)
Also further comments below:
> struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
> - size_t size, int access)
> + size_t size, int access, int dmaflush)
This change means every caller of ib_umem_get needs to be fixed up as
part of the patch.
> @@ -1027,7 +1029,14 @@ static struct ib_mr *mthca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
> if (!mr)
> return ERR_PTR(-ENOMEM);
>
> - mr->umem = ib_umem_get(pd->uobject->context, start, length, acc);
> + if (ib_copy_from_udata(&ucmd, udata, sizeof ucmd)) {
> + err = -EFAULT;
> + goto err;
> + }
trivial, but you might as well do the copy_from_udata before
allocating mr, so that you can just return ERR_PTR(-EFAULT) without
having to free mr on the error path.
> + dmaflush = (int) ucmd.mr_attrs & MTHCA_MR_DMAFLUSH;
> +
> + mr->umem = ib_umem_get(pd->uobject->context, start, length, acc,
> + dmaflush);
I think the dmaflush temporary variable isn't adding anything, and
certainly the cast to int is unnecessary. Anyway, it looks better to
me to write this simply as
mr->umem = ib_umem_get(pd->uobject->context, start, length, acc,
ucmd.mr_attrs & MTHCA_MR_DMAFLUSH);
> +#define MTHCA_MR_DMAFLUSH 0x1 /* flush in-flight DMA on a write to
> + * memory region (IA64_SGI_SN2 only) */
I would leave out the commentary about this being SN2-only -- the
whole point is to use a generic API to hide this detail.
- R.
prev parent reply other threads:[~2007-08-17 5:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-16 22:56 [PATCH] sn-ia64: allow drivers to flush in-flight DMA akepner
2007-08-17 5:06 ` Roland Dreier [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=adawsvuyckx.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=akepner@sgi.com \
--cc=jes@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.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