Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1347163pxb; Fri, 6 Nov 2020 07:25:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwGo4+ls4u5D2MyAQT3oilMwW37Qg1VlKBUpuLpebhAmqaWScxJ1HXwEMzpcBpKPtmvjsZ X-Received: by 2002:a17:906:ec9:: with SMTP id u9mr2537346eji.400.1604676343342; Fri, 06 Nov 2020 07:25:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604676343; cv=none; d=google.com; s=arc-20160816; b=vA7zeLpEYmUsqYqmF7mrW46FvX7vqZ1mwHUcI+4SRRQEZVr0NjkI+jjW/piIo+LjWI k4qTMSRiG1gS2RU2uslCkdWBQiGKlrrFXK/fhz6qe2j7KRmUW30Cqw9UUq8LHj4qxM2g WkQDFNHyOC5jYp3YxF9Hn2WNjuYJoF89vpMszafzGLEAvWDUUmhNWThveztrmqX0UyLq 91tJ9QpKt468nddJfp3mHGIb4iOX+lALfRxHhHjwqYD4Tra0YBiLbkqeJmDa+vXfxd7O 2R3oAmXrUn/Okxuq1mMX1J2vRAJk6Zx/l6IurPRb2i+Bl7REyV+UTPQm7iKcSvUq5to2 IbOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=gtLuAYXrlaU0hbaqYajfTStS7KDqOPQPneTx+0rzWpE=; b=axKjjc/bgGMpvhfrXbl50R6RL0CIJAuCB1bYoB4NNT0zAMPxvJDpk3pNlfSFzdHDL7 U05EJF7eMULix7cvBp8N7iw2QHnVrVT1oyRtVNsQvb8HDlmYPn0IRNuy5YLuuF2T6/tC pTO5HQXtF4Bb6+YGZtOAODd6Q3or4mfikFW4SY77eaIbbEU0lW+DDfFPhgkmQcwyKjYV +mxIQl6gFsmZVyt00e5zaZHZQJm0h4Bqe4o5RGDTVHIHnQFbIXOFsEBenNgRbNHySswE 1vrsewy5k9de/Zld4B7/6X++Zs87P0V6umKmGKbw5dYmOboHNheiCjJW0/imGSKtPW71 MKHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oecZkBnH; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=uOEYaONJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o16si1015427eja.345.2020.11.06.07.24.57; Fri, 06 Nov 2020 07:25:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=oecZkBnH; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=uOEYaONJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727639AbgKFPXe (ORCPT + 99 others); Fri, 6 Nov 2020 10:23:34 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:36024 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726812AbgKFPXd (ORCPT ); Fri, 6 Nov 2020 10:23:33 -0500 Date: Fri, 6 Nov 2020 16:23:29 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1604676211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gtLuAYXrlaU0hbaqYajfTStS7KDqOPQPneTx+0rzWpE=; b=oecZkBnHsmqmlAcxFE/V/ZxyMTKkH0OoslfUnscBSsp/oSawPcrcxjMPsGlS+xKKQRY1Un c3kpY9oYrVLsJBLZed65wjzG2X6e63kA2/hpxaXZTs2/l4HieIs9zEl0bMmn2fgvgi+M8u 1pzbzHlR1b2SMbUc1H3E54Bef/FzAWvjNwYWeIWVMpACCj6hbSs28ahhAfhdNja9bwHQbV jkHDMPWJiCyIMcUkcdd2+E5JJGTBde0QGOUndFOckyPJh8SF/7FGnc6VXHkZDvileQcRXx x+li+gPQC17FEF1TLUIZphGcVQiv8VUiSDLbdzAbwVM8Z7tbxQEZdsfqeT0OAA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1604676211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gtLuAYXrlaU0hbaqYajfTStS7KDqOPQPneTx+0rzWpE=; b=uOEYaONJz22IL6804wmaEva2hvTRTSJt3LvyCppRrt5KlNPFOznNZkB9Q1k+GE2wKnw9nV Br0TyB7B8uZ+y3BA== From: Sebastian Andrzej Siewior To: Christoph Hellwig Cc: Jens Axboe , Sagi Grimberg , linux-block@vger.kernel.org, Thomas Gleixner , David Runge , linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Daniel Wagner , Mike Galbraith Subject: Re: [PATCH 3/3] blk-mq: Use llist_head for blk_cpu_done Message-ID: <20201106152329.4vms2hk7dlzyojfw@linutronix.de> References: <20201029140536.GA6376@infradead.org> <20201029145623.3zry7o6nh6ks5tjj@linutronix.de> <20201029145743.GA19379@infradead.org> <20201029210103.ocufuvj6i4idf5hj@linutronix.de> <20201031104108.wjjdiklqrgyqmj54@linutronix.de> <3bbfb5e1-c5d7-8f3b-4b96-6dc02be0550d@kernel.dk> <20201102095533.fxc2xpauzsoju7cm@linutronix.de> <20201102181238.GA17806@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201102181238.GA17806@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-11-02 18:12:38 [+0000], Christoph Hellwig wrote: > > to not break that assumption you just mentioned and provide > > |static inline void blk_mq_complete_request_local(struct request *rq) > > |{ > > | rq->q->mq_ops->complete(rq); > > |} > > > > so that completion issued from from process context (like those from > > usb-storage) don't end up waking `ksoftird' (running at SCHED_OTHER) > > completing the requests but rather performing it right away. The softirq > > dance makes no sense here. > > Agreed. But I don't think your above blk_mq_complete_request_local > is all that useful either as ->complete is defined by the caller, > so we could just do a direct call. In usb-storage case it is hidden somewhere in the SCSI stack but this can probably be changed later on. > Basically we should just > return false from blk_mq_complete_request_remote after updating > the state when called from process context. But given that IIRC > we are not supposed to check what state we are called from > we'll need a helper just for updating the state instead and > ensure the driver uses the right helper. Now of course we might > have process context callers that still want to bounce to the > submitting CPU, but in that case we should go directly to a > workqueue or similar. So instead blk_mq_complete_request_local() you want a helper to set the state in which the completion function is invoked. Sounds more like an argument :) > Either way doing this properly will probabl involve an audit of all > drivers, but I think that is worth it. I'm lost. Should I repost the three patches with a preempt_disable() section (as suggested) to not break preemptible callers? And then move from there to provide callers from preemtible context an alternative? Sebastian