Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3964124pxk; Tue, 29 Sep 2020 10:28:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNHqpkrA0a/eLh7OboWXUk1VivJQDgdLtHM2BlkEnBIM+0J0Nmexs9x7FZZjtxmzQuzQMr X-Received: by 2002:a17:906:3a8c:: with SMTP id y12mr4741529ejd.531.1601400483930; Tue, 29 Sep 2020 10:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601400483; cv=none; d=google.com; s=arc-20160816; b=fECfmr8ceIb3gDFT3FrpwocNIZSXjx12ogAip0Kw08w0caRzjo2clpZD0X8HtUbeMa M0vFvTXJz8lTajfEzlhVZszW+E51G9NJo6LpQB6S83MWKTQAwlUpirZNA4Tbt0eZSGRj 0dq/HJ6KTSkYnbGbmkXa5AHp2ncI4Qhtiu/+kXiv3dr4jdkDe9sTTLecyoL4WOOirOHv ECA8nUSY/6WR40zCi+ZdOU7u3ArcpIvmUF9QvLR27kXda3TfIgWLeQfMCQpR2w33w0+R xmFqFsFnMcLHwc93uY1p3iiePqfI/XtKnP0mFGUCycWFy7RxZEv8K6CLtEk3mBc4v822 p5qw== 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=YnI8lGGOxNxcAlf3w7lv/mOxm2BLLKGoVZ4QpHoy0wE=; b=KIXqyxOIishakaRsRqa1Z+Zv90maWp75tMI5VAEZc3JuPEpgKhrsjnZczTokRs5Lpr IBW2gQIG2scR6RSymqj0ERjEY+gMH2FBeGpwE2WVFpwh/UQRBd4167UvtF4QucUH7iJq vtXyr12pAr0PWjPbyuHuUbxQU3sXglay+lPb7dtWVlm4HbYlZ7DhApsJagIL+FzVMvpT cO6Xs5faJUlvaBsT5xE06Dm5xx++50QQPrO52c4tfEAnbTNS5vb1A26d2xCDcLox7N+o 5r8G2/Shgon1oI9Kun04Zp92NzFqVs9O/fmuw5xq+oFRyeP6ryyMJG9xSSdyGpZZis9z XyOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vW3pXJX8; 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 bw19si3214290ejb.208.2020.09.29.10.27.40; Tue, 29 Sep 2020 10:28:03 -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=vW3pXJX8; 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 S1728819AbgI2RZn (ORCPT + 99 others); Tue, 29 Sep 2020 13:25:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:35900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727328AbgI2RZl (ORCPT ); Tue, 29 Sep 2020 13:25:41 -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 003972075A; Tue, 29 Sep 2020 17:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601400340; bh=Xv0rt8BvK5NQflV4HM9+bGl203Y0k3NIGUz7VcStvqM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=vW3pXJX83SknNw5HoHFJQaYImR0HN6DhmSa2zEwx5veHCgjUlwS3WW2rRAeg408gA H1Lqkq/nBOwGW3k+W/Jj3WHvm6EHshDZ2YUWoZtTfb4mE55OgYwVXg8gdo4huvJu+i McYfN0AlCJeWRJ5Ebe8RDHaYlGXXxb3l0QXk+F9c= 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 1kNJNh-00Fu9z-Hl; Tue, 29 Sep 2020 18:25:37 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 29 Sep 2020 18:25:37 +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: <8e06a370-a37a-5f33-b43b-2830adb31b3e@nvidia.com> References: <20200924190421.549cb8fc@xhacker.debian> <20200929184851.22682ff1@xhacker.debian> <8e06a370-a37a-5f33-b43b-2830adb31b3e@nvidia.com> User-Agent: Roundcube Webmail/1.4.8 Message-ID: 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 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. M. -- Jazz is not dead. It just smells funny...