Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1135772pxa; Thu, 13 Aug 2020 01:10:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkp6AXZEfbYjvXpolkU9R6V+311DaPZGjwkwrSxjJMnYRSWdshq67wPcjjhSKzrx6Qge7l X-Received: by 2002:a17:906:5246:: with SMTP id y6mr3629658ejm.316.1597306205547; Thu, 13 Aug 2020 01:10:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597306205; cv=none; d=google.com; s=arc-20160816; b=HzfGX4DSSo5hIIVRxTjfFel8IzkNj1X7BHKm2RLkf2JNKTb/mqCUnl6/8ZZ8OVesSz JLLO8djpiLn6vKiJyQfLeu66ZJi4Y2tdfNIdpeVG3c2o0X0LcAyJvLskTQWBsZBzNX09 Wx4nOmeEA//KiSjutjOy4BXj0wVfJ9+2lWCj8ZuV6CHfQOQYlHv42GgLeYuTAy5ZbnMt Qx4UIVvkodghf3QIBNDjF1KySOL5JUmt7SgZtRWkzrDy49v2I3Rlo6cbtGUoIRd3Ne73 Dpq82/W9Zg2zc7SZsH924jPlOMZYnQuPlH142HcXQIHH2W43dcNFXoLWjysGM/prNkp0 OiCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=okLOdd4hFigu3F8BJVOWQHTTv93/xVX4l7N8L/QNtPw=; b=ewa5S2ld9G2D7eDtIplHfiU4+3UJa2FWcSpTrD2bh1/v6cukGbTCa4t28uthH5OglF S7hDMSFkX2tJ+zGP88QYu7zP98DObEwCLOQDzprrIh5dPlf/tyImNNjX1FiSN7BPjV2c TtWsPkQ/wA4MTZgRV5CyZAV474gUy7/Fp54ZVU0wb451P5dRNr6E9H5hJnsq4E3uWa+e YgA2XtZ/V2uknDI1VqITjfOGqO9nNCPnPYIuwr77OC5aLCKezNPSVCFuxmMpD2tS8nsZ W8JHj1BXq5HIua8e/LMN6adQRgeR1JI4q3vHVa+u+Og6m8LavMgAuiTXAle5O07GHK+s E+xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iCF8GCR+; dkim=neutral (no key) header.i=@vger.kernel.org header.b=hGxrqA03; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ju9si2758148ejb.266.2020.08.13.01.09.42; Thu, 13 Aug 2020 01:10:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iCF8GCR+; dkim=neutral (no key) header.i=@vger.kernel.org header.b=hGxrqA03; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726591AbgHMIIt (ORCPT + 99 others); Thu, 13 Aug 2020 04:08:49 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:56930 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbgHMIIt (ORCPT ); Thu, 13 Aug 2020 04:08:49 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1597306127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=okLOdd4hFigu3F8BJVOWQHTTv93/xVX4l7N8L/QNtPw=; b=iCF8GCR+vz1Zr7a4sw4CrWOwg2Coe+3Atwa6XZPGJ0vulQKW6CQUFKKZP0YDkWp3PSMSuG +zny4uqgT9R6l2B0v3H0EPq9l2OK/2Cs+PbGgr0SIIUkhZ0MkKpzFqPSqUtrSZienATRje 2YBCbWKWZSYRGyD2FlYbcTeuB7SQ0QTwnzf1qoRXklulR0d/ig/rY+XLyTnWFYoqzh9Ulk TgAqGrzTn0cqmWI59vFs2ijjh1g2K+AsPgpGUzLECSM0d5E9rTDe9JkqrbGzlX71qo1wJy f2EHkKUqrSl52F+CtofuBBJOU3dMAafSuNjw7OLbkNwfFgZj6hBi+nrOLNyunA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1597306127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=okLOdd4hFigu3F8BJVOWQHTTv93/xVX4l7N8L/QNtPw=; b=hGxrqA03ITU7sVs4lNkl0pqnF8U5L9oMk/Y4jeyWjWhLA1NsXUyJNymgQNxPt7ncUOTsYB 88k+ATL2WPToHoCw== To: Yunfeng Ye Cc: Shiyuan Hu , Hewenliang , linux-kernel@vger.kernel.org Subject: Re: [PATCH] genirq/affinity: show managed irq affinity correctly In-Reply-To: References: Date: Thu, 13 Aug 2020 10:08:46 +0200 Message-ID: <877du355o1.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Yunfeng Ye writes: > The "managed_irq" for isolcpus is supported after the commit > 11ea68f553e2 ("genirq, sched/isolation: Isolate from handling managed > interrupts"), but the interrupt affinity shown in proc directory is > still the original affinity. > > So modify the interrupt affinity correctly for managed_irq. I really have no idea what you are trying to achieve here. 1) Why are you moving the !chip !chip->irq_set_affinity check out of irq_do_set_affinity() ? Just that the whole computation happens for nothing and then returns an error late. 2) Modifying irqdata->common->affinity is wrong to begin with. It's the possible affinity mask. Your change causes the managed affinity mask to become invalid in the worst case. irq->affinity = 0x0C; // CPU 2 - 3 hkmask = 0x07; // CPU 0 - 2 Invocation #1: online_mask = 0xFF; // CPU 0 - 7 cpumask_and(&tmp_mask, mask, hk_mask); --> tmp_mask == 0x04 // CPU 2 irq->affinity = tmp_mask; // CPU 2 CPU 2 goes offline migrate_one_irq() affinity = irq->affinity; // CPU 2 online_mask = 0xFB; // CPU 0-1, 3-7 if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { /* * If the interrupt is managed, then shut it down and leave * the affinity untouched. */ if (irqd_affinity_is_managed(d)) { irqd_set_managed_shutdown(d); irq_shutdown_and_deactivate(desc); return false; } So the interrupt is shut down which is incorrect. The isolation logic in irq_do_set_affinity() was clearly designed to prefer housekeeping CPUs and not to remove them. You are looking at the wrong file. /proc/irq/$IRQ/smp_affinity* is the possible mask. If you want to know to which CPU an interrupt is affine then look at /proc/irq/$IRQ/effective_affinity* If effective_affinity* is not showing the correct value, then the irq chip affinity setter is broken and needs to be fixed. Thanks, tglx