Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4895395imu; Tue, 29 Jan 2019 09:15:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN73yZqlNgTJXg2sxElG9bw4L4b4DyLb4QlqFCKuZ8Kw4mvJ6xNYhT+uAsmK2iQtVAT090gY X-Received: by 2002:a65:63d3:: with SMTP id n19mr24734336pgv.179.1548782143574; Tue, 29 Jan 2019 09:15:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548782143; cv=none; d=google.com; s=arc-20160816; b=OAcRcELo3lDQ71k3tgsQlJdwwkLwcQPt6D/5dJ64Y+HexFqY5Pw6s7bGDXpyy611Mc sCMgE0c4ULI55OWotwhehdtmplywgM/g7war/VELhQqJFaiwyCUk+qdv+LoABm6FhI2k VJxa2KlWWvY7HiRYdkNRSdUqhr8fVo8+jNKCRoMradJEjRmh3jDLLDDY64a8M4U4BStv A1OVJtVmwDpB/rVF9sT1XV4ylscUE+tO35HNq5I/Vr7ivxgk5mOIjMzGHiCKnqcGXkIU YUnzI0nTufBywRjOeuq4ggSfmJfQMY7bnAUDwV9LLYa7KmZB+aAqVjk6eJvZaa3590lc iDVA== 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:cc:references:to:subject :from; bh=cCgCzg7Em2l8mgulTDWaPz7y2Y9NzVAEFugOmw9fuis=; b=iWTHLsrqfkhTfDoRiuKEruwlEdrUUGg7xjnOlI3SboyWZ6aaNKhexUylYn00jSrdiq H7/jZ6HT4KcliuO3opBHGrzyBXWz2M7+prQHt3KhHjYobU2pHmk13Un0WHqxtijSDGUO 4a5OnOd6K48jHFHKFx0BDFDFwgzPAeoHf0L2C5KXK10NKuvU88++6IhHw2SWl12lctWq eZ33+2NgRQqFWx2vmMkZrz0Ur2O4P8IjsW+6Com7/25Bx0lOYkK59VZav03u2kauFRGd wFiLvRTqiK6+3PxX3EQdIBU93FeQXdky3d0OMt0mGXDr+B+TGcnBy1/2oU1pC7sOFKLN FYhg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l10si39157402pls.162.2019.01.29.09.15.17; Tue, 29 Jan 2019 09:15:43 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728997AbfA2RNC (ORCPT + 99 others); Tue, 29 Jan 2019 12:13:02 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3237 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728379AbfA2RNC (ORCPT ); Tue, 29 Jan 2019 12:13:02 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 3951922AE9A7DD864459; Wed, 30 Jan 2019 01:12:58 +0800 (CST) Received: from [127.0.0.1] (10.202.226.43) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.408.0; Wed, 30 Jan 2019 01:12:47 +0800 From: John Garry Subject: Re: Question on handling managed IRQs when hotplugging CPUs To: Keith Busch References: <20190129154433.GF15302@localhost.localdomain> CC: "tglx@linutronix.de" , Christoph Hellwig , Marc Zyngier , "axboe@kernel.dk" , Peter Zijlstra , Michael Ellerman , Linuxarm , "linux-kernel@vger.kernel.org" , Hannes Reinecke Message-ID: <757902fc-a9ea-090b-7853-89944a0ce1b5@huawei.com> Date: Tue, 29 Jan 2019 17:12:40 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20190129154433.GF15302@localhost.localdomain> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.43] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/01/2019 15:44, Keith Busch wrote: > On Tue, Jan 29, 2019 at 03:25:48AM -0800, John Garry wrote: >> Hi, >> >> I have a question on $subject which I hope you can shed some light on. >> >> According to commit c5cb83bb337c25 ("genirq/cpuhotplug: Handle managed >> IRQs on CPU hotplug"), if we offline the last CPU in a managed IRQ >> affinity mask, the IRQ is shutdown. >> >> The reasoning is that this IRQ is thought to be associated with a >> specific queue on a MQ device, and the CPUs in the IRQ affinity mask are >> the same CPUs associated with the queue. So, if no CPU is using the >> queue, then no need for the IRQ. >> >> However how does this handle scenario of last CPU in IRQ affinity mask >> being offlined while IO associated with queue is still in flight? >> >> Or if we make the decision to use queue associated with the current CPU, >> and then that CPU (being the last CPU online in the queue's IRQ >> afffinity mask) goes offline and we finish the delivery with another CPU? >> >> In these cases, when the IO completes, it would not be serviced and timeout. >> >> I have actually tried this on my arm64 system and I see IO timeouts. > > Hm, we used to freeze the queues with CPUHP_BLK_MQ_PREPARE callback, > which would reap all outstanding commands before the CPU and IRQ are > taken offline. That was removed with commit 4b855ad37194f ("blk-mq: > Create hctx for each present CPU"). It sounds like we should bring > something like that back, but make more fine grain to the per-cpu context. > Seems reasonable. But we would need it to deal with drivers where they only expose a single queue to BLK MQ, but use many queues internally. I think megaraid sas does this, for example. I would also be slightly concerned with commands being issued from the driver unknown to blk mq, like SCSI TMF. Thanks, John > . >