All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Linux SCSI List <linux-scsi@vger.kernel.org>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: Re: kernel BUG at block/bio.c:1787! while initializing scsi_debug on ppc64 host
Date: Wed, 16 Dec 2015 01:16:48 +0800	[thread overview]
Message-ID: <20151215171647.GF19209@eguan.usersys.redhat.com> (raw)
In-Reply-To: <20151215233841.522d4bf0@tom-T450>

On Tue, Dec 15, 2015 at 11:38:41PM +0800, Ming Lei wrote:
> On Tue, 15 Dec 2015 21:06:31 +0800
> Eryu Guan <guaneryu@gmail.com> wrote:
> 
> > On Tue, Dec 15, 2015 at 08:06:47PM +0800, Ming Lei wrote:
> > > On Tue, Dec 15, 2015 at 7:20 PM, Eryu Guan <guaneryu@gmail.com> wrote:
> > > > On Fri, Dec 11, 2015 at 07:53:40PM +0800, Eryu Guan wrote:
> > > >> Hi,
> > > >>
> > > >> I saw this kernel BUG_ON on 4.4-rc4 kernel, and this can be reproduced
> > > >> easily on ppc64 host by:
> > > >
> > > > This is still reproducible with 4.4-rc5 kernel.
> > > 
> > > Could you capture the debug log after appyling the attached patch and
> > > the reproduction?
> > 
> > Thanks for looking into this! dmesg shows:
> > 
> > [  686.217682] bio_split: sectors 0, bio_sectors 128, bi_rw 0
> 
> I guess the following patch should fix the issue, and ca369d51b3
> uses OPTIMAL TRANSFER LENGTH to set limits->max_sectors, which
> may be less than one page size.
> 
> I don't understand the idea behind this change, Martin, could
> you explain it a bit?
> 
> ---
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 3d22fc3..d66d362 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2889,10 +2889,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
>  	 */
>  	if (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max &&
>  	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS)
> -		rw_max = q->limits.io_opt =
> +		q->limits.io_opt =
>  			logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
> -	else
> -		rw_max = BLK_DEF_MAX_SECTORS;
> +
> +	rw_max = min_t(unsigned, BLK_DEF_MAX_SECTORS,
> +		       q->limits.max_dev_sectors);
>  
>  	/* Combine with controller limits */
>  	q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q));

I tested this patch and no BUG_ON this time, the debug messages are not
triggered either.

Thanks,
Eryu

  reply	other threads:[~2015-12-15 17:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11 12:01 kernel BUG at block/bio.c:1787! while initializing scsi_debug on ppc64 host Eryu Guan
2015-12-15 11:20 ` Eryu Guan
2015-12-15 12:06   ` Ming Lei
2015-12-15 13:06     ` Eryu Guan
2015-12-15 13:27       ` Ming Lei
2015-12-15 16:56         ` Eryu Guan
2015-12-16  1:15           ` Ming Lei
2015-12-16  1:39             ` Martin K. Petersen
2015-12-15 15:38       ` Ming Lei
2015-12-15 17:16         ` Eryu Guan [this message]
2015-12-15 18:29       ` Martin K. Petersen
2015-12-16  1:17         ` Ming Lei
2015-12-16  1:37           ` Martin K. Petersen
2015-12-16  7:25         ` Eryu Guan
2015-12-15 15:38   ` Martin K. Petersen
2016-01-05 11:57 ` Eryu Guan
2016-01-05 23:58   ` Martin K. Petersen
2016-01-06  3:33     ` Eryu Guan

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=20151215171647.GF19209@eguan.usersys.redhat.com \
    --to=guaneryu@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=tom.leiming@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.