Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4584584ybg; Mon, 8 Jun 2020 11:30:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSfU5hISudXuwP2Mqu1VbulnycZmyKQPvP7r01lcod7PsoBYwdWfOpHhULKGp90pvbCSgd X-Received: by 2002:a17:906:da05:: with SMTP id fi5mr22628487ejb.95.1591641045047; Mon, 08 Jun 2020 11:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591641045; cv=none; d=google.com; s=arc-20160816; b=tw9q4RdT2SqZHO28YKOiA3pemBIE++Go5J11p5N0gf7M6mspbScciLH3puKG/8X93Q LhRHovMme0X645V2h+N2ULXF+s6mbSuGXY+07BfHxRolMwmYCP0kjfKRRiqb8r5MPWkr NjOrmCuenGtOoOi/jpg05epIO3KPhvUjbwEw3qTdnguOz2awyZ0hf8LaLyEz6r5YeP/1 cKblRSedKudjvQNJOZ3aKxdWC0qW0HUaQLK1DvaiOC4MIDJ60afGmr4AvusEBLcjP2n2 ow47VGdqRx/hi1vUFv00O6skbY6guqzytXE5wZxPI8nGAxndPelQUvgkUYd1gksvOlXT m/qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=M4IpX9vCx5XU8eioIsU7NGWUWWO8cHPb1jHlxyOyyGg=; b=rNyV0wOBZhqBSFO5hEMXCU45AuUSC2JCC2EWvUO8jpJG+Qe39KJMFTRveN7u/BVP9l fVynURWmDwQ/3FjzGD7Kih7B5xVqyys+A9TLys3XVV7m8cX3Gm2VsEoAs7icW5Lw3NNM QDcWWRIJY2FlenvNUkaOk30YVufmgKaE2oyUWflUlDVTKH06fKGWpQ2PPEHSKHzza/hy oUd1+AVT+N5hVjju2iYJXJatVUStkkeHWhA9xiAlEVXzMOCHtJn4yNpAZJux8TG9KdLi x5BxgUtdX7tKEOmrElOFLP9yg31mNpwmKxrhKoG1KPndcmZxRXbUIex4/5ZIKA1L134X n62w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=opiquRzw; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c2si9904294edm.499.2020.06.08.11.30.16; Mon, 08 Jun 2020 11:30:45 -0700 (PDT) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=opiquRzw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730573AbgFHQdr (ORCPT + 99 others); Mon, 8 Jun 2020 12:33:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730568AbgFHQdo (ORCPT ); Mon, 8 Jun 2020 12:33:44 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8256DC08C5C2; Mon, 8 Jun 2020 09:33:43 -0700 (PDT) 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; bh=M4IpX9vCx5XU8eioIsU7NGWUWWO8cHPb1jHlxyOyyGg=; b=opiquRzwa1LbP1kzG+qTNZPWws W9qPVzkXvPnFamug755ST+UJF0z5Erpy5A9Wl8yKEfKulj8hdI/NCvo0tZIjAZSzzYrvGfJYfIf7U ayNiz65Ud/8ZVFfym/peXVOC+R+atRbvssLUNVjHEulEXzGCjd5029zpFdq330WhpnKSG81wVn9ef UtQzVO2xDVqC0jP8dewh4zsg02oLZKAgENgC3+weGMF+biS1TmOn5MVT8wIlozxuUybo5ONKAqBBh ZkCTmnLM2lumjjIDD+ZdXNiScGT1xERToKZ077yJYKLAPw5ocmY/MQtrUpYU7gGHh38dekys9+04U JHI16ilw==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiKiU-0005XO-DI; Mon, 08 Jun 2020 16:33:42 +0000 Date: Mon, 8 Jun 2020 09:33:42 -0700 From: Christoph Hellwig To: Peter Zijlstra Cc: Christoph Hellwig , Jens Axboe , frederic@kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Subject: Re: blk-softirq vs smp_call_function_single_async() Message-ID: <20200608163342.GA5155@infradead.org> References: <20200608115800.GA2531@hirez.programming.kicks-ass.net> <20200608154557.GA26611@infradead.org> <20200608155833.GC2531@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200608155833.GC2531@hirez.programming.kicks-ass.net> 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 On Mon, Jun 08, 2020 at 05:58:33PM +0200, Peter Zijlstra wrote: > > A request can only be completed once. > > Sure, but that doesn't help. > > CPU0 CPU1 > > raise_blk_irq() BLOCK_SOFTIRQ > IPI -> CPU1 > > // picks up thing from CPU0 > req->complete(req); > > > > > > trigger_softirq() > > > What happens to a struct request after completion, is it free()d > or reused? If reused, how do we guarantee CSD completion before > free()ing? The request is freed in the block layer sense by __blk_mq_free_request (which doesn't actually free the memory, so it eventually gets reused). __blk_mq_free_request is called from blk_mq_end_request which is called from the drivers ->complete_rq method, which is called from the block softirq. What is the method to guaranteed CSD completion?