From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01D292C21D3; Wed, 22 Oct 2025 17:33:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761154420; cv=none; b=ZBcY2YSm22Wq9lS2GfJdNgwZkelgvQdeZ1qWGM7FzKcW+BKLztEg6LfGY3EIQiC+T5ynNxwePnh5BcMNk0YHcp9TUTaKKhJ5beX2amvGwqTvkfxzCFrr+OvUVx+ZIHRBWPpO1jX0P4RLl4WF8I7ec0qNfDa7r2+6z9Hy71Ix5qQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761154420; c=relaxed/simple; bh=/Yk9WiXQBjIwG6nS0SNWlq/vPVccKp+iCtnR+gPxq0U=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=bqJIqWLnKDGva+AeRzWAGXJygmdOn2UEd3v9Qe+p6VzSpqn6e4oXTvw/VJFXplW+m2adHI6Psr/ywyHnM1IwObxQRWbRg1xxrE78pJnt2cPhDpSjQb6671+SGxiS6nfswLGbIO5Ar59dJfHg8A3wYiAgWfy+bFmT6q7ORUhSSeE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=kOqs+hxH; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="kOqs+hxH" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59MAOXBn003946; Wed, 22 Oct 2025 17:33:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=/Yk9Wi XQBjIwG6nS0SNWlq/vPVccKp+iCtnR+gPxq0U=; b=kOqs+hxH1CqLHrj8YxBgu/ 2vj5zA4+6c0sArBC7uMpIBqeSKb+4qkoRZddCyLvS/UKiWDWfKi94E98X/PEMT8h 7Axa1vAUGH6lylie0sZa/Q1ms8ghFgTnaD0nWM6Dh2CM9+23GL3qsD73yeNjaoGC f1XjOOgLR5x91/5x8/u8M3i8kW2MBl99SaAn91Z7qWK2LlxfDrdbJLfA3noJp5q9 IngNEzz9GmghW3dgwjdhfVB+pzPRvOa+P+S/THyRk8Odz/mivbb9S3EWEsxIFTSv l6GKQabLgj8QWiM9PCkS9Px0fO02lXycjjZH7xCRSD0sGuHKcPKvre0gGM0gZrhA == Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 49v32hmn4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Oct 2025 17:33:25 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 59MH1oWU017052; Wed, 22 Oct 2025 17:33:24 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 49vnky1r8r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Oct 2025 17:33:24 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 59MHXNMr24707762 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Oct 2025 17:33:23 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E851A58058; Wed, 22 Oct 2025 17:33:22 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2044158059; Wed, 22 Oct 2025 17:33:21 +0000 (GMT) Received: from [9.111.88.198] (unknown [9.111.88.198]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 22 Oct 2025 17:33:20 +0000 (GMT) Message-ID: <7e15ec9e157521489fb5e98a0c52f90aa3ccf09a.camel@linux.ibm.com> Subject: Re: Potential issue with hypervisor_isolated_pci_functions() handling From: Niklas Schnelle To: Huacai Chen Cc: Jan Kiszka , Bjorn Helgaas , linux-pci , jailhouse-dev@googlegroups.com, linux-s390 , loongarch@lists.linux.dev, Farhan Ali , Matthew Rosato , Tianrui Zhao , Gerd Bayer Date: Wed, 22 Oct 2025 19:33:20 +0200 In-Reply-To: References: Autocrypt: addr=schnelle@linux.ibm.com; prefer-encrypt=mutual; keydata=mQINBGHm3M8BEAC+MIQkfoPIAKdjjk84OSQ8erd2OICj98+GdhMQpIjHXn/RJdCZLa58k /ay5x0xIHkWzx1JJOm4Lki7WEzRbYDexQEJP0xUia0U+4Yg7PJL4Dg/W4Ho28dRBROoJjgJSLSHwc 3/1pjpNlSaX/qg3ZM8+/EiSGc7uEPklLYu3gRGxcWV/944HdUyLc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A stJ1IDCl9y3cr+Q/FejCYJAFAmesuuEFCQenEYkACgkQr+Q/FejCYJC6yxAAiQQ5NAbWYKpkxxjP/ AajXheMUW8EtK7EMJEKxyemj40laEs0wz9owu8ZDfQl4SPqjjtcRzUW6vE6JvfEiyCLd8gUFXIDMS l2hzuNot3sEMlER9kyVIvemtV9r8Sw1NHvvCjxOMReBmrtg9ooeboFL6rUqbXHW+yb4GK+1z7dy+Q 9DMlkOmwHFDzqvsP7eGJN0xD8MGJmf0L5LkR9LBc+jR78L+2ZpKA6P4jL53rL8zO2mtNQkoUO+4J6 0YTknHtZrqX3SitKEmXE2Is0Efz8JaDRW41M43cE9b+VJnNXYCKFzjiqt/rnqrhLIYuoWCNzSJ49W vt4hxfqh/v2OUcQCIzuzcvHvASmt049ZyGmLvEz/+7vF/Y2080nOuzE2lcxXF1Qr0gAuI+wGoN4gG lSQz9pBrxISX9jQyt3ztXHmH7EHr1B5oPus3l/zkc2Ajf5bQ0SE7XMlo7Pl0Xa1mi6BX6I98CuvPK SA1sQPmo+1dQYCWmdQ+OIovHP9Nx8NP1RB2eELP5MoEW9eBXoiVQTsS6g6OD3rH7xIRxRmuu42Z5e 0EtzF51BjzRPWrKSq/mXIbl5nVW/wD+nJ7U7elW9BoJQVky03G0DhEF6fMJs08DGG3XoKw/CpGtMe 2V1z/FRotP5Fkf5VD3IQGtkxSnO/awtxjlhytigylgrZ4wDpSE= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDE4MDAyMiBTYWx0ZWRfX9zhnbiIttv74 3JnksB+ByvKr2ZSUzqpj/+IKkTkfCSRemz+6fXK2/bMUlmqROPkX9kmYIBKrOY9cl4RBuH15pSF 3X7eLzxO7hDEFZ+CTWXNayMsBLfutMZMZ9N71Ru6s7aZsxRctnQ8AuVC0pYMpEuoEOfzkR7/7PV Tfe776M/JMqTjDOo/9PB6gyOcVXzaxKkHJA48eojJ+8Sdam7/OaOFIAEgfr3biggfcwnpn/OU60 MFkaghPEUiQ42//c5lFD0XLn/0yf5exC+bdYrHpmCfiNHzFZbCmY5BPOMEeL/OplfbIKbs+32p3 FJ0pmtJijcYGT6eO0cOFP5OSufSzPeBD4SQjE5ZKeBLkjLuJE3dqvEi7jB5/u24B2VxZkH+Y/jL ALvrMmS6pMQMyhEh7Oz/o/0SoTyTXw== X-Authority-Analysis: v=2.4 cv=OrVCCi/t c=1 sm=1 tr=0 ts=68f91565 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=9vf2bs2iEuHWSEF46McA:9 a=QEXdDO2ut3YA:10 a=cPQSjfK2_nFv0Q5t_7PE:22 X-Proofpoint-GUID: E16fo7ub-l2JXCn_GDTbDSOdQnAVEKJS X-Proofpoint-ORIG-GUID: E16fo7ub-l2JXCn_GDTbDSOdQnAVEKJS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-22_07,2025-10-22_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 priorityscore=1501 spamscore=0 phishscore=0 clxscore=1015 bulkscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510180022 On Wed, 2025-10-22 at 22:49 +0800, Huacai Chen wrote: > Hi, Niklas, >=20 > On Wed, Oct 22, 2025 at 7:40=E2=80=AFPM Niklas Schnelle wrote: > >=20 > > Hi Huacai, Hi Jan, Hi Bjorn, > >=20 > > I noticed that with commit a02fd05661d7 ("PCI: Extend isolated function > > probing to LoongArch") LoongArch now also makes use of the isolated > > function probing. First, nice to see this sees more users and that the > > interface is useful to you. > >=20 > > Seeing this, I was reminded of an issue I ran into when using this > > mechanism with SR-IOV capable devices. In that case VFs with devfn > 7 > > and PCI_SLOT(devfn) !=3D 0 wouldn't get probed. > > This is because if a device is found next_fn() will check whether dev- > > > multifunction is set. So if for example devfn =3D=3D 8 is found (fn = =3D=3D 0) > > dev->multifunction won't be set in pci_scan_slot() and for VFs it's > > also not set via PCI_HEADER_TYPE_MFD. So we won't check for devfn =3D= =3D 9 > > even though that could very well be there. > >=20 > > Now for s390 this currently doesn't cause issues because for all > > multifunction devices we have, we either get a VF alone and then since > > commit 25f39d3dcb48 ("s390/pci: Ignore RID for isolated VFs") use devfn > > =3D=3D 0, or we have the parent PF passed-through and then VFs always g= et > > hot plugged after SR-IOV enable, which then uses > > pci_scan_single_device(). And for non VFs we always have devfn =3D=3D 0 > > and/or devfn =3D=3D 1 and multifunction via the header. So in a sense t= he > > above commit works around the issue, though that wasn't its primary > > intention. > >=20 > > Did either of you also run into this issue or can reproduce it? > >=20 > > Somewhat related, if ARI is enabled this would also break the isolated > > function case including on s390 where ARI is used by the platform > > firmware, but detected as off by Linux because there is no struct > > pci_dev associated with the PCI bus. If I patch Linux to correctly > > detect ARI, it no longer finds an isolated PF with devfn =3D=3D 1. > LoongArch do have some problems after commit a02fd05661d7 ("PCI: > Extend isolated function probing to LoongArch"). Please see: > https://lore.kernel.org/linux-pci/20251014074100.2149737-1-chenhuacai@loo= ngson.cn/ >=20 > Now we don't know what happens exactly, so I haven't answered Bjorn's > question... >=20 > Huacai >=20 Interesting. I'm working on a patch that simplifies and hopefully fixes the isolated function probing by basically going back to basics and just trying every devfn 0-255. It would be interesting if that fixes your issue too. In the linked patch you said that the hole left by function 0 is not supposed to be probed, but with disabled isolated function probing you'd still try to scan function 0 so I can't see how that would explain your issues. On the other hand it doesn't sound like an exact match of what I saw. I'm still working on the cover letter and more testing including testing on x86, but if you're curious the current state is on my git.kernel.org account[0] in the b4/ari_no_bus_dev branch. Thanks, Niklas [0] https://git.kernel.org/pub/scm/linux/kernel/git/niks/linux.git/log/?h=3Db4/= ari_no_bus_dev