From nobody Sun Feb 8 22:58:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592294145; cv=none; d=zohomail.com; s=zohoarc; b=HGJm5TIzJKCFKE0v5nOw0MDNBYLB+zNpFBU/mflVsMn4wdjhYXjPCEY/PvLAKsRH8zC8ecXAidc50zlQjOUTMekx4oHxWxTAXftyP69zR03+zP8pB4LwalbAoJ+ys75zw5W2koaA2Gq9JpPudeq9uR1vr04hRNX+K7o0gN7z73U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592294145; h=Content-Type:Content-Transfer-Encoding:Cc: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=BFdxBukX31JonRF3KPsrV07rzYJI5tlUTIprGKTjDug=; b=cJzNgYIp+QLx+4X0plq6OAHeD1Z7jALTapoiMbPd5VLYhWyAbABvDM189OtkrBa45dnMNtgybOGl+3XOq82a5KQXddlEJ43fMKN50snfsvHgXaajcfip/X2CP4f1WDFlkYN9cNGxuL5wOiTyfrj8KR/39aDU1ZFmHbgUEsMdyAY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1592294145499556.4242994025843; Tue, 16 Jun 2020 00:55:45 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-105-PT8X-_2NOhKyu69Pm2yM_w-1; Tue, 16 Jun 2020 03:55:42 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 39774E913; Tue, 16 Jun 2020 07:55:37 +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 179B219D71; Tue, 16 Jun 2020 07:55:37 +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 DDEF2833CE; Tue, 16 Jun 2020 07:55:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05G7tP11005062 for ; Tue, 16 Jun 2020 03:55:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 50D5A1004C75; Tue, 16 Jun 2020 07:55:25 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A1F81006F8D for ; Tue, 16 Jun 2020 07:55:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 38F06858EFE for ; Tue, 16 Jun 2020 07:55:24 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80051.outbound.protection.outlook.com [40.107.8.51]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-387-J-i0xHm0Mh21sTqF9pew1Q-2; Tue, 16 Jun 2020 03:55:21 -0400 Received: from AM6PR04MB5782.eurprd04.prod.outlook.com (2603:10a6:20b:aa::17) by AM6PR04MB5765.eurprd04.prod.outlook.com (2603:10a6:20b:ae::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.21; Tue, 16 Jun 2020 07:55:19 +0000 Received: from AM6PR04MB5782.eurprd04.prod.outlook.com ([fe80::d848:9dea:7742:a55]) by AM6PR04MB5782.eurprd04.prod.outlook.com ([fe80::d848:9dea:7742:a55%4]) with mapi id 15.20.3088.029; Tue, 16 Jun 2020 07:55:19 +0000 Received: from t440p.gns.novell.com (114.255.249.163) by SN4PR0201CA0062.namprd02.prod.outlook.com (2603:10b6:803:20::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19 via Frontend Transport; Tue, 16 Jun 2020 07:55:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592294144; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=BFdxBukX31JonRF3KPsrV07rzYJI5tlUTIprGKTjDug=; b=CBu+K2Nbx9P3PJEFFoOlHDHKoLIX0obx1+E/eTbw8McAWq0TyBqFqusdKLDglIlvCndz7r GUDVPQkeFd4dVWHQxmfqnv02WootSzTTSaa05BPb2fca2g6bg9sO56fDz+YIUo7uWgefA+ z5lctnZWdYKGB63dquQER3i8hhxKCt4= X-MC-Unique: PT8X-_2NOhKyu69Pm2yM_w-1 X-MC-Unique: J-i0xHm0Mh21sTqF9pew1Q-2 From: Lin Ma To: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] qemu: Add support for max_unmap_size property of scsi-disk Date: Tue, 16 Jun 2020 15:54:38 +0800 Message-ID: <20200616075438.5726-6-lma@suse.com> In-Reply-To: <20200616075438.5726-1-lma@suse.com> References: <20200616075438.5726-1-lma@suse.com> X-ClientProxiedBy: SN4PR0201CA0062.namprd02.prod.outlook.com (2603:10b6:803:20::24) To AM6PR04MB5782.eurprd04.prod.outlook.com (2603:10a6:20b:aa::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Originating-IP: [114.255.249.163] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9f94f799-0d5e-490a-01b0-08d811ca9d56 X-MS-TrafficTypeDiagnostic: AM6PR04MB5765: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2201; X-Forefront-PRVS: 04362AC73B X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1TWTjWafexdH8Up98ZueC57FdQ1XD0YrFY6Ah8Br868HiXDx050c9gr9ufGzc918h90pOlBmFJw6YXTnM9N5pxnd8M+cOW27guX+sGueQGG3fgb9owVeByf01xmX81/ZL4jJjvf6ThegHznTI8wjEL1JwJVX430eSxlATHep3gTZg+zi0HFY1IjAiWjru5JpoRFrt986x6wmmpg6qbq6DPNTNmlXELl75OPSC4gOU2saud8261EM+yoPMqXgmmO/dlRXm9Gip7panknT2f6R6bCtsHYmgjHLxn7BdpQXrJoNIgtp0BbqOYvskOgC9m6n51MZ12NFrhp3qeuXRC3e6Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5782.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(346002)(39860400002)(136003)(366004)(396003)(376002)(2906002)(508600001)(6486002)(6512007)(316002)(1076003)(6506007)(83380400001)(52116002)(186003)(16526019)(8676002)(8936002)(26005)(2616005)(956004)(86362001)(66556008)(66476007)(66946007)(6666004)(5660300002)(6916009)(4326008)(36756003)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LoCJ4KN7LgbQZlzLaFrAXptkgFyRMbLwcLTIuh5CskCMtLDX2JuSyohQMO2tkk6pxwYeH0y3Fv+ChvdOl7uHqjGlkyHQD5VvXD9dcWxXp0QUj7bNlRMUGz6GhFaqzRoR/hbptiZlEOiNAsdcwSuF7fvBuexVIp+snNPlYuZLc8GT8A45fsvu520JFnOiJldZvqmcE6NHwGdW3j0feQZlfGjD4MdU53Z5zEUPkzbjlmiY40GNvu0QZwXjUvOX01o+2zBUN3kULMY4xElEXGliKjF4UBdLAA2fKqrilAywxj/TNuP5eZjLIe3xaNf8RZdDRBAcz/CFXBzqXGSc8ljRXLCUeZVNQAYMCi3UWSZwP8qA+a27qMV2NiLqRy5Emp/um/RQkqvqwOGlIAxOrO+AD0NIQOkEhni6uqW+hIqKHIgXigfClOXLdjl8NDPy6UzPjJNvGbv0CcZCPDhqjlFiqfsYloUn2Fw+MY4/tg+SbIA= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f94f799-0d5e-490a-01b0-08d811ca9d56 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2020 07:55:19.7348 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +Ww6A3m12BqI2cNNSuVP5ksHmVsnwKwSrlVZhEgAEWq3IewGTwCvz9ESBZ/sdXyQ X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5765 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 05G7tP11005062 X-loop: libvir-list@redhat.com Cc: Lin Ma 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.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The default max_unmap_size is set to 1GB by qemu. The Maximum unmap LBA count field in the block limits VPD page is impacted by it: Maximum unmap LBA count =3D max unmap size / logical block size Signed-off-by: Lin Ma --- src/qemu/qemu_command.c | 10 ++++++ .../disk-scsi-disk-max_unmap_size.args | 32 +++++++++++++++++++ .../disk-scsi-disk-max_unmap_size.xml | 28 ++++++++++++++++ tests/qemuxml2argvtest.c | 4 +++ 4 files changed, 74 insertions(+) create mode 100644 tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.ar= gs create mode 100644 tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 43f3a4c2a3..78f856766e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1852,6 +1852,16 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, if (disk->blockio.discard_granularity > 0) virBufferAsprintf(&opt, ",discard_granularity=3D%u", disk->blockio.discard_granularity); + if (disk->blockio.max_unmap_size > 0) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_MAX_UNMAP_SI= ZE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("max_unmap_size property isn't supported = by " + "this QEMU binary")); + return NULL; + } + virBufferAsprintf(&opt, ",max_unmap_size=3D%u", + disk->blockio.max_unmap_size); + } } =20 if (disk->wwn) { diff --git a/tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.args b/te= sts/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.args new file mode 100644 index 0000000000..1d399ca451 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-realtime mlock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-device virtio-scsi-pci,id=3Dscsi0,bus=3Dpci.0,addr=3D0x3 \ +-usb \ +-drive file=3D/var/lib/libvirt/images/guest.raw,format=3Draw,if=3Dnone,id= =3Ddrive-scsi0-0-0-0 \ +-device scsi-hd,bus=3Dscsi0.0,channel=3D0,scsi-id=3D0,lun=3D0,drive=3Ddriv= e-scsi0-0-0-0,\ +id=3Dscsi0-0-0-0,bootindex=3D1,max_unmap_size=3D1073741824 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x4 diff --git a/tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.xml b/tes= ts/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.xml new file mode 100644 index 0000000000..06c20e3431 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-scsi-disk-max_unmap_size.xml @@ -0,0 +1,28 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 02f8846e57..632dcd1ad8 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1262,6 +1262,10 @@ mymain(void) QEMU_CAPS_SCSI_LSI, QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-serial", QEMU_CAPS_KVM); + DO_TEST("disk-scsi-disk-max_unmap_size", + QEMU_CAPS_BLOCKIO, + QEMU_CAPS_VIRTIO_SCSI, + QEMU_CAPS_SCSI_DISK_MAX_UNMAP_SIZE); DO_TEST_PARSE_ERROR("disk-fdc-incompatible-address", NONE); DO_TEST_PARSE_ERROR("disk-ide-incompatible-address", --=20 2.26.0