Received: by 2002:a17:504:5f65:b0:1be9:327d:8ee3 with SMTP id gl5csp2457821njc; Tue, 25 Mar 2025 01:01:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU6Q3QbCtnOisp6FQB+84PysXO6ZJKmCA83pCuVZ72zf30pyWkiHlh5+LXHIaq4Zqqtm4lOIKh9mGPHig==@linaro.org X-Google-Smtp-Source: AGHT+IFkSmhvapEZf3mydRtFBV/AT5D1/Iu1ZpYFSNU89ovrEbqHRNJcTRDiywpKIHNRW+dIKUcj X-Received: by 2002:a05:622a:124c:b0:471:cdae:ac44 with SMTP id d75a77b69052e-4771de7e667mr262456701cf.47.1742889712680; Tue, 25 Mar 2025 01:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742889712; cv=none; d=google.com; s=arc-20240605; b=MhC4uxWjOAb5jQ6q/zt/ONBfWjIwkspqX5QR3eZqE4YBEub2m+Kf8O2P5SnoUkIFZW MLuXRq+KVq5Ob/GTI9h14HTMPrq7AOq2978KJ/qoLdQXcw2FI2+Ph+8hZ2ylXpFR6uAR uKckRcXNEuI56HxNenmh2MuxgdwGSwHYsZtXM7p/pZ5jPhq9sLJPjc9ic1S32H8pYCPQ yaAApwsy70Pwt1X7lcoc3RURM2fC83ur2a2wrZ9/oZ9CUgj6bkR1tdOuBlsR4tm7Y6FL 9EMUVne7QhlN20HtW+34CzG9VX7BwcEepnkX6Dhuco0qbBXCEL1m029Sxd+XUt6KL1Tf guHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:from:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to; bh=k1nlCypjDytZO3G79pS3I6qneIEOVXrOt0esMakb3/k=; fh=tMUoHvkf3avxBR4l/NzbMrTg+OWSegug9bLhnsZje6Y=; b=NLVyMwazLMPSSlxzAohdkmKQVIzCKpJHxo1wOftrR6AwLtLyQ8zCc9/8jU3v71FWYT cyUQ4rfaNoesusJEFbcWd6/46pGLH5wfpapxajnO/dRhl4eK+bBlcg+gTtHfUsqNCL2r JBnH2XAezMdzALfJifyvZIGIXljup49FDm6Q+8Nxqz3Lp/CjZyYy5+ZW/ggdTeThttRi mb4Q1D+jJFoXIF245bjQStS2sEipyhTZ7uMPQ7RVhof3gaVpjqBLGkBe00E6MHo/yVy7 Htnw7Ff4JmtkeVwF1HTVQ5DvgvJQwBXKIkG8BvhrGdT27ztwA0zboe/D6QJhqJBctFAB Sdzg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4771d4fe448si96915781cf.243.2025.03.25.01.01.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Mar 2025 01:01:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nongnu.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1twzDg-0001Bl-U0; Tue, 25 Mar 2025 04:01:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1twzDe-0001A1-3o; Tue, 25 Mar 2025 04:01:06 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1twzDX-0002UQ-QZ; Tue, 25 Mar 2025 04:01:05 -0400 Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4ZMMkW0FlHz1FNFy; Tue, 25 Mar 2025 15:58:59 +0800 (CST) Received: from kwepemd500011.china.huawei.com (unknown [7.221.188.45]) by mail.maildlp.com (Postfix) with ESMTPS id D7ABC1A0188; Tue, 25 Mar 2025 16:00:45 +0800 (CST) Received: from kwepemg100001.china.huawei.com (7.202.181.18) by kwepemd500011.china.huawei.com (7.221.188.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Tue, 25 Mar 2025 16:00:45 +0800 Received: from kwepemg100001.china.huawei.com ([7.202.181.18]) by kwepemg100001.china.huawei.com ([7.202.181.18]) with mapi id 15.02.1544.011; Tue, 25 Mar 2025 16:00:45 +0800 To: "qemu-devel@nongnu.org" , lex Williamson CC: "Wangzhou (B)" , liuyonglong , jiangkunkun , "libai (G)" , tangchengchang , "qemu-arm@nongnu.org" Subject: Questions about vfio-pci Thread-Topic: Questions about vfio-pci Thread-Index: AdudW06L4raav9tJRXuEMJF2Lkz38w== Date: Tue, 25 Mar 2025 08:00:45 +0000 Message-ID: Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.121.183] Content-Type: multipart/alternative; boundary="_000_f82e1e01c21e4a75a9a78315c08449eahuaweicom_" MIME-Version: 1.0 Received-SPF: pass client-ip=45.249.212.191; envelope-from=yangjinqian1@huawei.com; helo=szxga05-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: yangjinqian From: yangjinqian via Errors-To: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: pb9CEJLFP9BR --_000_f82e1e01c21e4a75a9a78315c08449eahuaweicom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, I'm observing intermittent failures when enabling the HNS3 network port in = VM using QEMU with the mainline kernel. HNS3 drive in kernel: static int hns3_nic_net_up(struct net_device *netdev) { ...... /* enable the vectors */ for (i =3D 0; i < vector_num; i++) { napi_enable(napi); enable_irq(vector_irq); hns3_mask_vector_irq(tqp_vector, 1); } ...... } When the VM has two vCPUs, the guest HNS3 driver performs two sequential enable_irq operations (vector_num=3D2). The enable_irq will trap into KVM f= or interrupt configuration and exit to QEMU for PCI device emulation. When emulating int= errupt enabling in QEMU, vfio_[intx/msi/msix]_enable calls vfio_disable_interrupts= to disable all interrupts on the vdev. The questions are: 1. Why does the vfio-pci disable all interrupts of the device before e= nabling irqs? 2. Is this a normal vfio-pci process or a problem? Thanks Jinqian --_000_f82e1e01c21e4a75a9a78315c08449eahuaweicom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

 

I'm observing intermi= ttent failures when enabling the HNS3 network port in VM using

QEMU with the mainlin= e kernel.

 

HNS3 drive in kernel:

static int hns3_nic_net_up(stru= ct net_device *netdev)

{

..= ....

     &= nbsp; /* enable the vectors */

     &= nbsp; for (i =3D 0; i < vector_num; i++)

{<= o:p>

napi_enable(napi);

     &= nbsp;       enable_irq(vector_irq);

     &= nbsp;       hns3_mask_vector_irq(tqp_vector, 1);

     &= nbsp; }

..= ....

}

 

When the VM has two vCPUs, the = guest HNS3 driver performs two sequential

enable_irq operations (vector_n= um=3D2). The enable_irq will trap into KVM for interrupt<= /p>

configuration and exit to QEMU = for PCI device emulation. When emulating interrupt

enabling in QEMU, vfio_[intx/ms= i/msix]_enable calls vfio_disable_interrupts to disable

all interrupts on the vdev.

 

The questions are:

1= .   &= nbsp;  Why does the vfio-pci d= isable all interrupts of the device before enabling irqs?=

2= .   &= nbsp;  Is this a normal vfio-p= ci process or a problem?

 

Thanks

Jinqian

 

--_000_f82e1e01c21e4a75a9a78315c08449eahuaweicom_--