public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Kieran Kunhya <kieran@kunhya.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Joe Perches <joe@perches.com>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	Antti Palosaari <crope@iki.fi>, Jingoo Han <jg1.han@samsung.com>,
	Ramprasad Chinthekindi <rchinthekindi@stec-inc.com>,
	Pekka Enberg <penberg@kernel.org>,
	Minchan Kim <minchan@kernel.org>,
	Fabian Frederick <fabf@skynet.be>,
	Akhil Bhansali <abhansali@stec-inc.com>,
	Jiri Kosina <jkosina@suse.cz>, Alan <gnomes@lxorguk.ukuu.org.uk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCHv3] block: Add support for Sony SxS cards
Date: Sun, 28 Sep 2014 10:35:44 -0600	[thread overview]
Message-ID: <542838E0.9000604@kernel.dk> (raw)
In-Reply-To: <1411915159.78518.YahooMailNeo@web161504.mail.bf1.yahoo.com>

On 09/28/2014 08:39 AM, Kieran Kunhya wrote:
>> So a few questions here... This device only does reads? And it seems to 
>> be assuming that only reads end up in the request handler? How so?
> 
> I have only reverse engineered the read-part of the device. Yes, the 
> driver should check whether the request is a read. 

And you should also deny any writeable opens, in that case. Add an open
method and check for FMODE_WRITE. Then add a check ala:

	if (bio_data_dir(bio)) {
		bio_endio(bio, -EROFS);
		return;
	}

and the top of your sxs_request().

>> Second question. IO never fails? There's no status checking and IO is 
>> always ended successfully. This too seems odd.
> 
> I will fix this.
> 
>> Third, this wong work as-is, at least not of HIGHMEM is used. After the 
>> bvec_kmap_irq(), irqs will be disabled. But your sxs_memcpy_read() 
>> invokes schedule through the completion waits, that will instantly go bad.
> 
> Is there a better way of doing this? I spent a long time trying to get DMA 
> to work but couldn't so had to resort to this ugly hack. I assume the memcpy 
> also needs to have some locking somewhere?

It really is pretty horrible and slow, but if you can't get DMA working,
then so be it. And yes, you should add a mutex that is held for the
duration of the memcpy_read(), otherwise things will go bad very fast if
two or more processes attempt to read from it at the same time. A quick
work-around for the irq issue would be to have the block layer bounce
the highmem pages for you. That's actually the default behavior, but I
would make it explicit with a call to:

	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);

after the blk_queue_make_request() call. If you do that, then get rid of
the bvec_kmap_irq(), and just do:

	buffer = page_address(bvec.bv_page) + bvec.bv_offset;

to get the destination for your read.

-- 
Jens Axboe


      parent reply	other threads:[~2014-09-28 16:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07  9:53 [PATCH] Add support for Sony SxS cards Kieran Kunhya
2014-07-07  9:53 ` [PATCH] block: Add support for Sony SxS cards Signed-off-by: Kieran Kunhya <kieran@kunhya.com> Kieran Kunhya
2014-07-07 14:41   ` Randy Dunlap
2014-07-20  0:01     ` [PATCHv2] block: Add support for Sony SxS cards Kieran Kunhya
2014-09-27 23:43       ` [PATCHv3] " Kieran Kunhya
2014-09-28  2:31         ` Jens Axboe
     [not found]           ` <1411915159.78518.YahooMailNeo@web161504.mail.bf1.yahoo.com>
2014-09-28 16:35             ` Jens Axboe [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=542838E0.9000604@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=abhansali@stec-inc.com \
    --cc=akpm@linux-foundation.org \
    --cc=crope@iki.fi \
    --cc=davem@davemloft.net \
    --cc=fabf@skynet.be \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jg1.han@samsung.com \
    --cc=jkosina@suse.cz \
    --cc=joe@perches.com \
    --cc=kieran@kunhya.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=minchan@kernel.org \
    --cc=penberg@kernel.org \
    --cc=rchinthekindi@stec-inc.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