From: Ulf Hansson <ulf.hansson@linaro.org>
To: Jisheng Zhang <Jisheng.Zhang@synaptics.com>,
Christoph Hellwig <hch@infradead.org>
Cc: Jun Nie <jun.nie@linaro.org>, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
linux-mmc <linux-mmc@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 4/4] mmc: sdhci: Add DMA memory boundary workaround
Date: Tue, 10 Dec 2019 10:36:49 +0100 [thread overview]
Message-ID: <CAPDyKFrreSgNfHX9hSKvYO7UxBEyqu0DSxX9NGp4phbR-F1fxQ@mail.gmail.com> (raw)
In-Reply-To: <20191204150043.3a82cec0@xhacker.debian>
On Wed, 4 Dec 2019 at 08:14, Jisheng Zhang <Jisheng.Zhang@synaptics.com> wrote:
>
> On Wed, 4 Dec 2019 14:00:08 +0800 Jun Nie wrote:
>
> >
> >
> > Christoph Hellwig <hch@infradead.org> 于2019年12月3日周二 下午3:36写道:
> > >
> > > On Tue, Dec 03, 2019 at 11:29:15AM +0800, Jun Nie wrote:
> > > > Thanks for the reminder! So I need to parse the segment_boundary from
> > > > device tree and use below code to set it, right?
> > > > For the max_segments accounting error, I did not see it so far though I
> > > > believe it is true in theory. Maybe it is due to segment boundary value is
> > > > very large.
> > > >
> > > > +++ b/drivers/mmc/core/queue.c
> > > > @@ -374,6 +374,7 @@ static void mmc_setup_queue(struct mmc_queue *mq,
> > > > struct mmc_card *card)
> > > > WARN(!blk_queue_can_use_dma_map_merging(mq->queue,
> > > > mmc_dev(host)),
> > > > "merging was advertised but not possible");
> > > > + blk_queue_segment_boundary(mq->queue, mmc->segment_boundary);
> > > > blk_queue_max_segments(mq->queue, mmc_get_max_segments(host));
> > >
> > > Yes, I think should do it. Maybe modulo a check if the low-level
> > > driver actually sets a segment boundary.
> >
> > For the block device, such as SD card, it is right solution. But I
> > have concern on SDIO case. Maybe we should add workaround together
> > with block layer segment boundary restriction. How do you think about
> > it?
> >
Yes, buffers for SDIO are a consern. Especially since those buffers
are allocated by SDIO func drivers or even from upper layers, such as
the network stacks, for example.
I think SDIO func drivers simply need to respect the constraints the
host has set via the .segment_boundary, .max_seg_size, .max_segs, etc.
We should export SDIO func APIs to make the information available for
the SDIO func drivers.
>
> Another trouble is how to workaround if the sg is constructed by mmc and
> no block layer interactions at all. e.g __mmc_blk_ioctl_cmd(), and all
> those sgs in mmc_test.c
Those should be easier to fix, as the buffer/sg allocation can be
fixed internally by mmc core. Just post some patches. :-)
I am more worried about SDIO, as those buffers are not that easy to control.
Note that, there have been suggestions on adding an SDIO interface
where an sg can be passed [1]. Unfurtunate those patches got stuck and
didn't make it.
Kind regards
Uffe
[1]
https://patchwork.kernel.org/patch/10123143/
next prev parent reply other threads:[~2019-12-10 9:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-02 14:41 [PATCH 0/4] mmc: Add sdhci workaround stability enhencement Jun Nie
2019-12-02 14:41 ` [PATCH 1/4] mmc: sdhci: Add delay after power off Jun Nie
2019-12-03 7:26 ` Adrian Hunter
2019-12-02 14:41 ` [PATCH 2/4] mmc: sdhci: dt: Add DMA boundary and HS400 properties Jun Nie
2019-12-13 23:01 ` Rob Herring
2019-12-17 14:56 ` Jun Nie
2019-12-02 14:41 ` [PATCH 3/4] mmc: sdhci: Set ctrl_hs400 value in dts Jun Nie
2019-12-03 7:52 ` Adrian Hunter
2019-12-02 14:41 ` [PATCH 4/4] mmc: sdhci: Add DMA memory boundary workaround Jun Nie
2019-12-02 17:52 ` Christoph Hellwig
2019-12-03 3:29 ` Jun Nie
2019-12-03 7:36 ` Christoph Hellwig
2019-12-04 6:00 ` Jun Nie
2019-12-04 7:14 ` Jisheng Zhang
2019-12-10 9:36 ` Ulf Hansson [this message]
2019-12-03 2:47 ` Jisheng Zhang
2019-12-03 3:33 ` Jun Nie
2019-12-03 9:05 ` Jisheng Zhang
2019-12-03 9:18 ` Christoph Hellwig
2019-12-03 9:49 ` Jisheng Zhang
2019-12-03 13:06 ` Christoph Hellwig
2019-12-04 7:11 ` Jisheng Zhang
2019-12-03 9:49 ` Jisheng Zhang
2019-12-03 13:04 ` Christoph Hellwig
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=CAPDyKFrreSgNfHX9hSKvYO7UxBEyqu0DSxX9NGp4phbR-F1fxQ@mail.gmail.com \
--to=ulf.hansson@linaro.org \
--cc=Jisheng.Zhang@synaptics.com \
--cc=adrian.hunter@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=hch@infradead.org \
--cc=jun.nie@linaro.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).