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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 62931C64EC4 for ; Wed, 8 Mar 2023 12:16:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZsiI-00076E-Qj; Wed, 08 Mar 2023 07:16:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZsi2-0006fZ-BX for qemu-devel@nongnu.org; Wed, 08 Mar 2023 07:15:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZshz-00008R-LF for qemu-devel@nongnu.org; Wed, 08 Mar 2023 07:15:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678277748; 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: in-reply-to:in-reply-to:references:references; bh=vuI7aCGTLI9l5zPBPqPbiawYASfv5arGWfUcTkqb4Jk=; b=Dfn++ZMjHtVxr5UQjR19vqZbsBjI5BJnhOM7a0Ygkb2pDwF44/Iw13+SILGkP++0OSKK/R Hez692Xb09L06JdYN3aED//MdtOU/i8IYxOCiEhsfxoE9Z7riiXGlaqFSYNjA9Eg//ydXY XjIn3rb3Pw6P+TNzyIdFZPUe79dIhmw= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-66-At5tNw78PMeqntGuZzWR-w-1; Wed, 08 Mar 2023 07:15:47 -0500 X-MC-Unique: At5tNw78PMeqntGuZzWR-w-1 Received: by mail-ed1-f72.google.com with SMTP id da22-20020a056402177600b004c60694083eso23401001edb.5 for ; Wed, 08 Mar 2023 04:15:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678277746; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vuI7aCGTLI9l5zPBPqPbiawYASfv5arGWfUcTkqb4Jk=; b=V5BskuKPAnHDbyP09LSY9Dr23GPmD31nNAAU4ymwKzifY5N5AzYszYnvMlDRF44qtx +3tjoGOA3cm4tZp5b6FNEIRUX5XPVbx7Da7absjVsW8EuGb+8Pos3+DXxDrJREd0unkn J051rGxQhkW15pUDu69TYOco6aAuLKdmYnlqIVgQKnwo9y5+XP5xR4NDFioijikjULOM F3wFaNmZasNG73S16CDFNFfxo8bKgxYNj3sW6C+eOWKqbEjCM7W4EMTXGFdlXMrsVL0T 4Se0Hr9JI++g8KKhSqp2GphRuPwz79TrCjsxL7O7YayLIa7CO/5VsltY8G5Fe1G0xgK8 QnjQ== X-Gm-Message-State: AO0yUKWKLj1MGIXYBC0HW1PU01C0fQeQ75gwruboPBUKcCb/LFcSxq/E Nudu7XnSW3mK5xz79LB7qJ25nk951NzG38g7b0zQkT31xhuZwZNCY1ugR5JrgF0AMayHsTqEWSd tHJg6bFfeDbcNVJw= X-Received: by 2002:a17:906:6bc1:b0:8b1:304e:58a3 with SMTP id t1-20020a1709066bc100b008b1304e58a3mr19937907ejs.52.1678277746117; Wed, 08 Mar 2023 04:15:46 -0800 (PST) X-Google-Smtp-Source: AK7set9FHT8cAkr8QazgPlNYE147eWmfy6dy7k8/GEwV2pWQBZ3SLY4qjxTo45TCTeqL9WqyRw70BQ== X-Received: by 2002:a17:906:6bc1:b0:8b1:304e:58a3 with SMTP id t1-20020a1709066bc100b008b1304e58a3mr19937885ejs.52.1678277745770; Wed, 08 Mar 2023 04:15:45 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id d17-20020a50f691000000b004c0cc79f4aesm8059989edn.92.2023.03.08.04.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 04:15:45 -0800 (PST) Date: Wed, 8 Mar 2023 07:15:42 -0500 From: "Michael S. Tsirkin" To: Maxime Coquelin Cc: Eugenio Perez Martin , Jason Wang , Cindy Lu , Stefano Garzarella , qemu-level , Laurent Vivier , Juan Quintela Subject: Re: Emulating device configuration / max_virtqueue_pairs in vhost-vdpa and vhost-user Message-ID: <20230308071529-mutt-send-email-mst@kernel.org> References: <6684066f-452d-a8b3-58b2-b0db2a3c2015@redhat.com> <20230201061709-mutt-send-email-mst@kernel.org> <6e98c7a2-bab8-e91f-1718-cc8d5d6e8ddf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6e98c7a2-bab8-e91f-1718-cc8d5d6e8ddf@redhat.com> Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Wed, Mar 08, 2023 at 11:33:45AM +0100, Maxime Coquelin wrote: > Hello Michael, > > On 2/1/23 12:20, Michael S. Tsirkin wrote: > > On Wed, Feb 01, 2023 at 12:14:18PM +0100, Maxime Coquelin wrote: > > > Thanks Eugenio for working on this. > > > > > > On 1/31/23 20:10, Eugenio Perez Martin wrote: > > > > Hi, > > > > > > > > The current approach of offering an emulated CVQ to the guest and map > > > > the commands to vhost-user is not scaling well: > > > > * Some devices already offer it, so the transformation is redundant. > > > > * There is no support for commands with variable length (RSS?) > > > > > > > > We can solve both of them by offering it through vhost-user the same > > > > way as vhost-vdpa do. With this approach qemu needs to track the > > > > commands, for similar reasons as vhost-vdpa: qemu needs to track the > > > > device status for live migration. vhost-user should use the same SVQ > > > > code for this, so we avoid duplications. > > > > > > > > One of the challenges here is to know what virtqueue to shadow / > > > > isolate. The vhost-user device may not have the same queues as the > > > > device frontend: > > > > * The first depends on the actual vhost-user device, and qemu fetches > > > > it with VHOST_USER_GET_QUEUE_NUM at the moment. > > > > * The qemu device frontend's is set by netdev queues= cmdline parameter in qemu > > > > > > > > For the device, the CVQ is the last one it offers, but for the guest > > > > it is the last one offered in config space. > > > > > > > > To create a new vhost-user command to decrease that maximum number of > > > > queues may be an option. But we can do it without adding more > > > > commands, remapping the CVQ index at virtqueue setup. I think it > > > > should be doable using (struct vhost_dev).vq_index and maybe a few > > > > adjustments here and there. > > > > > > > > Thoughts? > > > > > > I am fine with both proposals. > > > I think index remapping will require a bit more rework in the DPDK > > > Vhost-user library, but nothing insurmountable. > > > > > > I am currently working on a PoC adding support for VDUSE in the DPDK > > > Vhost library, and recently added control queue support. We can reuse it > > > if we want to prototype your proposal. > > > > > > Maxime > > > > > > > Thanks! > > > > > > > > > > technically backend knows how many vqs are there, last one is cvq... > > not sure we need full blown remapping ... > > > > Before VHOST_USER_PROTOCOL_F_STATUS was supported by qemu (very > recently, v7.2.0), we had no way for the backend to be sure the > frontend won't configure new queue pairs, this not not defined in the > spec AFAICT [0]. In DPDK Vhost library, we notify the application it can > start to use the device once the first queue pair is setup and enabled, > then we notify the application when new queues are ready to be > processed. In this case, I think we cannot deduce whether the queue is a > data or a control queue when it is setup. > > When VHOST_USER_PROTOCOL_F_STATUS is supported, we know no more queues > will be configured once the DRIVER_OK status is set. In this case, we > can deduce the last queue setup will be the control queue at DRIVER_OK > time if the number of queues is odd. > > Using index remapping, we would know directly at queue setup time > whether this is a data or control queue based on its index value, > i.e. if the index equals to max queue index supported by the backend. > But thinking at it again, we may at least back this with a protocol > feature to avoid issues with legacy backends. > > I hope it clarifies, let me know if anything unclear. > > Thanks, > Maxime > > [0]: > https://elixir.bootlin.com/qemu/latest/source/docs/interop/vhost-user.rst OK maybe document this. -- MST