Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4784204imu; Tue, 29 Jan 2019 07:28:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN7pC5OMOX9n524zFdEDgiV1bOxvZDBQf3X/Pb8anPuYWtb2Z4gY2eRBiRwyiQCn/yILE1OE X-Received: by 2002:a63:4f5e:: with SMTP id p30mr24041088pgl.71.1548775687381; Tue, 29 Jan 2019 07:28:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548775687; cv=none; d=google.com; s=arc-20160816; b=TkhSf8H+aHUI9qr3IhIunD1ykcY4nSXhyt2Qw7W7wZt3ZI4fh9goeWaXDnc1V0wMSx XlsYwA2wUe6Ad815gmT8af2O0NHqUh1kEnqae9ll9Xm50MJJA69Q9/uqiGS0y2+ur36r uekcQB1XKbBnZPaYtiCEU1KzYtYFH4e2I8/xXRuLw4rOM15gCr/tmtaLq01yctNu2LKQ bo8WXn3Veo1AUXws3lf+L690Pxub+U4qYKCokGUSL0rwAb6kXSHz6PUkik+5WlBfjRFF xZKidGChJafhtYLAz3GnsV0SK/d/waGGQh/8nwhe79G1sAuV7QIoPJZPS6Jl2KkaU8O+ u4XA== 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; bh=A52whyoQGJL1E89g+tsV4Si9NX5hrsbKcTphWvsQh/4=; b=aqSNSu/dcU7/qRvbh9qInLZRHkns+qmFNLmRxVEVbeXE9SrqwBYfu6WPtr1X76ow5Z opvVDjpIRvdSjXmomlCqkjs+17RKiIijqw1m/Dg2khkKB/4pZrTBxhj1MyQ8ysIGWVnr L6XnWYXnmhZmTE6/qnUM7ZPpP0X1tgV2yQSddppq3rlbJX8IXClQOCMGfghqWXuTPTqy qYJxrk+WXLpfNDMFSI3XDXifvhfM373kWlv6CJNrWyBd0GGDk5BB27N4rgpHHD0Yptip /RhB15m6VDWuTWPDae3mlZ5ve27GwkjzurEgWKFI60YCRfupKg/MbYwCm9O4CcMP6J3S PvOQ== 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 e89si31030979plb.401.2019.01.29.07.27.50; Tue, 29 Jan 2019 07:28:07 -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 S1728023AbfA2P1j (ORCPT + 99 others); Tue, 29 Jan 2019 10:27:39 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3236 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725730AbfA2P1j (ORCPT ); Tue, 29 Jan 2019 10:27:39 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 8CCB182AC72F5AC071DE; Tue, 29 Jan 2019 23:27:35 +0800 (CST) Received: from [127.0.0.1] (10.202.226.43) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.408.0; Tue, 29 Jan 2019 23:27:26 +0800 Subject: Re: Question on handling managed IRQs when hotplugging CPUs To: Thomas Gleixner , Hannes Reinecke References: <5bff8227-16fd-6bca-c16e-3992ef6bec5a@suse.com> CC: Christoph Hellwig , Marc Zyngier , "axboe@kernel.dk" , Keith Busch , Peter Zijlstra , Michael Ellerman , Linuxarm , "linux-kernel@vger.kernel.org" , SCSI Mailing List From: John Garry Message-ID: Date: Tue, 29 Jan 2019 15:27:20 +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: 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 Hi Hannes, Thomas, On 29/01/2019 12:01, Thomas Gleixner wrote: > On Tue, 29 Jan 2019, Hannes Reinecke wrote: >> That actually is a very good question, and I have been wondering about this >> for quite some time. >> >> I find it a bit hard to envision a scenario where the IRQ affinity is >> automatically (and, more importantly, atomically!) re-routed to one of the >> other CPUs. Isn't this what happens today for non-managed IRQs? >> And even it it were, chances are that there are checks in the driver >> _preventing_ them from handling those requests, seeing that they should have >> been handled by another CPU ... Really? I would not think that it matters which CPU we service the interrupt on. >> >> I guess the safest bet is to implement a 'cleanup' worker queue which is >> responsible of looking through all the outstanding commands (on all hardware >> queues), and then complete those for which no corresponding CPU / irqhandler >> can be found. >> >> But I defer to the higher authorities here; maybe I'm totally wrong and it's >> already been taken care of. > > TBH, I don't know. I merily was involved in the genirq side of this. But > yes, in order to make this work correctly the basic contract for CPU > hotplug case must be: > > If the last CPU which is associated to a queue (and the corresponding > interrupt) goes offline, then the subsytem/driver code has to make sure > that: > > 1) No more requests can be queued on that queue > > 2) All outstanding of that queue have been completed or redirected > (don't know if that's possible at all) to some other queue. This may not be possible. For the HW I deal with, we have symmetrical delivery and completion queues, and a command delivered on DQx will always complete on CQx. Each completion queue has a dedicated IRQ. > > That has to be done in that order obviously. Whether any of the > subsystems/drivers actually implements this, I can't tell. Going back to c5cb83bb337c25, it seems to me that the change was made with the idea that we can maintain the affinity for the IRQ as we're shutting it down as no interrupts should occur. However I don't see why we can't instead keep the IRQ up and set the affinity to all online CPUs in offline path, and restore the original affinity in online path. The reason we set the queue affinity to specific CPUs is for performance, but I would not say that this matters for handling residual IRQs. Thanks, John > > Thanks, > > tglx > > . >