From nobody Fri Jan 3 00:48:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1729584647218695.3209758870954; Tue, 22 Oct 2024 01:10:47 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CFB4118A2; Tue, 22 Oct 2024 04:10:45 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 492B81872; Tue, 22 Oct 2024 04:10:26 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7717C180B; Tue, 22 Oct 2024 04:10:23 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id ED61F16ED for ; Tue, 22 Oct 2024 04:10:22 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-298-cxKsVvtoPHitlyeZjSTKTA-1; Tue, 22 Oct 2024 04:10:21 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 281BC1955EA5 for ; Tue, 22 Oct 2024 08:10:20 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 76ADB19560AE for ; Tue, 22 Oct 2024 08:10:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729584622; h=from:from: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; bh=1VyhL67xx0T7kelT03K3Yom1qXV6uyqBs+y0RirBAec=; b=VfdgcOcHlFXaDr2XdA0W1VNLycXnegIB2Kj2JgzeOZ760eBshHhluvQVuuwsCVdM6CBSl6 sTde1fHjo8PAbYly+2qiKqtjTDATwKmQ/mWRWh7LKTB57OGAleMi0QC3V1ZVe2HN18NtBx 2VgVo72LV7l22NvLf64JGeBW7Bx7ZB8= X-MC-Unique: cxKsVvtoPHitlyeZjSTKTA-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH] virnetdevopenvswitch: Warn on unsupported QoS settings Date: Tue, 22 Oct 2024 10:10:17 +0200 Message-ID: <1c59ab5fba0e4212a34ff2b51beba25be03b0c70.1729584598.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 65LFBTYD362NORZED6573S6UUUPVBRWB X-Message-ID-Hash: 65LFBTYD362NORZED6573S6UUUPVBRWB X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1729584648292116600 Content-Type: text/plain; charset="utf-8"; x-default="true" Let me preface this with stating the obvious: documentation on QoS in OVS is very sparse. This is all based on my observation and OVS codebase analysis. For the following QoS setting: the following QoS setting is generated into OVS (NB, our XML values are in KiB/s, OVS has them in bits/s): # ovs-vsctl list qos _uuid : a087226b-2da6-4575-ad4c-bf570cb812a9 external_ids : {ifname=3Dvnet1, vm-id=3D"7714e6b5-4885-4140-bc59-2= f77cc99b3b5"} other_config : {burst=3D"262144", max-rate=3D"8192000", min-rate= =3D"4096000"} queues : {0=3D655bf3a7-e530-4516-9caf-ec9555dfbd4c} type : linux-htb from which the following topology is generated: # for i in qdisc class; do tc -s -d -g $i show dev vnet1; done qdisc htb 1: root refcnt 2 r2q 10 default 0x1 direct_packets_stat 0 ver 3= .17 direct_qlen 1000 Sent 2186 bytes 16 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 +---(1:fffe) htb rate 8192Kbit ceil 8192Kbit linklayer ethernet burst 149= 9b/1mpu 60b cburst 1499b/1mpu 60b level 7 | Sent 2186 bytes 16 pkt (dropped 0, overlimits 0 requeues 0) | backlog 0b 0p requeues 0 | +---(1:1) htb prio 0 quantum 51200 rate 4096Kbit ceil 8192Kbit linkl= ayer ethernet burst 32Kb/1mpu 60b cburst 32Kb/1mpu 60b level 0 Sent 2186 bytes 16 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 Long story short, the default class (1:) for an OVS interface has average and peak set exactly as requested. But since it's nested under another class (1:fffe), it can borrow unused bandwidth. And the parent is set to have rate =3D ceil =3D peak from our XML. From [1]: htb_tc_install() calls htb_parse_qdisc_details__() which sets: 'hc->min_rate =3D hc->max_rate;' and then calls htb_setup_class_(..., tc_make_handle(1, 0xfffe), tc_make_handle(1, 0), &hc); to set up the top parent class. In other words - the interface is set up to so that it can always consume 'peak' bandwidth and there is no way for us to set it up differently. It's too late to deny setting 'peak' different to 'average' at XML validation phase so do the next best thing - throw a warning, just like we do in case is set for an unsupported type. 1: https://github.com/openvswitch/ovs/blob/main/lib/netdev-linux.c#L5039 Resolves: https://issues.redhat.com/browse/RHEL-53963 Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/util/virnetdevopenvswitch.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitc= h.c index e23f4c83b6..598cfa0031 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -945,6 +945,10 @@ virNetDevOpenvswitchInterfaceSetQos(const char *ifname, } =20 if (tx && tx->average) { + if (tx->peak && tx->peak !=3D tx->average) { + VIR_WARN("Setting different 'peak' value than 'average' for Qo= S for OVS interface %s is unsupported", + ifname); + } if (virNetDevOpenvswitchInterfaceSetTxQos(ifname, tx, vmuuid) < 0) return -1; } else { @@ -954,6 +958,10 @@ virNetDevOpenvswitchInterfaceSetQos(const char *ifname, } =20 if (rx) { + if (rx->peak && tx->peak !=3D rx->average) { + VIR_WARN("Setting different 'peak' value than 'average' for Qo= S for OVS interface %s is unsupported", + ifname); + } if (virNetDevOpenvswitchInterfaceSetRxQos(ifname, rx) < 0) return -1; } else { --=20 2.45.2