Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp687816imp; Wed, 20 Feb 2019 07:20:33 -0800 (PST) X-Google-Smtp-Source: AHgI3IY/CylopT1kLW7GkpTd1tXxL2rSe7p5VBaTfPp7TkPDGmYf1IhQiCBJeVOgW25mOqoof0iF X-Received: by 2002:a63:6605:: with SMTP id a5mr8509118pgc.372.1550676033435; Wed, 20 Feb 2019 07:20:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550676033; cv=none; d=google.com; s=arc-20160816; b=J9HCpemMrZjp7IbC4UZ7yVAbfA/qnSvxfEVzt5Q2GsZtX/frdOh3IoQSZS1/UnvC3e EiyEPz+J0CfHIGRWWlXDZYSdHhPCSwOcV/KHz/JSuI0JRpUNXSAl6U/LTfbJdSX63Pib a9ffexd8P5QSQMeRhl/iZNupYnQfoIvw2fJ251Fc7RP8vjhmg8eXDKx2unaI02ffj7XM wHN7ati6PxMvCpMZNYxoh8av/XmYFcTGY7yuYA5Zn1N2isiqPatbXo/A/6PYlmfYaJw+ J9PbugeGkq4ncBQdcv3O0Xk4+gSitV5cUlSbsUzzI1sPond7IMRcTTf/I9yOwtsrFoWk b/Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7hwJ79++Shx+4Pia+3d7v96K7JWV3YhXvyHHKM9gzq8=; b=eoUfksYHPm1E+adnuc/b3Qar1rZFTs1qBHca2ntqa+RjY0z7McVDZ5hU1+9G5o4a22 sLXzDYhC9a6Uf1ZBu0ppx36AROKnllC4+jJZ0gSc5FZk64hLqRJvD+UsBvt+CIckG2nC 8OmbQiEVNSD7js7lSJn39O1V6PTQ45hQbuBl08dWdC+lEqcWfptj/8I4vyXDcnzGk5oc EJhN08sGg/iMkoDq+xtIvOhvQcCejNm62dwgE38exC0LrzzOsd/QnTE3snqujhmYyPp3 79kmfyok9Sv+XP+Ix/wKx+RFlc/5GWpHuiO3cpPI1Q1Z1GMb7QqtbTT4Vg4pzuGpDbUF quag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NRUKcwhR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h127si17367424pgc.407.2019.02.20.07.20.17; Wed, 20 Feb 2019 07:20:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NRUKcwhR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727083AbfBTPSp (ORCPT + 99 others); Wed, 20 Feb 2019 10:18:45 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:36852 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725804AbfBTPSo (ORCPT ); Wed, 20 Feb 2019 10:18:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7hwJ79++Shx+4Pia+3d7v96K7JWV3YhXvyHHKM9gzq8=; b=NRUKcwhR74wlQ8DuPeEjdb/d3 4XQ8B+3bbLvpQ4CwrRtx/SaoyNOyVWiJuOGmc7O1wO57v4AvkLjjWCD+QEHoc0LSr8U2rnXFs8iyB 3zE5wqU7zAaEe02oHsLea9UF3qYmkRT4s3U6xXEv3+g5+04Nis+zpyDyO4SAhzL+xZyc+LfNiJxpc veBNvXr+1SySy+hUovI1u2EDl7Y7VHrUFUzXPPdnhphArYm4EeYThB7+voy9cgJ+pUH79ObeFnatX ZxiAXR4YO1wjRa/EzWqTg4mp7qSyPWgJv8fB7+ywcrGRmPjJWtV3mdwaVQCFHnZ/fiduY7DTpjkeY E+bUzNM5w==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwTds-000458-VW; Wed, 20 Feb 2019 15:18:36 +0000 Date: Wed, 20 Feb 2019 07:18:36 -0800 From: Christoph Hellwig To: Bart Van Assche Cc: Jason Yan , martin.petersen@oracle.com, jejb@linux.vnet.ibm.com, Jens Axboe , Christoph Hellwig , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, hare@suse.com, dan.j.williams@intel.com, jthumshirn@suse.de, Steffen Maier Subject: Re: [RFC PATCH] scsi: fix oops in scsi_uninit_cmd() Message-ID: <20190220151836.GA11695@infradead.org> References: <20190219072743.13606-1-yanaijie@huawei.com> <1550595388.31902.133.camel@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1550595388.31902.133.camel@acm.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [fullquote removed, please follow proper mail etiquette] On Tue, Feb 19, 2019 at 08:56:28AM -0800, Bart Van Assche wrote: > regression in the SCSI sd driver due to the switch from the legacy block > layer to scsi-mq. The above patch introduces two atomic operations in the > hot path and hence would introduce a performance regression. I think this > can be avoided by making sure that sd_uninit_command() gets called before > the request tag is freed. What changes would be required to make the block > layer core call sd_uninit_command() before the request tag is freed? Would > introducing prep_rq_fn and unprep_rq_fn callbacks in struct blk_mq_ops and > making sure that the SCSI core sets these callback function pointers > appropriately be sufficient? Would such a change allow to simplify the NVMe > initiator driver? Are there any alternatives to this approach that are more > elegant? Additional indirect calls in the I/O fast path is something I'd rather avoid. But I don't fully understand the problem yet - where do we release a disk reference from blk_update_request? And why can't we move that release to __blk_mq_end_request? > > Thanks, > > Bart. ---end quoted text---