Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3181748ybd; Mon, 24 Jun 2019 21:09:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyapN0wcMitd8EORcMg3n56tR1BxJShuH7tsizueLNHxILxt2ixXv2+nGh7Bx/tZnH7CtQc X-Received: by 2002:a63:e43:: with SMTP id 3mr12903414pgo.402.1561435749499; Mon, 24 Jun 2019 21:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561435749; cv=none; d=google.com; s=arc-20160816; b=zsqpu7SJpzch1wINbQUnVRY+6kxgWlCa/LWHBBbRLrsZGva3c1t3T+SnetIZEyRtY1 MHGZYDphkEGvMUCI70iKESIbtH/ssRNnkCxxhUruvO3t8nm7fyQmZ5Y308nveiC2NaIg zRSl05qKX3B4s+jALIv61WHNNepUCgOnr2KqVsHCA0CIsatV9KljI89b3bbWPusw2iJS PGIaeatR+jQEE3CfFJHXgZSk78x6Qg7nhqiVTEUkopfoOjBGcCuunTFtz+R7LudEyHya Ee1xYkZhC5zTYOfpHFXRvOE50RW+HPbmBlwsYnOBKrm1ePa+neCe7MDE9V/U5GyGj8CC St5A== 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; bh=GlcaEln41237AyWC19O8LbgUhmvRG3opk8AFDCpOGOM=; b=tmxexUS8iiD+QOVzxgbgPeG2Cl94DL4I0Of8YXvDznFDCy3khDF7NF0dbmdLar9SeJ AugmL6mMV9gn94e/nhn0MQtO0rXselvg42YBm+iVsRoc/BCHR2cqcHlG5a8DsEkPnzN6 ooGa4hFqh4ZqYkRAv4AYliCj6+bZIvm8Ksu7qMUM4qBGzt/VVgksagyaa5wNlu03Bpwe j4UwNh5HvLRFVhM0NdQSBesBWwUcU/IXRAwAAcTv5cgYbekahRNgWetL1Jrhn5Jc60Mh Oc/is1+bJaJH4rvIvEx5qo09t62bOjakg1gScJKLOonwyaEB9H4grO7ngxKaQ0S8Cb4i Dp5w== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c127si6637485pfa.20.2019.06.24.21.08.53; Mon, 24 Jun 2019 21:09:09 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730235AbfFYBz0 (ORCPT + 99 others); Mon, 24 Jun 2019 21:55:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51124 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729450AbfFYBz0 (ORCPT ); Mon, 24 Jun 2019 21:55:26 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 037DE308626C; Tue, 25 Jun 2019 01:55:26 +0000 (UTC) Received: from ming.t460p (ovpn-8-21.pek2.redhat.com [10.72.8.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF2CE5C277; Tue, 25 Jun 2019 01:55:17 +0000 (UTC) Date: Tue, 25 Jun 2019 09:55:13 +0800 From: Ming Lei To: Wenbin Zeng Cc: axboe@kernel.dk, keith.busch@intel.com, hare@suse.com, osandov@fb.com, sagi@grimberg.me, bvanassche@acm.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Wenbin Zeng Subject: Re: [PATCH] blk-mq: update hctx->cpumask at cpu-hotplug Message-ID: <20190625015512.GC23777@ming.t460p> References: <1561389847-30853-1-git-send-email-wenbinzeng@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1561389847-30853-1-git-send-email-wenbinzeng@tencent.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 25 Jun 2019 01:55:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 24, 2019 at 11:24:07PM +0800, Wenbin Zeng wrote: > Currently hctx->cpumask is not updated when hot-plugging new cpus, > as there are many chances kblockd_mod_delayed_work_on() getting > called with WORK_CPU_UNBOUND, workqueue blk_mq_run_work_fn may run There are only two cases in which WORK_CPU_UNBOUND is applied: 1) single hw queue 2) multiple hw queue, and all CPUs in this hctx become offline For 1), all CPUs can be found in hctx->cpumask. > on the newly-plugged cpus, consequently __blk_mq_run_hw_queue() > reporting excessive "run queue from wrong CPU" messages because > cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) returns false. The message means CPU hotplug race is triggered. Yeah, there is big problem in blk_mq_hctx_notify_dead() which is called after one CPU is dead, but still run this hw queue to dispatch request, and all CPUs in this hctx might become offline. We have some discussion before on this issue: https://lore.kernel.org/linux-block/CACVXFVN729SgFQGUgmu1iN7P6Mv5+puE78STz8hj9J5bS828Ng@mail.gmail.com/ > > This patch added a cpu-hotplug handler into blk-mq, updating > hctx->cpumask at cpu-hotplug. This way isn't correct, hctx->cpumask should be kept as sync with queue mapping. Thanks, Ming