From nobody Sat Feb 7 08:02:10 2026 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com 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 1647510538060740.125726989329; Thu, 17 Mar 2022 02:48:58 -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-618-dsu-AAxlO3OlOT29hqsaGw-1; Thu, 17 Mar 2022 05:48:53 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C6ECF185A7A4; Thu, 17 Mar 2022 09:48:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0DFDC28100; Thu, 17 Mar 2022 09:48:51 +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 5CC9E1940365; Thu, 17 Mar 2022 09:48:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 49154194035E for ; Thu, 17 Mar 2022 09:48:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2BB852D47A; Thu, 17 Mar 2022 09:48:50 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 278442D479 for ; Thu, 17 Mar 2022 09:48:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CD1461C05EDA for ; Thu, 17 Mar 2022 09:48:44 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-pmp7s7_NM0yl7PYPxdJxSQ-1; Thu, 17 Mar 2022 05:48:41 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22H7No9i015172; Thu, 17 Mar 2022 09:48:40 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 3ev0jh2kpd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Mar 2022 09:48:40 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 22H9lo4T019975; Thu, 17 Mar 2022 09:48:38 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04fra.de.ibm.com with ESMTP id 3erk58sb33-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Mar 2022 09:48:38 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 22H9mahQ51511570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Mar 2022 09:48:36 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12C7D5204E; Thu, 17 Mar 2022 09:48:36 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.69.203]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id E2E9252054; Thu, 17 Mar 2022 09:48:35 +0000 (GMT) X-MC-Unique: dsu-AAxlO3OlOT29hqsaGw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: pmp7s7_NM0yl7PYPxdJxSQ-1 From: Boris Fiuczynski To: libvir-list@redhat.com Subject: [PATCH v2 4/4] nodedev: trigger mdev device definition update on udev add and remove Date: Thu, 17 Mar 2022 10:48:30 +0100 Message-Id: <20220317094830.12575-5-fiuczy@linux.ibm.com> In-Reply-To: <20220317094830.12575-1-fiuczy@linux.ibm.com> References: <20220317094830.12575-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: xKi9J-DLqdXfkfWgPBjvT46jFQmW8gy2 X-Proofpoint-ORIG-GUID: xKi9J-DLqdXfkfWgPBjvT46jFQmW8gy2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-17_03,2022-03-15_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 impostorscore=0 adultscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203170056 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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: , Cc: mprivozn@redhat.com, jjongsma@redhat.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1647510538889100003 Content-Type: text/plain; charset="utf-8" When nodedev objects are added and removed if possible check if mdev-types = is supported by the object and trigger a mdev device definition update to corr= ect the associated parent nodedevs. Signed-off-by: Boris Fiuczynski Reviewed-by: Michal Privoznik Reviewed-by: Jonathon Jongsma --- src/node_device/node_device_udev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 17b6bb9299..b3e8103dae 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1440,6 +1440,10 @@ udevRemoveOneDeviceSysPath(const char *path) } virNodeDeviceObjEndAPI(&obj); =20 + /* cannot check for mdev_types since they have already been removed */ + if (nodeDeviceUpdateMediatedDevices() < 0) + VIR_WARN("mdevctl failed to update mediated devices"); + virObjectEventStateQueue(driver->nodeDeviceEventState, event); return 0; } @@ -1507,6 +1511,7 @@ udevAddOneDevice(struct udev_device *device) bool persistent =3D false; bool autostart =3D false; bool is_mdev; + bool has_mdev_types =3D false; =20 def =3D g_new0(virNodeDeviceDef, 1); =20 @@ -1562,8 +1567,12 @@ udevAddOneDevice(struct udev_device *device) event =3D virNodeDeviceEventUpdateNew(objdef->name); =20 virNodeDeviceObjSetActive(obj, true); + has_mdev_types =3D virNodeDeviceObjHasCap(obj, VIR_NODE_DEV_CAP_MDEV_T= YPES); virNodeDeviceObjEndAPI(&obj); =20 + if (has_mdev_types && nodeDeviceUpdateMediatedDevices() < 0) + VIR_WARN("mdevctl failed to update mediated devices"); + ret =3D 0; =20 cleanup: --=20 2.33.1