From nobody Mon Feb 9 09:08:23 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; 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=1642096098; cv=none; d=zohomail.com; s=zohoarc; b=CfTfF8wsOC03tsYyqQcbBQPRvjCoCMBQzqeAAZBxmEoSexezjRpwkXqZZ7DApet4+u9e30qPVcq4SAGRb9R2Y4Ex22LPMTG34ggSV+F5rrg7EdmsW0IIqJpgcHK/Osp94gc2Lu5Z0g29c1jhZ+aTiZTBiKpbdpuLaWNF9w7g76w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642096098; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9V9CsqcFykRZmRnpvwJXB9oxCgNwjlTgRsBQc8jaB9A=; b=esOPZmwS0vKXn5VXCRzMUXJmvWq2UoSRXLQqdmWR5xNQa1X+YS4CwPdoZzIAoDoqSjSyAHsf8RUxGmzs4cq9KExfV8yM0Wo8HaO+W2+ldA0ZcJ8zSSZs+r/LX1xj8aoEZy1E7Aad7JRgNFod4v2OsFOA3kF+lSwSL3WPy8gKoAQ= 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 1642096098019549.1293753452798; Thu, 13 Jan 2022 09:48:18 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-664-8mLWIbxsPOW2E0cEYTwZeA-1; Thu, 13 Jan 2022 12:48:15 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6AC7918397BF; Thu, 13 Jan 2022 17:48:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 473D864BF3; Thu, 13 Jan 2022 17:48:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DF8374BB7C; Thu, 13 Jan 2022 17:48:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20DHlvu9004980 for ; Thu, 13 Jan 2022 12:47:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id BF17C2ED67; Thu, 13 Jan 2022 17:47:57 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 460842E053 for ; Thu, 13 Jan 2022 17:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642096097; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9V9CsqcFykRZmRnpvwJXB9oxCgNwjlTgRsBQc8jaB9A=; b=QClc8nj74ULvIv0aCqS6TR6HwH7HobzOhn7jJmhtpP7MfiMcYN3L9fu5ghXhlO6Q2gta7Z z/yBJdpoZu+TalR3GGDjrwMkmLgCqmdEPYIfS4pTB7bhOf+bnIiynfcO9b2fK4nqvCsv9n uM+UWzdD3MgNWq3wO0HzJSuoL1MBYuk= X-MC-Unique: 8mLWIbxsPOW2E0cEYTwZeA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/7] qemu: remove all use of SGIO Date: Thu, 13 Jan 2022 18:47:38 +0100 Message-Id: <6a4a23a98ffbd81c5db04e4971ab607567c26b8f.1642095763.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642096099586100001 Now that the 'unfiltered' attribute is rejected by the validator, remove all the code that deals with the feature. Signed-off-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 2 - src/qemu/qemu_conf.c | 121 --------------------------------------- src/qemu/qemu_conf.h | 2 - src/qemu/qemu_hostdev.c | 3 - src/qemu/qemu_hotplug.c | 3 - src/qemu/qemu_process.c | 3 - 6 files changed, 134 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 932dbf4f72..48e8ef6c72 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3511,7 +3511,6 @@ virDoubleToStr; virFormatIntDecimal; virFormatIntPretty; virGetDeviceID; -virGetDeviceUnprivSGIO; virGetGroupID; virGetGroupList; virGetGroupName; @@ -3545,7 +3544,6 @@ virPipeQuiet; virScaleInteger; virSetBlocking; virSetCloseExec; -virSetDeviceUnprivSGIO; virSetInherit; virSetNonBlock; virSetSockReuseAddr; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 73497ad848..28cbdd6e61 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1472,65 +1472,6 @@ qemuGetSharedDeviceKey(const char *device_path) return g_strdup_printf("%d:%d", maj, min); } =20 -/* - * Make necessary checks for the need to check and for the current setting - * of the 'unpriv_sgio' value for the device_path passed. - * - * Returns: - * 0 - Success - * -1 - Some failure which would already have been messaged - * -2 - Mismatch with the "shared" sgio setting - needs to be messaged - * by caller since it has context of which type of disk resource is - * being used and in the future the hostdev information. - */ -static int -qemuCheckUnprivSGIO(GHashTable *sharedDevices G_GNUC_UNUSED, - const char *device_path G_GNUC_UNUSED, - int sgio G_GNUC_UNUSED) -{ - /* It can't be conflict if unpriv_sgio is not supported by kernel. */ - return 0; -} - - -/* Check if a shared device's setting conflicts with the conf - * used by other domain(s). Currently only checks the sgio - * setting. Note that this should only be called for disk with - * block source if the device type is disk. - * - * Returns 0 if no conflicts, otherwise returns -1. - */ -static int -qemuCheckSharedDisk(GHashTable *sharedDevices, - virDomainDiskDef *disk) -{ - int ret; - - if (disk->device !=3D VIR_DOMAIN_DISK_DEVICE_LUN) - return 0; - - if ((ret =3D qemuCheckUnprivSGIO(sharedDevices, disk->src->path, - disk->sgio)) < 0) { - if (ret =3D=3D -2) { - if (virDomainDiskGetType(disk) =3D=3D VIR_STORAGE_TYPE_VOLUME)= { - virReportError(VIR_ERR_OPERATION_INVALID, - _("sgio of shared disk 'pool=3D%s' 'volume= =3D%s' " - "conflicts with other active domains"), - disk->src->srcpool->pool, - disk->src->srcpool->volume); - } else { - virReportError(VIR_ERR_OPERATION_INVALID, - _("sgio of shared disk '%s' conflicts with " - "other active domains"), - disk->src->path); - } - } - return -1; - } - - return 0; -} - =20 bool qemuSharedDeviceEntryDomainExists(qemuSharedDeviceEntry *entry, @@ -1647,9 +1588,6 @@ qemuSharedDiskAddRemoveInternal(virQEMUDriver *driver, goto cleanup; =20 if (addDisk) { - if (qemuCheckSharedDisk(driver->sharedDevices, disk) < 0) - goto cleanup; - if (qemuSharedDeviceEntryInsert(driver, key, name) < 0) goto cleanup; } else { @@ -1804,65 +1742,6 @@ qemuRemoveSharedDevice(virQEMUDriver *driver, } =20 =20 -int -qemuSetUnprivSGIO(virDomainDeviceDef *dev) -{ - virDomainDiskDef *disk =3D NULL; - virDomainHostdevDef *hostdev =3D NULL; - const char *path =3D NULL; - int val =3D -1; - - /* "sgio" is only valid for block disk; cdrom - * and floopy disk can have empty source. - */ - if (dev->type =3D=3D VIR_DOMAIN_DEVICE_DISK) { - disk =3D dev->data.disk; - - if (disk->device !=3D VIR_DOMAIN_DISK_DEVICE_LUN || - !virStorageSourceIsBlockLocal(disk->src)) - return 0; - - path =3D virDomainDiskGetSource(disk); - } else if (dev->type =3D=3D VIR_DOMAIN_DEVICE_HOSTDEV) { - hostdev =3D dev->data.hostdev; - - if (!qemuIsSharedHostdev(hostdev)) - return 0; - - if (hostdev->source.subsys.u.scsi.sgio) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("'sgio' is not supported for SCSI " - "generic device yet ")); - return -1; - } - - return 0; - } else { - return 0; - } - - /* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. = */ - val =3D (disk->sgio =3D=3D VIR_DOMAIN_DEVICE_SGIO_UNFILTERED); - - /* Do not do anything if unpriv_sgio is not supported by the kernel an= d the - * whitelist is enabled. But if requesting unfiltered access, always = call - * virSetDeviceUnprivSGIO, to report an error for unsupported unpriv_s= gio. - */ - if (val =3D=3D 1) { - int curr_val; - - if (virGetDeviceUnprivSGIO(path, NULL, &curr_val) < 0) - return -1; - - if (curr_val !=3D val && - virSetDeviceUnprivSGIO(path, NULL, val) < 0) { - return -1; - } - } - - return 0; -} - int qemuDriverAllocateID(virQEMUDriver *driver) { return g_atomic_int_add(&driver->lastvmid, 1) + 1; diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 2f64e39a18..5961b0b205 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -376,8 +376,6 @@ int qemuRemoveSharedDisk(virQEMUDriver *driver, const char *name) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); =20 -int qemuSetUnprivSGIO(virDomainDeviceDef *dev); - int qemuDriverAllocateID(virQEMUDriver *driver); virDomainXMLOption *virQEMUDriverCreateXMLConf(virQEMUDriver *driver, const char *defsecmodel); diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 00f301f941..5461de459a 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -289,9 +289,6 @@ qemuHostdevPrepareSCSIDevices(virQEMUDriver *driver, =20 if (qemuAddSharedDevice(driver, &dev, name) < 0) return -1; - - if (qemuSetUnprivSGIO(&dev) < 0) - return -1; } =20 return virHostdevPrepareSCSIDevices(hostdev_mgr, QEMU_DRIVER_NAME, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 04c6600f26..0dd3121221 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -980,9 +980,6 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *d= river, if (qemuAddSharedDevice(driver, dev, vm->def->name) < 0) goto cleanup; =20 - if (qemuSetUnprivSGIO(dev) < 0) - goto cleanup; - if (qemuDomainDetermineDiskChain(driver, vm, disk, NULL, true) < 0) goto cleanup; =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5c9ca0fe4f..b425acfec1 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5046,9 +5046,6 @@ qemuProcessSetupRawIO(virQEMUDriver *driver, dev.data.disk =3D disk; if (qemuAddSharedDevice(driver, &dev, vm->def->name) < 0) goto cleanup; - - if (qemuSetUnprivSGIO(&dev) < 0) - goto cleanup; } =20 /* If rawio not already set, check hostdevs as well */ --=20 2.31.1