linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: Christoph Hellwig <hch@infradead.org>,
	James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
	bart.vanassche@sandisk.com
Subject: Re: [PATCH] scsi_debug: fix sleep in invalid context
Date: Tue, 31 May 2016 17:12:21 -0400	[thread overview]
Message-ID: <574DFE35.8000801@interlog.com> (raw)
In-Reply-To: <20160530190916.GA366@infradead.org>

On 2016-05-30 03:09 PM, Christoph Hellwig wrote:
> On Mon, May 30, 2016 at 12:02:45PM -0700, James Bottomley wrote:
>> This might fix the immediate warning, but won't it demand huge
>> contiguous memory chunks in high lun configurations and thus fail
>> randomly?  Report luns is important to us because if that fails the
>> target won't attach.
>>
>> What about vmalloc'ing enough space at configuration time, when you do
>> have process context, and simply reusing the already allocated buffer
>> in this routine?  If you want to be clever, you could do a single
>> vmalloc for the biggest LUN size you have and reuse that buffer for
>> every report lun command with suitable locking ... we tend to fire off
>> report luns sequentially at start of day, so it's not like they have
>> huge performance or concurrency requirements.
>
> There is no need for the allocation at all.  Instead of the big
> array and a single call to fill_from_dev_buffer we can simply
> have a single scsi_lun structure on stack that gets reused for
> every lun and individual calls to sg_copy_from_buffer for each
> one instead of a single big one.

Christoph,
Interesting idea but a time waster due to:
    s/sg_copy_from_buffer/sg_pcopy_from_buffer/

Otherwise the start of the sgl is overwritten by each subsequent
call. The "p" variant has a trailing 'off_t skip' argument and
currently there are no helper functions in scsi_cmnd.h for the
"pcopy" variants. Also handling the resid is fiddly, not helped by
initializing it to zero rather than scsi_bufflen().

Doug Gilbert


      reply	other threads:[~2016-05-31 21:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30 18:19 [PATCH] scsi_debug: fix sleep in invalid context Douglas Gilbert
2016-05-30 19:02 ` James Bottomley
2016-05-30 19:09   ` Christoph Hellwig
2016-05-31 21:12     ` Douglas Gilbert [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=574DFE35.8000801@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=hch@infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).