Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3992660pxk; Tue, 29 Sep 2020 11:14:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcNz0Bqe+iJymjyOM85Vn1f6JAdBY9trdrUWtiQtaPAaHL7ltN6awPDZYnq22dguB9eeXP X-Received: by 2002:a05:6402:292:: with SMTP id l18mr4825909edv.6.1601403280185; Tue, 29 Sep 2020 11:14:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601403280; cv=none; d=google.com; s=arc-20160816; b=ujPslzq8cvwN7P7vOrc055LFnqC0w6Hrlksv7Cy/km7aq5cjPNCQ9dw9KQ/sqqNF5Y r7fjgyNHXpmmOD1YUETb2dgfpKAgDmfk5IYQmujZSayaMWXu/Opr0bB7T7fpby0REtG8 /mYVTSZYproT/ugyBaV5LK+dkiQeujHXdMPtnLLQbROB3miZV4YZOCHxrQ763dfiFZkH JhdBbB0xolBGXXAUdqF4SciF200g7hnCoPMPZsRLJgh5Uh4VFV6IjTkZbS+GvZnJj+eV vES8Rc3jNztttdUhCjU39QpEqi4cdvwPfJjagqlq0j/lJ0z0SaX2kex9z9AaIbRI373K 0KZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=xLNnkvjpegUoA1YwBtdXeLY4YuirUhthUtPHpB/TZRc=; b=o5AfAxA6q8pP9qd2KmOjdcB1SVlZUVUhiJT/28+bSQQCGfEED9KDCEv89Zia6GnDxJ VnPrO17rPWGmt0GJoWNxpJ8A6nV0Byk/dfykpXpbnb1gbFqkNt4haxusiXQCPg2WUP/h wzrpVzOtQArwLdf2YB5gMqaSMWF9j892IbEbyMng0DdbAczNARnDOqHQ+GQqlPzvh/qH J6hDqyuyR5l9T7lgwIdvIdtF2guLw9YD/SnCiDLzqg0hdtMjgK6nxvgBInHBvAmWshRU 4+wyr/UYN4tqxtO/nzrEWYwowz4T+tpETJ03ee+SNZtu9PB8SiQaw6/52ZEPKVVCrxQZ ol/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RJjs+GRA; 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 b2si3655159edf.162.2020.09.29.11.14.16; Tue, 29 Sep 2020 11:14:40 -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=RJjs+GRA; 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 S1728068AbgI2SNB (ORCPT + 99 others); Tue, 29 Sep 2020 14:13:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:47796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725320AbgI2SNA (ORCPT ); Tue, 29 Sep 2020 14:13:00 -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 61130208B8; Tue, 29 Sep 2020 18:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601403179; bh=KbbIptFu2by3ZEgiSoxO0ItV258aPMBQ8QGyKLlZVN4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RJjs+GRAdQMy1SObha2G7D1UaBcQCAAyaTf8WgvCvreuOJYCdRhPfgljfewCRMqNa fgTvFA+0dGumXNIblpNRfptGGEAht5GxmMN852H1TK4YPcCUSphboNBwtzPzAVnGzS +GpbuSl9ZZMwew3iyJxm0lXQg8HDC9Hx7S1EK6Fw= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kNK7V-00FxpD-8M; Tue, 29 Sep 2020 19:12:57 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 29 Sep 2020 19:12:57 +0100 From: Marc Zyngier To: Jon Hunter Cc: Jisheng Zhang , Kunihiko Hayashi , Neil Armstrong , linux-pci@vger.kernel.org, Binghui Wang , Bjorn Andersson , Masahiro Yamada , Thierry Reding , linux-arm-kernel@axis.com, Vidya Sagar , Fabio Estevam , Jerome Brunet , Rob Herring , Jesper Nilsson , Lorenzo Pieralisi , Kevin Hilman , Pratyush Anand , linux-tegra@vger.kernel.org, Krzysztof Kozlowski , Kishon Vijay Abraham I , Kukjin Kim , NXP Linux Team , Xiaowei Song , Richard Zhu , Martin Blumenstingl , linux-arm-msm@vger.kernel.org, Sascha Hauer , Yue Wang , linux-samsung-soc@vger.kernel.org, Bjorn Helgaas , linux-amlogic@lists.infradead.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jingoo Han , Andy Gross , linux-kernel@vger.kernel.org, Stanimir Varbanov , Pengutronix Kernel Team , Gustavo Pimentel , Shawn Guo , Lucas Stach Subject: Re: [PATCH v2 0/5] PCI: dwc: improve msi handling In-Reply-To: <6ead62a5-6ad5-bde8-a5df-93c0f8029f65@nvidia.com> References: <20200924190421.549cb8fc@xhacker.debian> <20200929184851.22682ff1@xhacker.debian> <8e06a370-a37a-5f33-b43b-2830adb31b3e@nvidia.com> <6ead62a5-6ad5-bde8-a5df-93c0f8029f65@nvidia.com> User-Agent: Roundcube Webmail/1.4.8 Message-ID: <5f4947b18bf381615a37aa81c2242477@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: jonathanh@nvidia.com, Jisheng.Zhang@synaptics.com, hayashi.kunihiko@socionext.com, narmstrong@baylibre.com, linux-pci@vger.kernel.org, wangbinghui@hisilicon.com, bjorn.andersson@linaro.org, yamada.masahiro@socionext.com, thierry.reding@gmail.com, linux-arm-kernel@axis.com, vidyas@nvidia.com, festevam@gmail.com, jbrunet@baylibre.com, robh@kernel.org, jesper.nilsson@axis.com, lorenzo.pieralisi@arm.com, khilman@baylibre.com, pratyush.anand@gmail.com, linux-tegra@vger.kernel.org, krzk@kernel.org, kishon@ti.com, kgene@kernel.org, linux-imx@nxp.com, songxiaowei@hisilicon.com, hongxing.zhu@nxp.com, martin.blumenstingl@googlemail.com, linux-arm-msm@vger.kernel.org, s.hauer@pengutronix.de, yue.wang@amlogic.com, linux-samsung-soc@vger.kernel.org, bhelgaas@google.com, linux-amlogic@lists.infradead.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jingoohan1@gmail.com, agross@kernel.org, linux-kernel@vger.kernel.org, svarbanov@mm-sol.com, kernel@pengutroni x.de, gustavo.pimentel@synopsys.com, shawnguo@kernel.org, l.stach@pengutronix.de X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-09-29 19:02, Jon Hunter wrote: > On 29/09/2020 18:25, Marc Zyngier wrote: >> On 2020-09-29 14:22, Jon Hunter wrote: >>> Hi Jisheng, >>> >>> On 29/09/2020 11:48, Jisheng Zhang wrote: >>>> Hi Jon, >>>> >>>> On Fri, 25 Sep 2020 09:53:45 +0100 Jon Hunter wrote: >>>> >>>>> >>>>> On 24/09/2020 12:05, Jisheng Zhang wrote: >>>>>> Improve the msi code: >>>>>> 1. Add proper error handling. >>>>>> 2. Move dw_pcie_msi_init() from each users to designware host to >>>>>> solve >>>>>> msi page leakage in resume path. >>>>> >>>>> Apologies if this is slightly off topic, but I have been meaning to >>>>> ask >>>>> about MSIs and PCI. On Tegra194 which uses the DWC PCI driver, >>>>> whenever we >>>>> hotplug CPUs we see the following warnings ... >>>>> >>>>>  [      79.068351] WARNING KERN IRQ70: set affinity failed(-22). >>>>>  [      79.068362] WARNING KERN IRQ71: set affinity failed(-22). >>>>> >>>> >>>> I tried to reproduce this issue on Synaptics SoC, but can't >>>> reproduce >>>> it. >>>> Per my understanding of the code in kernel/irq/cpuhotplug.c, this >>>> warning >>>> happened when we migrate irqs away from the offline cpu, this >>>> implicitly >>>> implies that before this point the irq has bind to the offline cpu, >>>> but how >>>> could this happen given current dw_pci_msi_set_affinity() >>>> implementation >>>> always return -EINVAL >>> >>> By default the smp_affinity should be set so that all CPUs can be >>> interrupted ... >>> >>> $ cat /proc/irq/70/smp_affinity >>> 0xff >>> >>> In my case there are 8 CPUs and so 0xff implies that the interrupt >>> can >>> be triggered on any of the 8 CPUs. >>> >>> Do you see the set_affinity callback being called for the DWC irqchip >>> in >>> migrate_one_irq()? >> >> The problem is common to all MSI implementations that end up muxing >> all the end-point MSIs into a single interrupt. With these systems, >> you cannot set the affinity of individual MSIs (they don't target a >> CPU, they target another interrupt... braindead). Only the mux >> interrupt can have its affinity changed. >> >> So returning -EINVAL is the right thing to do. > > Right, so if that is the case, then surely there should be some way to > avoid these warnings because they are not relevant? I don't think there is a way to do this, because the core code doesn't (and cannot) know the exact interrupt topology. The only alternative would be to change the affinity of the mux interrupt when a MSI affinity changes, but that tends to break userspace (irqbalance, for example). M. -- Jazz is not dead. It just smells funny...