Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4487035ybg; Mon, 8 Jun 2020 09:01:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMZ/NRp6Zl+txa/T2BWV+LyKTabrHr8bEB95kl6JXmXybQvGrFwOEnPfGb4l02br+EZL65 X-Received: by 2002:a05:6402:b31:: with SMTP id bo17mr15392646edb.152.1591632118586; Mon, 08 Jun 2020 09:01:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591632118; cv=none; d=google.com; s=arc-20160816; b=EMDnhN7NBtCa1Q6oZCRLIU3pzqKWJ2mnkZ1ZXbkn+NSMuFgaZpEqpExW+P7uJdpsGb YBZUrJAXM9AA0oCHw71vbhs6CBTC1GnfH1Zb+/zSm5Eb72vXylzx+QETu80yMbwo4A3f IIIFiiWnPWu34RIE90v3IGvca8JAcv+BsDZ+TTVZavggTOqz6sC006oHt4LrY0R18oQH oYabzG67DqtNmyjE0HabgNF4a1MgxBSOyUKyj/0e2QE1IxV6MML8iWHscmJaNb8/CKLN Or5UT3gEwvnNBK1Z4zRJcXdL2FPqwoy8xjMVaI3MbcdWIVFqaMS/B30V63x61blkOD+x vh9A== 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=DEM1QDKLTuYOOAV2I363qwhe0+cOx/Bk4o+cESUxXqE=; b=j31ekJk9KYAS1iVUBuJq2vCIKBLaQEFUSyb+Bxcwc/JsWfVWaKpaBT20fBh1Hmorc9 ZqEh1Xnb/DJjbEgk6artY9uyX9mQmaNrHj0szfQW3qKrGPxpcjIDrz1Rp+r4cPfv+ZTn Lp8aN0Hcfg6kdb9osJOiQP2QLyF4mQllK07oK/HCdC+MHqol0rCFg3G89UpjD13RsBbV bAph4qLGkKxZjDJWS37Fecu6Gkk6YH4jPxsureqbivSpquV5inZhAtfJmz+HIO3a57er 0WQkUo1oGfeonS8l5bI0uNHkeYaMBjNBsI78pM8lj9KsQh9U2didoTLvBWSUN1Z+64Ac LGdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=weFVJmnC; 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 l23si8818946ejc.94.2020.06.08.09.01.34; Mon, 08 Jun 2020 09:01:58 -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=merlin.20170209 header.b=weFVJmnC; 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 S1730388AbgFHP64 (ORCPT + 99 others); Mon, 8 Jun 2020 11:58:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730327AbgFHP6z (ORCPT ); Mon, 8 Jun 2020 11:58:55 -0400 Received: from merlin.infradead.org (unknown [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4184FC08C5C2; Mon, 8 Jun 2020 08:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=DEM1QDKLTuYOOAV2I363qwhe0+cOx/Bk4o+cESUxXqE=; b=weFVJmnCgIuXHiX1FcPX4jyktF 671dE2T65mx/hrh7fhEyu2YrBO925nGmg65wEKQmp3j3Ig9l2cfMdUnmHxlOkZ0xT8j40xslP2cim vBei7k5h0Jmuecz9qD2mQ4dETBM4lt5rZ7LV9FOPTWkkRq5BwI9FipAWe/cCs8XLHdxQR4IMN2OP4 bwVhNEbFSuteAySoqFYP00cn9mBany+sJE31Fa/lV5B2fHo4fhIYpXIgqjRMyXB5wp9glL/IgA7uA fhZ7jzeHPiXKKaBKRnPIXa8pQJ2M/NJEMJBxyl6dSEF9YbJ+N4WXSB1Kz2f4shaXR22hmN/3pE477 cf4wsZbQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiKAW-0008Ip-Gb; Mon, 08 Jun 2020 15:58:36 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9FB92301DFC; Mon, 8 Jun 2020 17:58:33 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8B1392B3CE561; Mon, 8 Jun 2020 17:58:33 +0200 (CEST) Date: Mon, 8 Jun 2020 17:58:33 +0200 From: Peter Zijlstra To: Christoph Hellwig Cc: 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: <20200608155833.GC2531@hirez.programming.kicks-ass.net> References: <20200608115800.GA2531@hirez.programming.kicks-ass.net> <20200608154557.GA26611@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200608154557.GA26611@infradead.org> 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 08:45:57AM -0700, Christoph Hellwig wrote: > On Mon, Jun 08, 2020 at 01:58:00PM +0200, Peter Zijlstra wrote: > > Hi Jens, > > > > I've been going through smp_call_function_single_async() users and > > stumbled upon blk-softirq.c, which has: > > > > static int raise_blk_irq(int cpu, struct request *rq) > > { > > if (cpu_online(cpu)) { > > call_single_data_t *data = &rq->csd; > > > > data->func = trigger_softirq; > > data->info = rq; > > data->flags = 0; > > > > smp_call_function_single_async(cpu, data); > > return 0; > > } > > > > return 1; > > } > > > > What, if anything, guarantees rq->csd is not already in use at that > > time? > > 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?