Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2902339ybh; Sat, 25 Jul 2020 05:11:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcIyZ+0GJNeN000AD6LTTcD87S4o+zm145wxgDzbbwBXHFB8/OHf0VFifusoLWgFS4MLJJ X-Received: by 2002:a17:906:1104:: with SMTP id h4mr4225958eja.456.1595679112598; Sat, 25 Jul 2020 05:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595679112; cv=none; d=google.com; s=arc-20160816; b=OYeTkacUuM0Z2JwCF2xolYahTDYk8agLDob/Yd6i9ArIKlCxnIjMeSqWgYqM2JV8Dr WnqYxN18+SyHL7xbZtR1gDqSNki2TupRpCM0LzKJjv7kh11Ih4fZ6zpizod5P/ZI0EKb XBNLepDFOsm9QZ81csRDz7tw4RXF0l5AyBfQhMmQbBzRLjRcfTk3CpIBnTGrjbfBANJN PETGsbJNoJNIeJWSxI9tkOqGWpz6gzQdwvYmRiPSP0bvTLcsrPd9Vl65FDMt+m1pP6c2 z33ch9R6y4iQppa7+ouz9DJ5CZpw8E5XeZGfoP7Bz15HrOL2Pf/VAeyydDTRXq5Gfz5K eD7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date:dkim-signature; bh=cX1tFV3emxg9yfsgaVntCpS4tVXgOHg8Y2N49c2Rl6o=; b=GEe858x0D6DPW1fIbVzZwYTX8ZYH7qEklLg/r2ITHyTKmjrkyPxHIGTX/hTguIDIh9 QRYnkT0jmR2/wLt5PZCnTu0BLel9xmxyWHS9TBVDQeDkLXcWCwmpedOSIKG7DYvnYREf zZGk/906V16OSfNg/2LXkB3ht/YrLZisSpts0cdS2cE/0eJiC7WTfKxMkoA1VxOCQr3X RgJTBoRJA4bvcr64Fbw61LtpcI8kp0v73W0JawudsKtZwJgUEyU73dOs58u84+5BJB/2 jNVEIlW0YfCqMoTAZoCOLwV9ECI17OxMio4mE18EZHdVFjNk/+4qetATtOk0xS+Gts69 6FwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="L/x8l1MZ"; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u14si2236061edq.122.2020.07.25.05.11.29; Sat, 25 Jul 2020 05:11:52 -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=@kernel.org header.s=default header.b="L/x8l1MZ"; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726777AbgGYMIf (ORCPT + 99 others); Sat, 25 Jul 2020 08:08:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:51120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726612AbgGYMIe (ORCPT ); Sat, 25 Jul 2020 08:08:34 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E179720674; Sat, 25 Jul 2020 12:08:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595678914; bh=P2fyKAWwICs4KEcQ2YA/VKfeCFmFjqOOBXeOxw6GlGk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=L/x8l1MZX478b7h9FDYbNhu7NRy1DqkzZgprkEm70nR6lQLWl8AiC5xbyue8hWeTI ws+ekbetSwqxDRzTc4o9eqmi2ljk0ZWqSWoI1QAmrREmQjdT1GT/ZNoIcZHAz6eYYJ VGub7fgLrn0IbSNQTOpUl5YeicOhSn9D1XDAO8J8= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jzIye-00Epz5-2N; Sat, 25 Jul 2020 13:08:32 +0100 Date: Sat, 25 Jul 2020 13:08:31 +0100 Message-ID: <875zabyeyo.wl-maz@kernel.org> From: Marc Zyngier To: Thomas Gleixner Cc: John Keeping , LKML , x86@kernel.org, Ben Herrenschmidt , Ali Saidi , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH V2] genirq/affinity: Handle affinity setting on inactive interrupts correctly In-Reply-To: <87h7twu1cp.fsf@nanos.tec.linutronix.de> References: <87k0z2s2q3.fsf@nanos.tec.linutronix.de> <877dv2rv25.fsf@nanos.tec.linutronix.de> <20200724182422.27ddced6.john@metanate.com> <87h7twu1cp.fsf@nanos.tec.linutronix.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/26.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: tglx@linutronix.de, john@metanate.com, linux-kernel@vger.kernel.org, x86@kernel.org, benh@amazon.com, alisaidi@amazon.com, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi both, On Fri, 24 Jul 2020 21:03:50 +0100, Thomas Gleixner wrote: > > John, > > John Keeping writes: > > On Fri, 17 Jul 2020 18:00:02 +0200 > > Thomas Gleixner wrote: > > It seems that this patch breaks perf events on RK3288 because the PMU > > interrupts that should be per-cpu are now all on CPU0 so no events are > > collected from CPUs 1-3 and those interrupts are killed as spurious > > after a few seconds. SPI-backed PMUs. Urgh... > > > > I'm seeing this on 4.19.134 and 5.4.53 but as far as I can tell the > > relevant code hasn't changed through to next-20200723. Reverting the > > backport of this change fixes the problem. > > Bah. > > > It looks like what happens is that because the interrupts are not > > per-CPU in the hardware, armpmu_request_irq() calls irq_force_affinity() > > while the interrupt is deactivated and then request_irq() with > > IRQF_PERCPU | IRQF_NOBALANCING. > > > > Now when irq_startup() runs with IRQ_STARTUP_NORMAL, it calls > > irq_setup_affinity() which returns early because IRQF_PERCPU and > > IRQF_NOBALANCING are set, leaving the interrupt on its original CPU. > > Right. My brain tricked me to believe that we made activation mandatory, > but that's not. > > I have some ideas for a trivial generic way to solve this without > undoing the commit in question and without going through all the irq > chip drivers. So far everything I came up with is butt ugly. Maybe Marc > has some brilliant idea. Not really. We have contradicting behaviours here, where some interrupts want to see the set_affinity early (the above case), and some cannot handle that (x86 vectors and the GICv3 ITS). We could key it on the presence of an activate callback, but it feels fragile. I'll follow up on your patch in the next email, which seems like a sensible approach. M. -- Without deviation from the norm, progress is not possible.