From nobody Sun May 19 07:12:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1663701812; cv=none; d=zohomail.com; s=zohoarc; b=fkXPTLUgN6ZdlYtWIGnRDPdzqakkpPYjDTqK/dfmKcQf58ATTq4jw5615pS7nxqJjekDBTAutaDo9PLMoEbo+Ew+ibkh5/FCeBzVWCYXuaCNE/jPjAddB3kfJZlJnUD9DZlhfuF7WVyryspNp2qE1eDCRkpJnGhCr5dRySukKt8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663701812; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=mWjfxL+PKyk9WzGQL4xi5DVbpVcKZNGHZKxIr9jEnNk=; b=geOLDPklYLYY+MBmd+BDLFWEcS+94ecJb+Q6VgyS8S5rwdyCshlg6D1NGq1C7NE/uTTJauuZ9LesFvPDdILPPiBTeZb+x/1iimRotCgcpM8DlFrC3KzojG5ftz/d7lNLlmP++sEnwjYeGvJnn5DxEV1fPQXTm2rfRU6xUW0fTb4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1663701812855418.9131992594039; Tue, 20 Sep 2022 12:23:32 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-490-BVMuanoQN-yQvM2E1jOzOg-1; Tue, 20 Sep 2022 15:23:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 306F61012466; Tue, 20 Sep 2022 19:23:27 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72D461121314; Tue, 20 Sep 2022 19:23:25 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5C77C1946589; Tue, 20 Sep 2022 19:23:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A46121946588 for ; Tue, 20 Sep 2022 19:23:24 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9046C2166B2B; Tue, 20 Sep 2022 19:23:24 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.17.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6EF892166B29 for ; Tue, 20 Sep 2022 19:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663701810; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=mWjfxL+PKyk9WzGQL4xi5DVbpVcKZNGHZKxIr9jEnNk=; b=AqvTMAWGUe+tU2GVOUlBsAaN9Vs9sGD6SJoeB5zvzMt7ktrB3VE8Op+BFlQks3iD95tgnx DZeUMn4qWLElxJ0lCvr9rnXy1K/lhwPrxlcb0VNBuWqQOUUqy84LYhM4o1+qFznd+5cWGO UCmHjtmswq1gpKL0lhKKfqbncCflGf4= X-MC-Unique: BVMuanoQN-yQvM2E1jOzOg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH] nodedev: switch to udev 'bind' events Date: Tue, 20 Sep 2022 14:23:23 -0500 Message-Id: <20220920192323.1600899-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1663701813560100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Rather than listening to 'add' udev events, listen for 'bind' events instead. When we get an 'add' event, the sysfs tree for the device is often not ready yet. In that case we sleep in a loop until the sysfs tree appears, or give up after a timeout. udev added the 'bind' event to give userspace a signal that indicated when driver-specific attributes were available to be used. In other words, the sysfs tree *should* be ready and usable at this point. But just to be safe, we'll leave the wait loop in the code to handle corner cases, with the hope that it'll never be used. The udev 'bind' event was added in kernel 4.14 and the oldest platform we support has kernel 4.18, so it should be safe to make this change. Previous discussion on the mailing list: https://listman.redhat.com/archives/libvir-list/2022-August/233933.html Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety Reviewed-by: Laine Stump --- src/node_device/node_device_udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 07c10f0d88..781a8b32a6 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1759,7 +1759,7 @@ udevHandleOneDevice(struct udev_device *device) =20 VIR_DEBUG("udev action: '%s': %s", action, udev_device_get_syspath(dev= ice)); =20 - if (STREQ(action, "add") || STREQ(action, "change")) + if (STREQ(action, "bind") || STREQ(action, "change")) return udevAddOneDevice(device); =20 if (STREQ(action, "remove")) --=20 2.37.2