Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp603961rwl; Fri, 7 Apr 2023 02:25:03 -0700 (PDT) X-Google-Smtp-Source: AKy350bfnQICZm3tkQflfo1kVKXKMZYX2RC1L1zzy8B6Zqx6CJ4JeyeOPfXYTSA6syCA8al4RzM1 X-Received: by 2002:a62:3816:0:b0:626:a9b:94b8 with SMTP id f22-20020a623816000000b006260a9b94b8mr1776201pfa.20.1680859503585; Fri, 07 Apr 2023 02:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680859503; cv=none; d=google.com; s=arc-20160816; b=NKLqBiYg5KPCaDm+j3g2c5+qPigQGgkIdve4ZPkdz3RHSs1elmbRX53h1nJHJteymZ CnDFuFIqQS++WV8bRmrPi6ZIdvzIkX+MSm4UcDYojjUM2JF489Ry8qM4BzFZ0ACwczdz X9qf40Bd7BerO1VG7T6lgAbNdCE0ecIPcx5T2NXWV800eseVj10Tdo/y2CF4NpLmJp1l Ld+EC662U5cMvjEDaOe1RM+oSD0WVPxM/eYjXI99ApIp2fQF5UsugNAmvFH1DeakCJLx 9c5vPm4pisjVbIl/XdIR4LgZXSKjjcU0KkunmUcNrhGJBvbu0Vz/sAnq/RJPW+sAHnFb cJug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=fpmKq2k1T1wRn0oxR94vC1z/h8Vl2j6iwi+7E3csX8k=; b=qXgwna31biydyJ5G6RPr/20sN0EdsFltT05sqOblukLhGlO0q/VMIRkGjvGf/UGrXM uvmU3tjsqRFTRbQJhl14k30vjbV1Exho44AkBjy1Xnm0pYBHwXopfSuWL9bq4QDq40Um 2Uo1IQ5YAGyE7W3poiKp6+suGLvGAfRkoIOOKM3F3fgwOiTENDnt+gUlTad2I0qJKy1a zvIxZ26d4t42MZ8AOGzAYSye/fwxIyJ8XYnf/gSfs95i/E9pNEncJzljQZ/Fu9HZa+CG XYXCe/CCpjFIG+BZZXjucyPlfMdoX8/Q9SwPjPjkaWYJ2P03RyWH5086csKpFz06TCaf kMzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dvw+b+Ik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a24-20020a631a58000000b0050f83a9e61fsi3205742pgm.278.2023.04.07.02.24.52; Fri, 07 Apr 2023 02:25:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dvw+b+Ik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S240293AbjDGJS0 (ORCPT + 99 others); Fri, 7 Apr 2023 05:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbjDGJSY (ORCPT ); Fri, 7 Apr 2023 05:18:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C52337EC9 for ; Fri, 7 Apr 2023 02:18:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5EC5765008 for ; Fri, 7 Apr 2023 09:18:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B756FC433D2; Fri, 7 Apr 2023 09:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680859102; bh=t1HngjIuZmsVjaSi1ERJkFnYtnt1+8LcEfGzDanZnlY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dvw+b+Ik0YfZdd9ze6DES2vlT1y6yTrBRHDPLvhVZiXLyfbMJhFr+aTAhEPPtxPg8 0YK2VY9xMpEopJYbt40wD1NHwZ1yK/AJ8IQ0i+0hkh00wpC0sd3Y1b0vidPofz7LMD TPU3o7Q9aMOGWn4+ZxyCdlzuyolV1UiFm0Otu0fiU2CTnHsJ5JYzRlpJoTWhqg3Q5a WVryz2yk+D/6UpdEp64uxoRZrXlw2kjDGgu35I5glR6UnGw56AcnLqJl3+6gYYFjRh OJN+5LoC/98v4ZFfeTmnzcbp0w4YPu1n6rIXhoCFV+Ac1Chp5HROt44xjOPP/EiN72 1VKfdfQmFIZgw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pkiEe-006ehG-Fr; Fri, 07 Apr 2023 10:18:20 +0100 Date: Fri, 07 Apr 2023 10:18:20 +0100 Message-ID: <86lej4uk2r.wl-maz@kernel.org> From: Marc Zyngier To: Radu Rendec Cc: Marek =?UTF-8?B?QmVow7pu?= , linux-kernel@vger.kernel.org, Thomas Gleixner , pali@kernel.org, Brian Masney Subject: Re: irqdomain API: how to set affinity of parent irq of chained irqs? In-Reply-To: References: <20220502102137.764606ee@thinkpad> <87mtg0i8m8.wl-maz@kernel.org> <20220502174559.78f5cbc0@dellmb> <87fslr7ygl.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: rrendec@redhat.com, kabel@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, pali@kernel.org, bmasney@redhat.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Radu, On Fri, 07 Apr 2023 00:56:40 +0100, Radu Rendec wrote: >=20 > Hello Marc, Marek, >=20 > On Tue, 2022-05-03 at 10:32 +0100, Marc Zyngier wrote: > > On Mon, 02 May 2022 16:45:59 +0100, > > Marek Beh=C3=BAn wrote: > > >=20 > > > On Mon, 02 May 2022 10:31:11 +0100 > > > Marc Zyngier wrote: > > >=20 > > > > On Mon, 02 May 2022 09:21:37 +0100, > > > > Marek Beh=C3=BAn wrote: > > > > >=20 > > > > > Dear Marc, Thomas, > > > > >=20 > > > > > we have encountered the following problem that can hopefully be p= ut > > > > > some light onto: What is the intended way to set affinity (and po= ssibly > > > > > other irq attributes) of parent IRQ of chained IRQs, when using t= he > > > > > irqdomain API?=C2=A0=20 > > > >=20 > > > > Simples: you can't. What sense does it make to change the affinity = of > > > > the parent interrupt, given that its fate is tied to *all* of the > > > > other interrupts that are muxed to it? > > >=20 > > > Dear Marc, > > >=20 > > > thank you for your answer. Still: > > >=20 > > > What about when we want to set the same affinity for all the chained > > > interrupts? > > >=20 > > > Example: on Armada 385 there are 4 PCIe controllers. Each controller > > > has one interrupt from which we trigger chained interrupts. We would > > > like to configure each controller to trigger interrupt (and thus all > > > chained interrupts in the domain) on different CPU core. > > >=20 > > > Moreover we would really like to do this in runtime, through sysfs, > > > depending on for example whether there are cards plugged in the PCIe > > > ports. > > >=20 > > > Maybe there should be some mechanism to allow to change affinity for > > > whole irqdomain, or something? > >=20 > > Should? Maybe. But not for an irqdomain (which really doesn't have > > anything to do with interrupt affinity). > >=20 > > What you may want is a new sysfs interface that would allow a parent > > interrupt affinity being changed, but also exposing to userspace all > > the interrupts this affects *at the same time*. something like: > >=20 > > /sys/kernel/irq/42/smp_affinity_list > > /sys/kernel/irq/42/muxed_irqs/ > > /sys/kernel/irq/42/muxed_irqs/56 -> ../../56 > > /sys/kernel/irq/42/muxed_irqs/57 -> ../../57 > >=20 > > The main issues are that: > >=20 > > - we don't really track the muxing information in any of the data > > =C2=A0 structures, so you can't just walk a short list and generate this > > =C2=A0 information. You'd need to build the topology information at > > =C2=A0 allocation time (or fish it out at runtime, but that's likely a > > =C2=A0 pain). > >=20 > > - sysfs doesn't deal with affinities at all. procfs does, but adding > > =C2=A0 more crap there is frowned upon. > >=20 > > - it *must* be a new interface. You can't repurpose the existing one, > > =C2=A0 as something like irqbalance would be otherwise be massively > > =C2=A0 confused by seeing interrupts moving around behind its back. > >=20 > > - conversely, you'll need to teach irqbalance how to deal with this > > =C2=A0 new interface. > >=20 > > - this needs to be safe against CPU hotplug. It probably already is, > > =C2=A0 but nobody ever tested it, given that userspace can't interact w= ith > > =C2=A0 these interrupts at the moment. >=20 > Are you aware of any work being done (or having been done) in this > area? Thanks in advance! >=20 > My colleagues and I are looking into picking this up and implementing > the new sysfs interface and the related irqbalance changes, and we are > currently evaluating the level of effort. Obviously, we would like to > avoid any effort duplication. I don't think anyone ever tried it (it's far easier to just moan about it than to do anything useful). But if you want to start looking into that, that'd be great. One of my concern is that allowing affinity changes for chained interrupt may uncover issues in existing drivers, so it would have to be an explicit buy-in for any chained irqchip. That's probably not too hard to achieve anyway given that you'll need some new infrastructure to track the muxed interrupts. Hopefully this will result in something actually happening! ;-) Cheers, M. --=20 Without deviation from the norm, progress is not possible.