Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5134622yba; Wed, 10 Apr 2019 12:07:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDDAAiMdn6szVuDug855nFd7ZMGLNfhWm7LbsNvyYfP4shR7bIhHC8yvlKrKV7OHCsStzj X-Received: by 2002:a63:4a5a:: with SMTP id j26mr42663196pgl.361.1554923245946; Wed, 10 Apr 2019 12:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554923245; cv=none; d=google.com; s=arc-20160816; b=QNYbUpxp4KMmDDAqkYb4aln6izHhyWg7if2dX/9OakBHSvBMsYSL/VIF0YwwPCyCug wSQjV27V+avafgdcJ4Lw2VBVyX1yZMEtOwXD96U6RiYctR/1yGvViYRpfqSYurztBVnn Kcd8kXIcRth7d3vuI+VeXmR5NtJLY/qIpxLtuFHi00nP53K9NugqEEz6VNODWKUADk8/ 6HMbCoHNIYq4TZbbgPQi3E8YF2jLDaE2VkIvymqywxHxrkBrVAdCdnKKylB5GHMWBYD1 2Bekram+NiJgAXvrsJJRZV0sHn53PRDTO5WLqP2mVyjdEyrZ1ZHkWR9fgdRaen53KgsP Vgyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=r9d+4HJ1YhTsTNJNafCIeJauD4NOh20rQoicT9MoGWc=; b=zEV75bi8pRbSUDPkFm7+rZm9qz52qzZMHWm4D2MYIWtYLi97UO8kWrgVd4A6CJP4Ol GqBCvMmlClWoy2VVkGNqhoc5MuLmQtr2aFLYyx6YFa1iAJHtxnPRq285diaGzDss9RWW nOJU0/MewodX3YzG8HMBQTTBwwYl/FdZAoJXrDO/7fjZbth1Or2NQkfle2q49/VH3LX1 PnTG5Pbs2IMf9okk0O9PBzHI+N2wFHlj880xpcBPf8Hg5Rxf9TecE8xJ3StHYXTKs7tg FWsqj7du1a8g4GwuZvweuoQddQ8jzbfBlUKKTOEjXGINRotKioC5+uxmFva9XIb8Y15i Xq1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=h6PyZat0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si32015583pll.268.2019.04.10.12.07.10; Wed, 10 Apr 2019 12:07:25 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=h6PyZat0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729801AbfDJRjG (ORCPT + 99 others); Wed, 10 Apr 2019 13:39:06 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:56930 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729786AbfDJRjF (ORCPT ); Wed, 10 Apr 2019 13:39:05 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3AHXqvJ073777; Wed, 10 Apr 2019 17:39:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : references : cc : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=r9d+4HJ1YhTsTNJNafCIeJauD4NOh20rQoicT9MoGWc=; b=h6PyZat0Ncx+Z1/u3SnZ+QCmYMdXMQ+Twv4/YLrpLAZ4CtluC25b5oWzeDLx6UkYbGz6 XplJZHpun3veGev9u5smWhIEuKSBBhvNhrSziKNWTntiGkZ7hqJVddfQDvsOdCls0voy DRVjkb0PPDEl8Q2UwJcEzzaO7Ficiu1GmmBBO3GjkjK8el2vekmmGTnRmz767sO93NXA VNubyf16jo5LQXCPTohHcC0rF3Bp1PtYMrF+VXPVPLaj1w7EA5tv5NT/aEZ/yLqBuKVb nRufNLIBm63MMFl66qf47nfjkK0WvmHPnNIYk+d8EVmcwy82SIQ6qVYStaEgY5Vi/D6U Vw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 2rphmempsu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Apr 2019 17:39:00 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3AHcQwU004824; Wed, 10 Apr 2019 17:38:59 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2rpj5bapkd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Apr 2019 17:38:59 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x3AHcvcN005911; Wed, 10 Apr 2019 17:38:59 GMT Received: from [192.168.2.8] (/106.39.148.99) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 10 Apr 2019 10:38:57 -0700 Subject: Re: [PATCH 1/1] blk-mq: do not splice ctx->rq_lists[type] to hctx->dispatch if ctx is not mapped to hctx To: axboe@kernel.dk References: <1554721973-32456-1-git-send-email-dongli.zhang@oracle.com> Cc: ming.lei@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org From: Dongli Zhang Message-ID: Date: Thu, 11 Apr 2019 01:38:47 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1554721973-32456-1-git-send-email-dongli.zhang@oracle.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9223 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904100118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9223 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904100117 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jens, On 04/08/2019 07:12 PM, Dongli Zhang wrote: > When a cpu is offline, blk_mq_hctx_notify_dead() is called once for each > hctx for the offline cpu. > > While blk_mq_hctx_notify_dead() is used to splice all ctx->rq_lists[type] > to hctx->dispatch, it never checks whether the ctx is already mapped to the > hctx. > > For example, on a VM (with nvme) of 4 cpu, to offline cpu 2 out of the > 4 cpu (0-3), blk_mq_hctx_notify_dead() is called once for each io queue > hctx: > > 1st: blk_mq_ctx->cpu = 2 for blk_mq_hw_ctx->queue_num = 3 > 2nd: blk_mq_ctx->cpu = 2 for blk_mq_hw_ctx->queue_num = 2 > 3rd: blk_mq_ctx->cpu = 2 for blk_mq_hw_ctx->queue_num = 1 > 4th: blk_mq_ctx->cpu = 2 for blk_mq_hw_ctx->queue_num = 0 > > Although blk_mq_ctx->cpu = 2 is only mapped to blk_mq_hw_ctx->queue_num = 2 > in this case, its ctx->rq_lists[type] will however be moved to > blk_mq_hw_ctx->queue_num = 3 during the 1st call of > blk_mq_hctx_notify_dead(). > > This patch would return and go ahead to next call of > blk_mq_hctx_notify_dead() if ctx is not mapped to hctx. > > Signed-off-by: Dongli Zhang > Reviewed-by: Ming Lei Would you consider this one? In addition to Ming's Reviewed-by, there is another Reviewed-by from Keith as in below link. https://lore.kernel.org/linux-block/20190408153627.GF32498@localhost.localdomain/ Thank you very much! Dongli Zhang > --- > block/blk-mq.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index a935483..9612746 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -2219,6 +2219,10 @@ static int blk_mq_hctx_notify_dead(unsigned int cpu, struct hlist_node *node) > enum hctx_type type; > > hctx = hlist_entry_safe(node, struct blk_mq_hw_ctx, cpuhp_dead); > + > + if (!cpumask_test_cpu(cpu, hctx->cpumask)) > + return 0; > + > ctx = __blk_mq_get_ctx(hctx->queue, cpu); > type = hctx->type; > >