From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9063EA04C7; Tue, 15 Sep 2020 06:53:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 047E7E07; Tue, 15 Sep 2020 06:53:19 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2099.outbound.protection.outlook.com [40.107.93.99]) by dpdk.org (Postfix) with ESMTP id E12DA160 for ; Tue, 15 Sep 2020 06:53:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PYN3q+hCSPtqijife/ot39dJV6a0uBFf5VFO5gYqZo2V21zeVre5a3+90r3QMca1gHHW02vaCOm4+YYQSdtaxX1qzv4S2B9rkeMFsoKz7zWWiDLyf9kr1Yd1n1LIrTdF2WMk9oToUYb0rRxwf1c8FrYEC2Lg165ls7LnR0pdQLciLIrLbrTy0Z8cMjWMT/MQ5XT5yTM7U1V1vBFYzvbQM6Q4ozyc5c+XHqfNlPdTjY9DbC+jVYB7c0uaBitpyrIKOFI5i4bxcC6Vc9GPJLQgC0gvM8aHAbI9BQ0S9seHGvSOWll5sTxoI9EVqZ8rQ4C0R5lm8lZp+24cncZd/kA0Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q2UtzXluPqcm/abaYbgZgCxlxwwSYCXQXaQGXtfFNXs=; b=jeRO3Tkf5nj8bh9uw//YRv5q7E++/0LYRffPPrjqxleGmsJHCS0L42WcLM+Mm5kc6HWI+Io+dt7z1QoZxxpmornSUEcvihj3lvRwXF22rwdqIOx3bUIS+/w/zoPl4G2dpf2oDFZ3YbcGokKDSQIi+Ebb4Zvjj2KUiFVkEXNXqx5hgQKwqOtr+K3NekkkekmjoPscpYPVGbrbulVe+tZpNhspap8KnGKNuuujCBtwcDxTp7ZDV4n03asI4C3fG+n/JUR4ZGeVoa85VwifPGYfNMulI1A+yrHW2ovZ5wBOcfm8tBtRCxWiOOUEkkqb04KmDfWveswU2cLn9MHv72vfdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q2UtzXluPqcm/abaYbgZgCxlxwwSYCXQXaQGXtfFNXs=; b=hLfBNGEgUlgWzjLw8vcf/oMMy2Potll49XWKGp3pA72hEcMa/sGYfSfBaL+sF/QLSKSJoLwJBpudCGQxmwWYxdssgqWewNhWv8Z0EAkQs2wb06vOE0F7PggwH/orfiDkqX7RZtTyKV1MNCBagNSyzS0+AiU/7O546S4CooFh8Ek= Received: from BN8PR21MB1155.namprd21.prod.outlook.com (2603:10b6:408:73::10) by BN6PR21MB0756.namprd21.prod.outlook.com (2603:10b6:404:9c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.7; Tue, 15 Sep 2020 04:53:14 +0000 Received: from BN8PR21MB1155.namprd21.prod.outlook.com ([fe80::4936:76bb:2ef7:e2e8]) by BN8PR21MB1155.namprd21.prod.outlook.com ([fe80::4936:76bb:2ef7:e2e8%6]) with mapi id 15.20.3391.004; Tue, 15 Sep 2020 04:53:14 +0000 From: Long Li To: Matan Azrad , Stephen Hemminger CC: "matan@mellanox.com" , "grive@u246.net" , "dev@dpdk.org" , Raslan Darawsheh Thread-Topic: [dpdk-dev] [PATCH] net/vdev_netvsc: handle removal of associated pci device Thread-Index: AQHWhHw1BCnIHP4dAEiYvVGoM+pMX6lc03CAgAxMP3A= Date: Tue, 15 Sep 2020 04:53:14 +0000 Message-ID: References: <20200819175333.19601-1-stephen@networkplumber.org> <20200906113309.4a320400@hermes.lan> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=dd1eb5fe-0f02-48d0-bd8a-9577addb9a09; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2020-09-15T03:57:27Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2001:4898:80e8:7:ede7:db5c:c6fe:798] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: a8ff9c3d-3e41-46c7-2644-08d859334105 x-ms-traffictypediagnostic: BN6PR21MB0756: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: CDFQbCyxfTs1AZ37ClmJTWsNOSa70wU1Kystup4thtt1L4NAtQ6zk9vAn43uNVn5DbdmyPpt9a69huXorE97ACOhOzV0zUE1y+v6K4O5YkJVJ1lB0RGx1wh1NgP2lnXNEmCS9MgXbWQsR4SJCe/qf5ENUdMKr0ArnIAX8ZXZhprwTRZMK1KnCxcOHxL8feo6bUtGTIP+ZskNjf8uOn6zWpBKU3UhsHnC2Ss0HrF6YdqzJYkFxSO0/PslCpX8plITsMGIuxLdvSWrlVzy4VUSZZksIseyUq+y1qyby76hiE7en1MONrClWMjh/NHd3xTh2IPyXna6F8Io2MvX2LH5qVG5Om1jIBlw6CCFRybShW5sjDZZeGzUcMjkQV3K1rwC x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR21MB1155.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(39860400002)(136003)(366004)(396003)(76116006)(83380400001)(9686003)(7696005)(110136005)(66446008)(66556008)(64756008)(66476007)(186003)(71200400001)(66946007)(4326008)(33656002)(52536014)(316002)(5660300002)(6506007)(82950400001)(82960400001)(54906003)(8676002)(2906002)(8936002)(8990500004)(10290500003)(86362001)(55016002)(478600001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: 1n189u/W2szTXmP5iNNtMOc2NcdTIIPpns2ecTsKpL0aCmTnUpqvY3ciFJv4AjOftGOB0M9iGlDSZ/q/BGQgne5D7EzE89Dmjcdm8IUzzGvDudJScod2UHYShewNTAHGchrqHj9EaLLz/gGR6pRadnfl33tm99ltw7++Ko8t2y3CFyHI+fuVPbc6RAiJpX4xM0ZtUlaKpb32WKoiPi2bZiXdJeRW5ix3fOuEv9+SrgN1wZ86hrC0elV28zg6HEuwsjqeAQXNrYiRRjXtewB7orprUBkICtxu0OvMVfPYRUhpMI/fb6Si5O9N0KaFuKxoLlU3Zmlo9JHroXwBt40DHGdrotqGr/l57xJAdjd/Jw/EDy/K65xU6aWJDsD+pHSbXf0Ad4vOXIh0qlN45I2ntLY6QAdFv1sIDFsddEYu068BKT9HBT38UMeGeIPKJAf4P1hWi41aSup9LV2fRc6pS9e9VUTp517FM34DSdVvi8HUjQn8YtT1CTroajfRIKEzOZO+aOf37+jPzWP32JO0uVlJTxPjJSI2afjn5q8933cRmoPspgqjZ6yY7KVYNZHK3W3AdiW9aOGND6DUG9WH49ISxFyMfvm7+1vc1UIjrCABpQPIsc+Of3wU5tK5tO2cqKG0WjgTBjWArfFaK9fa10kQfYlEzMxYkv1Vb1og7fKdfFuBdpGSXfbENz6Jpo2vutHr3zTdPojFzTBdr9xhgQ== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR21MB1155.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8ff9c3d-3e41-46c7-2644-08d859334105 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Sep 2020 04:53:14.1406 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: TB3ykM6PReWx1gW8nR0daDVDZJR/6saXPcK/T1enhyglZfC7ic9EMJnaauULzb+Tnpm71kkmY+58jDcnpARhNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR21MB0756 Subject: Re: [dpdk-dev] [PATCH] net/vdev_netvsc: handle removal of associated pci device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >Subject: Re: [dpdk-dev] [PATCH] net/vdev_netvsc: handle removal of >associated pci device > >Hi Stephen > >From: Stephen Hemminger: >> On Sun, 6 Sep 2020 12:38:18 +0000 >> Matan Azrad wrote: >> >> > Hi Stephen >> > >> > From: Stephen Hemminger: >> > > The vdev_netvsc was not detecting when the associated PCI device >> > > (SRIOV) was removed. Because of that it would keep feeding the >> > > same >> > > (removed) device to failsafe PMD which would then unsuccessfully >> > > try and probe for it. >> > > >> > > Change to use a mark/sweep method to detect that PCI device was >> > > removed, and also only tell failsafe about new PCI devices. >> > > Vdev_netvsc does not have to keep stuffing the pipe with the same >> > > already existing PCI device. >> > >> > As I know, the vdev_netvsc driver doesn't call to failsafe if the >> > PCI device is >> not detected by the readlink command(considered as removed)... >> > Am I missing something? >> >> The original code is broken because ctx_yield is not cleared, it keeps >> sending the same value. > >Looking on the code again, It looks like ctx->yield has no effect on the n= ext >pipe write, It is just used for log. > >After the PCI interface matching to the netvsc interface, the pipe write i= s >triggered only if the readlink commands success to see the plugged-in PCI >device: >readlink /sys/class/net/[iface]/device/subsystem shows "pci" >readlink /sys/class/net/[iface]/device shows the pci device ID. > >So, the assumption is when the above readlink failed on the interface the >device is removed(plugged-out) and the fd write will not happen. > >The code will continue to retry probe again and again until success only f= or >plugged-in pci device matched the netvsc device. Hi Matan, The original code keeps writing to pipe even it's the same PCI device. The = new code writes to pipe for a new device, only once. See the following code= : + /* Skip if this is same device already sent to failsafe */ + if (strcmp(addr, ctx->yield) =3D=3D 0) + return 0; This patch also saves lots of CPU since it no longer writes to pipe all the= time. You are correct about the code will continue to probe on a new PCI d= evice. But someone has to do it to handle hot-add. Thanks, Long > >> It looks like device removal and add was never tested. > >This is basic test we have to test plug-in plug-out and it passed every da= y in >the last years. > >Maybe something new and special in your setup? > >> If you test removal you will see that vdev_netvsc: >> 1. Sends same PCI device repeatedly to failsafe (every alarm call) >> This is harmless, but useless. >> 2. When device is removed, keeps doing #1