From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79887C54E64 for ; Mon, 25 Mar 2024 09:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eodL44A0zmP+nkw2anBS4wOysdDIJWPYzeL/IC8ftqI=; b=ijJjhFVFkrjWHsaqV6feisxSj7 STOMtGYSaV+e3f9AH/xjqgK+ysaVhU6R+vlJkBdF7njazscUproqO+BfxpVk55ziluj4BE7xCXx8f Aj+4SG2nhtdmmGFCtOkzpfMUw4juOKVEKhFWSUVcSdNlHotvVNVcbcBcuGUyest1Q29DX3cOOMkTt P9ArVxcVQIsVqKcEFasgPK/6C3+V4ufb/yLYb5gClYkVUt+4ObeIu1tVBIfMPXgS0pA6UfPz8MVi2 n/XcO6h0L4S+E19Ck7gE1sZAW+9MS78bRlC0VtqMK7K1cc/JeNn9/Dk2Nf38gN36ZEdMh7f4ltHtt bhLkSdwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rogMR-0000000GMbR-04pQ; Mon, 25 Mar 2024 09:11:19 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rogML-0000000GMXc-4AO6 for linux-um@lists.infradead.org; Mon, 25 Mar 2024 09:11:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711357869; h=from:from: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:autocrypt:autocrypt; bh=eodL44A0zmP+nkw2anBS4wOysdDIJWPYzeL/IC8ftqI=; b=d94IAmgPehhHSjyN+E9tAV1AgzIhH11yJGNzH/EvqN8+N2c5CYIlrzzoNQim1nIik/HDbo M/KLWBZB20ViVUaG+I18NogjwTpn1PwZui3T+xxSou/yOM5bOvt8km+s0Ep2/ReMyA84Yn eTyxcpBh9jlzgRu4Z3b78V73nZ8hQJU= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-237-SPtEeEfdOeSLGKvI8O8-zQ-1; Mon, 25 Mar 2024 05:11:07 -0400 X-MC-Unique: SPtEeEfdOeSLGKvI8O8-zQ-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2d486c08c6eso40093501fa.0 for ; Mon, 25 Mar 2024 02:11:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711357866; x=1711962666; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eodL44A0zmP+nkw2anBS4wOysdDIJWPYzeL/IC8ftqI=; b=nvAM9xgCdXAkW4GhPRzeO+ucFnjCLGuxFUJtBBGgDhfHIbuOgNaaDOx9CY7k6MbRGy tUsxTNKTZ1KF7k/ocH9VxkXUENsL/g8SUkbHsWHsmlCvKUSnH6EDVkq5JvkaYSipys0p 2+kDxvl7bUSKoSrR6BsepA+/IARQJiVb0MYFUjt9SaNow2CctsZupp1PQPwr21xxfLdU eHF89NENrp8gEB0lm406Cg8ThnqOyJpwRW66ON6uuVdqEAydMIoZtBwIkt4LUFgCTpaO Guej2A6weU7TX5hr66WFbWy8xUaPojSGrgFDrqC4/uN1jczzHS8AXiBfJsdbWWwTI6gZ MAmQ== X-Forwarded-Encrypted: i=1; AJvYcCVeFTkAR9q6bqUBw/7TRs1ECRcdevp2Frk8HimffPLr6sSs/Td3UKoOYA0YEzuCt63BqtHaoDZT1rRWq3mQ26xuB5/E9dXT34tck3DG X-Gm-Message-State: AOJu0YyVO1shnhmdDrWr4XsWRNzQPdcZtSaCyCBaQNOd/rzxtTcjHN+P LcmT16Wf/GHmdk01J/SyK7IsgFaChrEGjHYT+za0S65TvwAyWGUyrQXfLnDhg2Fe/sfumUkVJnC Tx0s58o4iAd+ijDgiQZ67jyNFgynXAvRKgWuORNNu/1xkRG7vOeQp2GY/LzVnvg== X-Received: by 2002:a2e:8947:0:b0:2d4:7777:b7fb with SMTP id b7-20020a2e8947000000b002d47777b7fbmr4359251ljk.17.1711357865745; Mon, 25 Mar 2024 02:11:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7PlfCmimUoKtTJDbsbLoVaILrVOW6htqejyhlsq8LubUc6twBMEH8AEMoGLTKITdy3ouCHg== X-Received: by 2002:a2e:8947:0:b0:2d4:7777:b7fb with SMTP id b7-20020a2e8947000000b002d47777b7fbmr4359222ljk.17.1711357865235; Mon, 25 Mar 2024 02:11:05 -0700 (PDT) Received: from ?IPV6:2003:cb:c738:b400:6a82:1eac:2b5:8fca? (p200300cbc738b4006a821eac02b58fca.dip0.t-ipconnect.de. [2003:cb:c738:b400:6a82:1eac:2b5:8fca]) by smtp.gmail.com with ESMTPSA id h20-20020a05600c351400b0041477f95cf6sm7785217wmq.13.2024.03.25.02.11.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Mar 2024 02:11:04 -0700 (PDT) Message-ID: <041867ab-6cff-4bd1-9a44-2ca847c1ad63@redhat.com> Date: Mon, 25 Mar 2024 10:11:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH vhost v4 1/6] virtio_balloon: remove the dependence where names[] is null To: Xuan Zhuo Cc: virtualization@lists.linux.dev, Richard Weinberger , Anton Ivanov , Johannes Berg , Hans de Goede , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Vadim Pasternak , Bjorn Andersson , Mathieu Poirier , Cornelia Huck , Halil Pasic , Eric Farman , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "Michael S. Tsirkin" , Jason Wang , linux-um@lists.infradead.org, platform-driver-x86@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, Daniel Verkamp References: <20240321101532.59272-1-xuanzhuo@linux.alibaba.com> <20240321101532.59272-2-xuanzhuo@linux.alibaba.com> <1711346901.0977402-2-xuanzhuo@linux.alibaba.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IV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duZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <1711346901.0977402-2-xuanzhuo@linux.alibaba.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240325_021114_222965_4CE7A455 X-CRM114-Status: GOOD ( 26.51 ) X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+linux-um=archiver.kernel.org@lists.infradead.org On 25.03.24 07:08, Xuan Zhuo wrote: > On Fri, 22 Mar 2024 22:02:27 +0100, David Hildenbrand wrote: >> On 22.03.24 20:16, Daniel Verkamp wrote: >>> On Thu, Mar 21, 2024 at 3:16 AM Xuan Zhuo wrote: >>>> >>>> Currently, the init_vqs function within the virtio_balloon driver relies >>>> on the condition that certain names array entries are null in order to >>>> skip the initialization of some virtual queues (vqs). This behavior is >>>> unique to this part of the codebase. In an upcoming commit, we plan to >>>> eliminate this dependency by removing the function entirely. Therefore, >>>> with this change, we are ensuring that the virtio_balloon no longer >>>> depends on the aforementioned function. >>> >>> This is a behavior change, and I believe means that the driver no >>> longer follows the spec [1]. >>> >>> For example, the spec says that virtqueue 4 is reporting_vq, and >>> reporting_vq only exists if VIRTIO_BALLOON_F_PAGE_REPORTING is set, >>> but there is no mention of its virtqueue number changing if other >>> features are not set. If a device/driver combination negotiates >>> VIRTIO_BALLOON_F_PAGE_REPORTING but not VIRTIO_BALLOON_F_STATS_VQ or >>> VIRTIO_BALLOON_F_FREE_PAGE_HINT, my reading of the specification is >>> that reporting_vq should still be vq number 4, and vq 2 and 3 should >>> be unused. This patch would make the reporting_vq use vq 2 instead in >>> this case. >>> >>> If the new behavior is truly intended, then the spec does not match >>> reality, and it would need to be changed first (IMO); however, >>> changing the spec would mean that any devices implemented correctly >>> per the previous spec would now be wrong, so some kind of mechanism >>> for detecting the new behavior would be warranted, e.g. a new >>> non-device-specific virtio feature flag. >>> >>> I have brought this up previously on the virtio-comment list [2], but >>> it did not receive any satisfying answers at that time. >> >> Rings a bell, but staring at this patch, I thought that there would be >> no behavioral change. Maybe I missed it :/ >> >> I stared at virtio_ccw_find_vqs(), and it contains: >> >> for (i = 0; i < nvqs; ++i) { >> if (!names[i]) { >> vqs[i] = NULL; >> continue; >> } >> >> vqs[i] = virtio_ccw_setup_vq(vdev, queue_idx++, callbacks[i], >> names[i], ctx ? ctx[i] : false, >> ccw); >> if (IS_ERR(vqs[i])) { >> ret = PTR_ERR(vqs[i]); >> vqs[i] = NULL; >> goto out; >> } >> } >> >> We increment queue_idx only if an entry was not NULL. SO I thought no >> behavioral change? (at least on s390x :) ) >> >> It's late here in Germany, so maybe I'm missing something. > > I think we've encountered a tricky issue. Currently, all transports handle queue > id by incrementing them in order, without skipping any queue id. So, I'm quite > surprised that my changes would affect the spec. The fact that the > 'names' value is null is just a small trick in the Linux kernel implementation > and should not have an impact on the queue id. > > I believe that my recent modification will not affect the spec. So, let's > consider the issues with this patch set separately for now. Regarding the Memory > Balloon Device, it has been operational for many years, and perhaps we should > add to the spec that if a certain vq does not exist, then subsequent vqs will > take over its id. Right, if I am not missing something your patch should have no functional change in that regard (that the current behavior/implementation might not match the spec is a different discussion). @Daniel, if I'm missing something, please shout. -- Cheers, David / dhildenb