Received: by 10.213.65.68 with SMTP id h4csp842989imn; Wed, 4 Apr 2018 08:10:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx48dvffpWTrjnO9HcJscxxfMmZR+4Q7iaMwDE0ZJFFOHLWq04kud/yFZkJlHxIiJlc3bdYDA X-Received: by 2002:a17:902:5609:: with SMTP id h9-v6mr18929645pli.121.1522854603463; Wed, 04 Apr 2018 08:10:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522854603; cv=none; d=google.com; s=arc-20160816; b=px3A/6vHhF9ML4w+N+1aOiM9NPljAkPREQRBtROjj8ao0G5t7vmQLL1hnhmGV7lnrl 1Ygxkdrtex5diTv32sZgzMMZScxnZ7J4HEnJpSWJqB4bn4wXm6a0wviplHWED/nFdYq6 jVEApPJWDxQC1drZ/uI0V37Di7ekbtwKaV7Ayy5YZR74ItymV4eFglfVlNFHz//fljhi ejNQBBY2bK3owCfFo8hLKw8xst2w2PHh7VHwAmjioH5NpXhYFY6H+kof7DN7KruJFZ/8 JGasAcdiNMgWc76Qmo7Rpl6zIoLHB2uA06SgWkRJGr2u7nOGVRj08fYIi3+4RT9S6R4f uI/Q== 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:arc-authentication-results; bh=7VQicPpmDqgeKm6unDBry1Qqq3kxNUuojwgvCEtCttA=; b=ozIFj3UDBMZ6ad4e6WqUGhBl/w9uv761jbaOdHu8FpZeSN/duD7/3aVmezS+AZDEE3 lK3QsAY7NlqtLYVf97Xx/OrBMTLoC2YpGK3oiEpgOUMhY9A5zsttngV7lYZC3HRxUaGO Na7sbsrFqlhviRFuHFa1orvOg0yP9q5PSNkySd5o7y+JCV3IClm3P+3hCdWiydmA850b WSWJ3aetcDxCb1PQS0X3JHUVhPvAS2Qlz5jVjPmX7s11teXqjswlYnGFAxCAzuQXDfmU DmAaZ6jGrrdEvj0lEu74y/BLe588cKWyAHz06jX0Nbvk/euRa0XNqDDKNbYLjjcT+T2L vg4w== 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 i16si3725984pgv.255.2018.04.04.08.09.49; Wed, 04 Apr 2018 08:10:03 -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 S1751726AbeDDPIX (ORCPT + 99 others); Wed, 4 Apr 2018 11:08:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46130 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751439AbeDDPIW (ORCPT ); Wed, 4 Apr 2018 11:08:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 58073406F890; Wed, 4 Apr 2018 15:08:21 +0000 (UTC) Received: from ming.t460p (ovpn-12-21.pek2.redhat.com [10.72.12.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CCB310B0F20; Wed, 4 Apr 2018 15:08:09 +0000 (UTC) Date: Wed, 4 Apr 2018 23:08:05 +0800 From: Ming Lei To: Thomas Gleixner Cc: Jens Axboe , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Laurence Oberman Subject: Re: [PATCH V3 4/4] genirq/affinity: irq vector spread among online CPUs as far as possible Message-ID: <20180404150759.GA24824@ming.t460p> References: <20180308105358.1506-1-ming.lei@redhat.com> <20180308105358.1506-5-ming.lei@redhat.com> <20180403160001.GA25255@ming.t460p> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 04 Apr 2018 15:08:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 04 Apr 2018 15:08:21 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 04, 2018 at 10:25:16AM +0200, Thomas Gleixner wrote: > On Wed, 4 Apr 2018, Ming Lei wrote: > > On Tue, Apr 03, 2018 at 03:32:21PM +0200, Thomas Gleixner wrote: > > > On Thu, 8 Mar 2018, Ming Lei wrote: > > > > 1) before 84676c1f21 ("genirq/affinity: assign vectors to all possible CPUs") > > > > irq 39, cpu list 0 > > > > irq 40, cpu list 1 > > > > irq 41, cpu list 2 > > > > irq 42, cpu list 3 > > > > > > > > 2) after 84676c1f21 ("genirq/affinity: assign vectors to all possible CPUs") > > > > irq 39, cpu list 0-2 > > > > irq 40, cpu list 3-4,6 > > > > irq 41, cpu list 5 > > > > irq 42, cpu list 7 > > > > > > > > 3) after applying this patch against V4.15+: > > > > irq 39, cpu list 0,4 > > > > irq 40, cpu list 1,6 > > > > irq 41, cpu list 2,5 > > > > irq 42, cpu list 3,7 > > > > > > That's more or less window dressing. If the device is already in use when > > > the offline CPUs get hot plugged, then the interrupts still stay on cpu 0-3 > > > because the effective affinity of interrupts on X86 (and other > > > architectures) is always a single CPU. > > > > > > So this only might move interrupts to the hotplugged CPUs when the device > > > is initialized after CPU hotplug and the actual vector allocation moves an > > > interrupt out to the higher numbered CPUs if they have less vectors > > > allocated than the lower numbered ones. > > > > It works for blk-mq devices, such as NVMe. > > > > Now NVMe driver creates num_possible_cpus() hw queues, and each > > hw queue is assigned one msix irq vector. > > > > Storage is Client/Server model, that means the interrupt is only > > delivered to CPU after one IO request is submitted to hw queue and > > it is completed by this hw queue. > > > > When CPUs is hotplugged, and there will be IO submitted from these > > CPUs, then finally IOs complete and irq events are generated from > > hw queues, and notify these submission CPU by IRQ finally. > > I'm aware how that hw-queue stuff works. But that only works if the > spreading algorithm makes the interrupts affine to offline/not-present CPUs > when the block device is initialized. > > In the example above: > > > > > irq 39, cpu list 0,4 > > > > irq 40, cpu list 1,6 > > > > irq 41, cpu list 2,5 > > > > irq 42, cpu list 3,7 > > and assumed that at driver init time only CPU 0-3 are online then the > hotplug of CPU 4-7 will not result in any interrupt delivered to CPU 4-7. Indeed, and I just tested this case, and found that no interrupts are delivered to CPU 4-7. In theory, the affinity has been assigned to these irq vectors, and programmed to interrupt controller, I understand it should work. Could you explain it a bit why interrupts aren't delivered to CPU 4-7? Thanks, Ming