From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6ACBAA04FD; Tue, 9 Aug 2022 19:58:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0AFA14113F; Tue, 9 Aug 2022 19:58:56 +0200 (CEST) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id 57A7740143 for ; Tue, 9 Aug 2022 19:58:55 +0200 (CEST) Received: by mail-pf1-f176.google.com with SMTP id k14so9436384pfh.0 for ; Tue, 09 Aug 2022 10:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sAk5wM3o2Vwp0uA1mIWmQWrG7HitaNg/BLoTyRTapWA=; b=xHMgId6cfKww7UvTqifHdfAZuisZfivt38TcCFfGL0DQ0PVk5EwRLnoAIQZvoMA9hY 7nmdzEkJXCW/DUuP/k/JMgtdnzXPBlN3GlfbuTurAKAG3CrWuQVXgOVJr2Ycg9RhGYcV +V0528rmu11f6+7392LIWhMBMUSXYNuhIvniRPCVT629QWrqeBbsU7wZKu5XUBmLdCfJ B0JBswLDhY9rRA4CXKb7M3OYQrfs2+4tebCC/ssmyxJ4rBxLbgdN/khWB4fAaFEwEB0u nMDhmX1Dor9yQN7BlINbIcbXTDUp7EIfIAcf9yt2YZ3FZcC3/lRluJNrlI2onn52EXNZ vqqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sAk5wM3o2Vwp0uA1mIWmQWrG7HitaNg/BLoTyRTapWA=; b=R+MU2nKy/tx75uHZuSV4yrqxSxzXwzGVxmmVVVxlxwRlXs2oYuITgmtzvK/dZ9Jcb0 CK84961Hz5iocz+f6EOVG3ubTNII6uvYUL3lCqm4KNLwowRWgKcsVOyTZUJ76+8YG+O7 LhRYwNucuN4r/ku3UWZCNzqb0yJFqBNcW/Eh9zS/zDSWiL4P1c/bsUGyxz3bb52+ldM1 ZFwQub1yEKxugwgOENk8yDmWX6DUMZj9PauadVDOm27BPefYlNifs8Vgx/K9hZB01aoP 8gpukDU3aNntiI9lO4818991cbFKfme8CLAZ8gAzMN1qsRcfEdo6e4Fhmjs6kahaCQLp ZyCw== X-Gm-Message-State: ACgBeo2kBHA4VUcruZvEknDPAWfsb54+p+AO/GJa4lQWLmwXiwtLIjxg cgp6DiF66UmbrGqVHNhg3uJW0Q== X-Google-Smtp-Source: AA6agR5ngpJB5vGY7OYsMazku5/5BCAFlCjobvhwiv45kOHxpv/KWIMDQr9R/4TcKPHVGh2TJW12Dg== X-Received: by 2002:a63:8442:0:b0:41b:f6a3:7805 with SMTP id k63-20020a638442000000b0041bf6a37805mr19909923pgd.569.1660067934258; Tue, 09 Aug 2022 10:58:54 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id j17-20020a170902da9100b0016efbccf2c0sm11238021plx.56.2022.08.09.10.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 10:58:54 -0700 (PDT) Date: Tue, 9 Aug 2022 10:58:52 -0700 From: Stephen Hemminger To: "lihuisong (C)" Cc: , , , , , Subject: Re: [PATCH] usertools: fix bind failure from dpdk to kernel Message-ID: <20220809105852.42051ed4@hermes.local> In-Reply-To: References: <20220805031022.9795-1-lihuisong@huawei.com> <20220805083529.5ca3233e@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, 9 Aug 2022 19:44:41 +0800 "lihuisong (C)" wrote: > =E5=9C=A8 2022/8/5 23:35, Stephen Hemminger =E5=86=99=E9=81=93: > > On Fri, 5 Aug 2022 11:10:22 +0800 > > Huisong Li wrote: > > =20 > >> Currently, the steps for binding device from dpdk driver to kernel > >> driver is as follows: > >> echo $BDF > /sys/bus/pci/drivers/vfio-pci/unbind > >> echo $BDF > /sys/bus/pci/drivers/$kernel_driver/bind > >> > >> This steps cannot bind device from dpdk driver to kernel driver on > >> platform with kernel 5.19. The 'driver_override' must be specify > >> kernel driver before binding device to kernel driver. > >> > >> Fixes: 720b7a058260 ("usertools: fix device binding with kernel tools") > >> Cc: stable@dpdk.org > >> > >> Signed-off-by: Huisong Li =20 > > Not sure exactly what you did and why. > > The patch seems to just remove the check that the driver > > is in the set of dpdk_drivers. > > . =20 > Currently, the end of the operation binding device from kernel driver to > dpdk driver write '\00' to driver_override file so as to this device can > be bound to any other driver. And perform following steps to > bind device dpdk driver to kernel driver: > echo $BDF > /sys/bus/pci/drivers/vfio-pci/unbind > echo $BDF > /sys/bus/pci/drivers/$kernel_driver/bind >=20 > However, due to the patch[1] merged into 5.19 kernel, 'driver_override' > in the pci_dev is no longer NULL by writing '\00' to driver_override file. > This causes PCI match device failure and the device will never be bound to > their kernel driver. Linux kernel does not look favorably on API changes and that looks like the kernel changed behavior. That should be reported and fixed there. > In 5.19 kernel, I found that dpdk-devbind.py need to write '\n' to > driver_override file if we want to bind divce to any other driver. > But I think it is not necessary to write empty to driver_override > file. After all, the device has only one kernel driver, and binding > to dpdk driver(like, vfio-pci) must specify driver_override. >=20 > [1] 23d99baf9d72 ("PCI: Use driver_set_override() instead of open-coding") The method of using driver override is based off of what the upstream driverctl package https://gitlab.com/driverctl/driverctl does. In fact, I would recommend the driverctl package to users over using our python script.