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 4D2DDA0548; Thu, 11 Aug 2022 10:25:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98D9A42C04; Thu, 11 Aug 2022 10:24:48 +0200 (CEST) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by mails.dpdk.org (Postfix) with ESMTP id F19D74068E for ; Wed, 10 Aug 2022 07:59:17 +0200 (CEST) Received: by mail-lf1-f50.google.com with SMTP id z25so19853369lfr.2 for ; Tue, 09 Aug 2022 22:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=z5ghUAh8W30Q5FMDVnMovfqak+WMEggW+ZTImV27SW0=; b=ZIPcDml4833i89EHzqr8Y798hHfXwbyMPc/F0+AST/dVyNeEycOPPPk37M1A8es+cs J4+x1eWNqAi7DzzFMIg75awzdd7FNTQyCSWAlzwWZYZAYufsyvqmN9m1YBPA3wpyF3w0 zWfHuAY+mD++91zdqrQLmPorNPhLtv4t1gN9jyBqH6PNAmWx5UQlzXRG1064Va9hceu2 yR8mqNLro2Wf+IHr7cDHFd9bDhqjFZq2TvMViTokpDrErGviceIechjSleh2HaQl3OCs YiQM9pd7dIGKVo5IlNXn19EmlrTzlE3hGUcXKdEDmD/PanKK9DnTOB52NWRe9Diizco9 vW0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=z5ghUAh8W30Q5FMDVnMovfqak+WMEggW+ZTImV27SW0=; b=6EijPvdIGppEy1d1rO2c/lKjtzfAhGe4w+dApUMtDBDAnQam8tTNGHp0jSWg4lkZQx X5IUTUbS3CUhDB+s8htUjoAwhelpUg2Q2DT9eLWzvmrisUjFr/HrI/7wjYt8p4jfkvj7 eraqH+r2/1unwpPWa90MbzWVbF4ygXnoStp28qpQruyW/T9VVveF/gb46YjF4z7aELQh OH/7lKWQRIZC7lbKw4S0RDtAj+XuCltfUeNkAW7mlXNEQtDUCYUyABw2b879/TkF1b60 rr/X1SlV2/Q13uMlLFlsOrH0Jj5X+KU44+fNDyvJWGNwqDI+VD3tiDTZg2HQuMs1d107 rSFA== X-Gm-Message-State: ACgBeo1FjSxaum7WHDz4WqT0XRjcM7+Ser2r6W+SPXZtjq04BYhIE/WS MxPemvQqlapqAXLaFUeuuAUITQ== X-Google-Smtp-Source: AA6agR7DUlrly/gB8iO5C9WBoic0rx7LvSGWxJkvnjrFZ9rxB2shB3SWMNwYUqZOOlZpVUzkHduN1Q== X-Received: by 2002:a19:6758:0:b0:48a:f098:f87c with SMTP id e24-20020a196758000000b0048af098f87cmr8599949lfj.242.1660111157480; Tue, 09 Aug 2022 22:59:17 -0700 (PDT) Received: from [192.168.1.39] ([83.146.140.105]) by smtp.gmail.com with ESMTPSA id u5-20020ac25185000000b0048b3768d2ecsm209639lfi.174.2022.08.09.22.59.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Aug 2022 22:59:16 -0700 (PDT) Message-ID: Date: Wed, 10 Aug 2022 08:59:15 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] usertools: fix bind failure from dpdk to kernel Content-Language: en-US To: "lihuisong (C)" , Stephen Hemminger Cc: dev@dpdk.org, andrew.rybchenko@oktetlabs.ru, thomas@monjalon.net, ferruh.yigit@xilinx.com, huangdaode@huawei.com, liudongdong3@huawei.com References: <20220805031022.9795-1-lihuisong@huawei.com> <20220805083529.5ca3233e@hermes.local> From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 11 Aug 2022 10:24:41 +0200 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 09/08/2022 14:44, lihuisong (C) wrote: > > 在 2022/8/5 23:35, Stephen Hemminger 写道: >> On Fri, 5 Aug 2022 11:10:22 +0800 >> Huisong Li wrote: >> >>> 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 >> 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. >> . > 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. This could have work but this was not the way to use the driver_override. The kernel ABI document clearly states: "and may be cleared with an empty string (echo > driver_override)." Documentation/ABI/testing/sysfs-bus-pci Please use the kernel ABI how it is described. Using it in wrong way might sometimes work, sometimes not. > 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 > > 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. > > 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. It is necessary because in 2014 it was described that PCI driver_override works like that. What you are implying here is that "it is not necessary to follow the API and we can do it differently"... > After all, the device has only one kernel driver, and binding > to dpdk driver(like, vfio-pci) must specify driver_override. > > [1] 23d99baf9d72 ("PCI: Use driver_set_override() instead of open-coding") Best regards, Krzysztof