From patchwork Sat Aug 10 07:38:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 2842383 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F8EDBF546 for ; Sat, 10 Aug 2013 07:43:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 732E6201E5 for ; Sat, 10 Aug 2013 07:42:59 +0000 (UTC) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mail.kernel.org (Postfix) with ESMTP id 7422D201E3 for ; Sat, 10 Aug 2013 07:42:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r7A7cxR4007766; Sat, 10 Aug 2013 03:39:01 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r7A7cwSY005164 for ; Sat, 10 Aug 2013 03:38:58 -0400 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r7A7cw8i004026 for ; Sat, 10 Aug 2013 03:38:58 -0400 Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7A7cuDS010447 for ; Sat, 10 Aug 2013 03:38:57 -0400 Received: by mail-pb0-f43.google.com with SMTP id md4so5231299pbc.16 for ; Sat, 10 Aug 2013 00:38:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=ER9itBBdIHMx6U7NPosHZI5OmLTTpWv+rABQ9zAJ698=; b=A2Znzi/yQ1WIDInwI0kx55arwKA7MO8vqOpcz1Lutu9txa3H/H3r8A2JeHPMVSYfi4 P8B4wm8AuGxbYm+buV3b3fu3jF6UN9YZW1gNoeVY66cQXtDEW1CqhhtdaqnuDW84Ce/5 0F9ct3XZ4IQEW4Ll4+nEOSGwut+fEMjtn4K3Gua+7ZqyRwWJPPFYuJsKwF+Qpuuxhd2p ARGocHE/QCtKP2ytbq3ehjpEW6NsuLriiIVRp5RVK4bmJA8d7Jk27THl5WUPG6rC7KJM SwTcKs4MLmU/QdoRtAZcaBklszBC37zuU/sV9eYjl4Tc6Hs2OcsMEhdgfK5K2i396b4m 8dMw== X-Gm-Message-State: ALoCoQnU2pz8VqVmsi2v4rAoNZ/InZMjMzx19Sl3Sb03wCQEvqfECw2PeHu2rysBB/gkS2/kwNoM X-Received: by 10.68.169.97 with SMTP id ad1mr14839029pbc.84.1376120335954; Sat, 10 Aug 2013 00:38:55 -0700 (PDT) Received: from kmo-pixel (c-107-3-149-94.hsd1.ca.comcast.net. [107.3.149.94]) by mx.google.com with ESMTPSA id yq2sm3081291pbb.25.2013.08.10.00.38.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 10 Aug 2013 00:38:55 -0700 (PDT) Date: Sat, 10 Aug 2013 00:38:55 -0700 From: Kent Overstreet To: axboe@kernel.dk Message-ID: <20130810073855.GA9349@kmo-pixel> References: <1375912471-5106-1-git-send-email-kmo@daterainc.com> <1375912471-5106-19-git-send-email-kmo@daterainc.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1375912471-5106-19-git-send-email-kmo@daterainc.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-RedHat-Spam-Score: -2.999 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_LOW, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [dm-devel] [PATCH 18/22] block: Generic bio chaining X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Aug 07, 2013 at 02:54:27PM -0700, Kent Overstreet wrote: > This adds a generic mechanism for chaining bio completions. This is > going to be used for a bio_split() replacement, and some other things in > the future. > > This is implemented with a new bio flag that bio_endio() checks; it > would definitely be cleaner to implement chaining with a bi_end_io > function, but since there's no limits on the depth of a bio chain (and > with arbitrary bio splitting coming this is going to be a real issue) > using an endio function would lead to unbounded stack usage. > > Tail call optimization could solve that, but CONFIG_FRAME_POINTER > disables gcc's tail call optimization (-fno-optimize-sibling-calls) - so > we do it the hacky but safe way. Btw, if you saw this patch and went "Wtf? What's the justification for inflating struct bio and sticking another atomic op in the fast path?" - here's the justification: The below patch gets me a 5% increase in throughput (doing 4k random reads, and on one core on an old gulftown so cpu bound). (it also considerably simplifies a lot of random code, but there's a real performance win to drivers handling arbitrary size bios so upper layers don't have to care). >From a6b23c56c722ffbf30ca78c14d21dd8615e11474 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sat, 10 Aug 2013 00:14:03 -0700 Subject: [PATCH] mtip32xx: handle arbitrary size bios --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 3ea8234..058d86c 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -2645,24 +2645,6 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t sector, } /* - * Release a command slot. - * - * @dd Pointer to the driver data structure. - * @tag Slot tag - * - * return value - * None - */ -static void mtip_hw_release_scatterlist(struct driver_data *dd, int tag, - int unaligned) -{ - struct semaphore *sem = unaligned ? &dd->port->cmd_slot_unal : - &dd->port->cmd_slot; - release_slot(dd->port, tag); - up(sem); -} - -/* * Obtain a command slot and return its associated scatter list. * * @dd Pointer to the driver data structure. @@ -3913,21 +3895,22 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) sg = mtip_hw_get_scatterlist(dd, &tag, unaligned); if (likely(sg != NULL)) { - if (unlikely((bio)->bi_vcnt > MTIP_MAX_SG)) { - dev_warn(&dd->pdev->dev, - "Maximum number of SGL entries exceeded\n"); - bio_io_error(bio); - mtip_hw_release_scatterlist(dd, tag, unaligned); - return; - } - /* Create the scatter list for this bio. */ bio_for_each_segment(bvec, bio, iter) { - sg_set_page(&sg[nents], - bvec.bv_page, - bvec.bv_len, - bvec.bv_offset); - nents++; + if (unlikely(nents == MTIP_MAX_SG)) { + struct bio *split = bio_clone(bio, GFP_NOIO); + + split->bi_iter = iter; + bio->bi_iter.bi_size -= iter.bi_size; + bio_chain(split, bio); + generic_make_request(split); + break; + } + + sg_set_page(&sg[nents++], + bvec.bv_page, + bvec.bv_len, + bvec.bv_offset); } /* Issue the read/write. */ @@ -4040,6 +4023,7 @@ skip_create_disk: blk_queue_max_hw_sectors(dd->queue, 0xffff); blk_queue_max_segment_size(dd->queue, 0x400000); blk_queue_io_min(dd->queue, 4096); + set_bit(QUEUE_FLAG_LARGEBIOS, &dd->queue->queue_flags); /* * write back cache is not supported in the device. FUA depends on