Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4926555pxu; Thu, 10 Dec 2020 08:39:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRwNQej5r0a15KCCcpjgkFebx4f+DobQskFwbvN9YY2fTpdWfkTXzpkssP96CmKKw2i4YW X-Received: by 2002:a17:906:2818:: with SMTP id r24mr6870094ejc.100.1607618378874; Thu, 10 Dec 2020 08:39:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607618378; cv=none; d=google.com; s=arc-20160816; b=wlXLG2QgpmWlXmt3NvMJlaKafQI90tjKKZ5Xa4U+GzkyZaxOLbuLOS01rUktAj7Oiv 7C09LUbNmFILIi2XXNStzOyBqUSM52FdYr29PK5vNWw5Z90MJFOWC+OXExUNvuLblyjy pVIuT5eOmggZd258Vh3BOzc2bxxPf0Zr5nFmrvpMEJZH1FarlchvkDNUzKkje/wwMttA uPLKxHtaaz+VSKvjG3QBfaV/xz5g0oPjd28143c5V9XBNiNsqdHt+LWf9jtPCohYwRck fE+HtbXd8Uo9r8yBgPGHv0rRWLCgQV0XpB9PXfIE3RzLaCg7GEhxEiMERS4+hVJ9m3U7 NRqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=dN9R56n8LBKD49/etkZ6uo0OmmDcJTzzH+j1i4Pij/U=; b=YcWZVt4RQK50o7ZLBaLY50qPp6mELQb9+dDDhvLRqAuJh1ZSmP53SzE0xwg90xGSfp eKH2BmZI6fldRV06MdFyNuax4uFE7TbfZ5xet/Xm69osWi1W5ze12VxQMQwfHJyTHfc5 0F+aRQysMF1H9YyhrOUUUOGaeG7eq06eUCwIXFN07DB/ddRe0sI4pu0no1h1Jkm0pZxc wSHNXh2FoIflpl448c5u7Bx1hbcdLcGgD3qQJtoVxC95ZrsQjL2bfGT2d9WGCPMACHNy ATmglIdlV7MSi4Pt/3E+6Op+qn1gucNSKuvvAxYCebsMR0LwfARKrJxnxY+KPrSeAJvz FOrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=oZwcHl+R; 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c22si2844947ejx.290.2020.12.10.08.39.13; Thu, 10 Dec 2020 08:39:38 -0800 (PST) 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=@ibm.com header.s=pp1 header.b=oZwcHl+R; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389255AbgLJQhu (ORCPT + 99 others); Thu, 10 Dec 2020 11:37:50 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36718 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391437AbgLJQha (ORCPT ); Thu, 10 Dec 2020 11:37:30 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0BAGVsdw159735; Thu, 10 Dec 2020 11:36:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=dN9R56n8LBKD49/etkZ6uo0OmmDcJTzzH+j1i4Pij/U=; b=oZwcHl+RwOgQ+M4Czs2gngXHqxyHsKSDw5/EzvHMpZ0t+cOE02T+Q242Bt8eJG08rSy2 KQbjBXUHF5VEABqeA+0nehCiGqdx0Z5XUoiaMCcfZ3X6eYfCsSU2RsTwyKZ0TlvqOv8C k3fuwaFc9jqyJ98Hy3aWiax15Y0v9XJ9kXc6XDeTg8yNVdyaLv0oEgvkWDtga5s2uWPz ne+NqW0xxiJfINWKlAHgrv4pKlclHzfi9+SQe/P3rQm90hrZILm2jtX0+/7qfpSAHFsw 8w2G1ZkJ84VaYsumJLCKZuCspZ9hmYGpsWdQA3Od3kxEeEaDsNxOYQNGiZC099VJx51w og== Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 35bpq99paj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Dec 2020 11:36:43 -0500 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0BAGSL1Y024649; Thu, 10 Dec 2020 16:36:42 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03fra.de.ibm.com with ESMTP id 3581u8ru5a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Dec 2020 16:36:42 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0BAGY9ee17760520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Dec 2020 16:34:09 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F9704204C; Thu, 10 Dec 2020 16:34:09 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BDFF542047; Thu, 10 Dec 2020 16:34:08 +0000 (GMT) Received: from [9.171.6.187] (unknown [9.171.6.187]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 10 Dec 2020 16:34:08 +0000 (GMT) Subject: Re: [PATCH 5.4 21/54] s390/pci: fix CPU address in MSI for directed IRQ To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Naresh Kamboju Cc: stable@vger.kernel.org, Alexander Gordeev , Halil Pasic , Heiko Carstens References: <20201210142602.037095225@linuxfoundation.org> <20201210142603.083190701@linuxfoundation.org> From: Niklas Schnelle Message-ID: <805f753f-f431-a032-383c-65130ef0b153@linux.ibm.com> Date: Thu, 10 Dec 2020 17:34:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201210142603.083190701@linuxfoundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2020-12-10_06:2020-12-09,2020-12-10 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 phishscore=0 mlxlogscore=999 clxscore=1011 priorityscore=1501 bulkscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012100102 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, sorry to bother you but I missed that the smp_cpu_get_cpu_address() address used here was only added with the commit 42d211a1ae3b77 ("s390/cpuinfo: show processor physical address") which landed in v5.7-rc1. This would therefore break if ever called (luckily it would not be called on any shipped hardware) and also causes a missing declaration warning as reported by Naresh Kamboju thanks! Since this is as of now just a spec fix, as on all known hardware the Linux CPU Id always matches the CPU Address, I would recommend to simply revert the commit. Thanks in advance! Best regards, Niklas Schnelle On 12/10/20 3:26 PM, Greg Kroah-Hartman wrote: > From: Alexander Gordeev > > commit a2bd4097b3ec242f4de4924db463a9c94530e03a upstream. > > The directed MSIs are delivered to CPUs whose address is > written to the MSI message address. The current code assumes > that a CPU logical number (as it is seen by the kernel) > is also the CPU address. > > The above assumption is not correct, as the CPU address > is rather the value returned by STAP instruction. That > value does not necessarily match the kernel logical CPU > number. > > Fixes: e979ce7bced2 ("s390/pci: provide support for CPU directed interrupts") > Cc: # v5.2+ > Signed-off-by: Alexander Gordeev > Reviewed-by: Halil Pasic > Reviewed-by: Niklas Schnelle > Signed-off-by: Niklas Schnelle > Signed-off-by: Heiko Carstens > Signed-off-by: Greg Kroah-Hartman > > --- > arch/s390/pci/pci_irq.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > --- a/arch/s390/pci/pci_irq.c > +++ b/arch/s390/pci/pci_irq.c > @@ -103,9 +103,10 @@ static int zpci_set_irq_affinity(struct > { > struct msi_desc *entry = irq_get_msi_desc(data->irq); > struct msi_msg msg = entry->msg; > + int cpu_addr = smp_cpu_get_cpu_address(cpumask_first(dest)); > > msg.address_lo &= 0xff0000ff; > - msg.address_lo |= (cpumask_first(dest) << 8); > + msg.address_lo |= (cpu_addr << 8); > pci_write_msi_msg(data->irq, &msg); > > return IRQ_SET_MASK_OK; > @@ -238,6 +239,7 @@ int arch_setup_msi_irqs(struct pci_dev * > unsigned long bit; > struct msi_desc *msi; > struct msi_msg msg; > + int cpu_addr; > int rc, irq; > > zdev->aisb = -1UL; > @@ -287,9 +289,15 @@ int arch_setup_msi_irqs(struct pci_dev * > handle_percpu_irq); > msg.data = hwirq - bit; > if (irq_delivery == DIRECTED) { > + if (msi->affinity) > + cpu = cpumask_first(&msi->affinity->mask); > + else > + cpu = 0; > + cpu_addr = smp_cpu_get_cpu_address(cpu); > + > msg.address_lo = zdev->msi_addr & 0xff0000ff; > - msg.address_lo |= msi->affinity ? > - (cpumask_first(&msi->affinity->mask) << 8) : 0; > + msg.address_lo |= (cpu_addr << 8); > + > for_each_possible_cpu(cpu) { > airq_iv_set_data(zpci_ibv[cpu], hwirq, irq); > } > >