lkml.org 
[lkml]   [2016]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] block: make sure big bio is splitted into at most 256 bvecs
From
On Wed, Apr 6, 2016 at 10:22 AM, Kent Overstreet
<kent.overstreet@gmail.com> wrote:
> On Wed, Apr 06, 2016 at 09:51:02AM +0800, Ming Lei wrote:
>> On Wed, Apr 6, 2016 at 9:28 AM, Kent Overstreet
>> <kent.overstreet@gmail.com> wrote:
>> > On Wed, Apr 06, 2016 at 09:20:59AM +0800, Ming Lei wrote:
>> >> On Wed, Apr 6, 2016 at 9:10 AM, Kent Overstreet
>> >> <kent.overstreet@gmail.com> wrote:
>> >> > On Wed, Apr 06, 2016 at 08:59:31AM +0800, Ming Lei wrote:
>> >> >> On Wed, Apr 6, 2016 at 8:30 AM, Kent Overstreet
>> >> >> <kent.overstreet@gmail.com> wrote:
>> >> >> > On Wed, Apr 06, 2016 at 01:44:06AM +0800, Ming Lei wrote:
>> >> >> >> After arbitrary bio size is supported, the incoming bio may
>> >> >> >> be very big. We have to split the bio into small bios so that
>> >> >> >> each holds at most BIO_MAX_PAGES bvecs for safety reason, such
>> >> >> >> as bio_clone().
>> >> >> >>
>> >> >> >> This patch fixes the following kernel crash:
>> >> >> >
>> >> >> > Ming, let's not do it this way; drivers that don't clone biovecs are the norm -
>> >> >> > instead, md has its own queue limits that it ought to be setting up correctly.
>> >> >>
>> >> >> Except for md, there are also several usages of bio_clone:
>> >> >>
>> >> >> - drbd
>> >> >> - osdblk
>> >> >> - pktcdvd
>> >> >> - xen-blkfront
>> >> >> - verify code of bcache
>> >> >>
>> >> >> I don't like bio_clone() too, which can cause trouble to multipage bvecs.
>> >> >>
>> >> >> How about fixing the issue by this simple patch first? Then once we limits
>> >> >> all above queues by max sectors, the global limit can be removed as
>> >> >> mentioned by the comment.
>> >> >
>> >> > just do this:
>> >> >
>> >> > void blk_set_limit_clonable(struct queue_limits *lim)
>> >> > {
>> >> > lim->max_segments = min(lim->max_segments, BIO_MAX_PAGES);
>> >> > }
>> >>
>> >> As I memtioned it is __not__ correct to use max_segments, and the issue is
>> >> related with max sectors, please see the code of bio_clone_bioset():
>> >
>> > I know how bio_clone_bioset() works but I'm not seeing how that has anything to
>> > do with max sectors. The way it copies the biovec is not going to merge
>> > segments, if the original bio had non full page segments then so is the clone.
>>
>> OK, I see, now it is a totally new limit, and no current queue limit can fit
>> the purpose.
>>
>> Looks we need to introduce the new limit of io_max_vecs, which can be
>> applied into blk_bio_segment_split().
>>
>> But a queue flag should be better than queue limit since it is a 'limit' from
>> software/driver.
>
> Why is max_segments not appropriate?

Now limit.max_segments is for limiting segments from hw view, one this
segment may include lots of pages/bvecs.

The current bio_clone() issue is that we can't clone from one bio which
includes more than 256 bvecs, maybe all these 256 bvecs belong to
one same hw segment.


Thanks,
Ming

> --
> To unsubscribe from this list: send the line "unsubscribe linux-block" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html

\
 
 \ /
  Last update: 2016-04-06 04:41    [W:0.060 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site