linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shuah Khan <shuah@kernel.org>
To: Wolfram Sang <wsa@the-dreams.de>, Shuah Khan <shuahkhan@gmail.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH 4/4] i2c: rcar: check for DMA-capable buffers
Date: Thu, 15 Jun 2017 13:48:17 -0600	[thread overview]
Message-ID: <fd55bfd6-b927-fc3f-a50d-9610329d0346@kernel.org> (raw)
In-Reply-To: <20170615191743.xdrvigy4h2gqk2kk@ninjato>

On 06/15/2017 01:17 PM, Wolfram Sang wrote:
> Hi,
> 
>>> -       /* Do not use DMA if it's not available or for messages < 8 bytes */
>>> -       if (IS_ERR(chan) || msg->len < 8)
>>> +       if (IS_ERR(chan) || msg->len < RCAR_DMA_THRESHOLD || priv->flags & ID_P_NODMA)
>>
>> Might be more efficient to check for ID_P_NODMA first instead of msg->len.
> 
> I think most of the I2C transfers are smaller (like reading/writing one
> register) than the threshold, so this "should" be more efficient. Plus,
> honestly, I also think this is a micro-optimization which is largely
> depending on the use-case. Can we agree on that?

Makes sense.

> 
>>> -       read = msg->flags & I2C_M_RD;
>>> +       /* we need to check here because we need the 'current' context */
>>> +       if (i2c_check_msg_for_dma(msg, RCAR_DMA_THRESHOLD, NULL) == -EFAULT) {
>>> +               dev_dbg(dev, "skipping DMA for this whole transfer\n");
>>
>> Adding reason for skipping will be helpful.
> 
> The I2C core helper will immediately print before that the buffer is not
> DMA capable. Do you think this together will do?

That is sufficient.

thanks,
-- Shuah

> 
> Thanks for your input,
> 
>    Wolfram
> 

  reply	other threads:[~2017-06-15 19:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-15 18:30 [PATCH 0/4] i2c: document DMA handling and add helpers for it Wolfram Sang
2017-06-15 18:30 ` [PATCH 1/4] i2c: add helpers to ease DMA handling Wolfram Sang
2017-06-15 20:31   ` Geert Uytterhoeven
2017-06-27 21:16     ` Wolfram Sang
2017-06-15 18:30 ` [PATCH 2/4] i2c: add docs to clarify " Wolfram Sang
2017-06-15 20:30   ` Geert Uytterhoeven
2017-06-15 18:30 ` [PATCH 3/4] i2c: sh_mobile: use helper to decide if DMA is useful Wolfram Sang
2017-06-15 18:30 ` [PATCH 4/4] i2c: rcar: check for DMA-capable buffers Wolfram Sang
2017-06-15 18:48   ` Shuah Khan
2017-06-15 19:17     ` Wolfram Sang
2017-06-15 19:48       ` Shuah Khan [this message]
2017-06-15 18:42 ` [PATCH 0/4] i2c: document DMA handling and add helpers for it Wolfram Sang

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=fd55bfd6-b927-fc3f-a50d-9610329d0346@kernel.org \
    --to=shuah@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=shuahkhan@gmail.com \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).