Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1048201rdh; Fri, 27 Oct 2023 03:19:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEjmcf98ueAxDQsJynEBVFapHqSn8xVhxvm2C7tIb2Izk1VSAkJDz9p8G81rQaMDU1CciKP X-Received: by 2002:a81:af23:0:b0:595:887f:e180 with SMTP id n35-20020a81af23000000b00595887fe180mr2145135ywh.40.1698401949903; Fri, 27 Oct 2023 03:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698401949; cv=none; d=google.com; s=arc-20160816; b=ZwHY085AgOS6/3yzPpcA4ZvUaSdfUe27uZZVo67UprEhAbZct29vfskclZcutXwFIl ko2AX0RjSAgBQEJ+IK5DunhgqcGYzYsflKqd2VLfGU/R4tYGSakVF5EW77Rf5r9Er4eo yYAZp88KRsG0S1ASJf/bFZCdFzGw61BzBMTVY8mWkS3k2os1CBbHTjOx1DQSYnzi6LE9 6RXGCQUtuDt4iZjphyOwcu4HCHv+qz8aV08I6XMl5c6BbzKKcbaoK4cegSaNdESxY4h8 QQLZi8oZ+bStrE9VCE4zD56Vs5XnEsaWM1xhBVNX33pufrqI+a5dIvh2HeM0F0D+Zm9a kcgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jZY15p4oIEfxgWyNWClalrKHx1YMgCfc6TjxYt8iXs0=; fh=S4zRQ16RZ1HXtMw/L7TAI2PoYR/cicRb0yyx56QIhEk=; b=fy16lp3V1xgHuu5Nd3yzlhx9o0bli16lN38xNr2OktxHms5PDa7fhYbD0BoD2IGOdv UOFwuIjXTm6qiV97wfH5S8DVbI95m5/ptqvAOptroD+blBCE6A7Xjzxe/0/KNACwlphr ADXq/PSQ742hIlOIPyGNHiRkyr96qDHbzseQNV3Z1RM80RMC9e+g0f+9nszOyxr4p5lb /cOfcZa0tp/leI7mfwzQPSPaE4jmSDtNIZyffstTUAALX6KT+0sbYMqFUxqzJ6a31up5 NG+Ur3bfGB9IbkdznwSWDHbMrNHeISZbQJnhwfNVeAlW7KbPv842sCbo4ZETDrGy886o rt6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S6gDp5uC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id i18-20020a81d512000000b005ae9ed6746dsi1963941ywj.486.2023.10.27.03.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 03:19:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S6gDp5uC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 257D38378495; Fri, 27 Oct 2023 03:19:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345595AbjJ0KS5 (ORCPT + 99 others); Fri, 27 Oct 2023 06:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345717AbjJ0KS4 (ORCPT ); Fri, 27 Oct 2023 06:18:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39457D7 for ; Fri, 27 Oct 2023 03:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698401891; 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=jZY15p4oIEfxgWyNWClalrKHx1YMgCfc6TjxYt8iXs0=; b=S6gDp5uCMmgW5NZHSAi2sWe6lVerJ0ucK7psH/5I02TbJFTQe4QhbcR+CxCfeI6y4M8crd 48ohPMkM0aNrteLq70hSZefOOcfNirZqQmlqtVskP8GpZiWpii4PjMrGGqqS6/zDr9K1QU sDsnoRZe84CFMXpv1b7LiMYaFgQajl4= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-27-Ks1OdDqyPY2FKPZphDFJyA-1; Fri, 27 Oct 2023 06:18:09 -0400 X-MC-Unique: Ks1OdDqyPY2FKPZphDFJyA-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-778b3526240so271533485a.1 for ; Fri, 27 Oct 2023 03:18:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698401889; x=1699006689; 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=jZY15p4oIEfxgWyNWClalrKHx1YMgCfc6TjxYt8iXs0=; b=m7A3C97S7Y5ESP6rMabiu9WdJ0iPbzpXZ6CGRQye63i5DzOlDPW/MFqEb6cWCQfw0q mQjLALzsdiA/SrUc5UFQYGuc9JBVn9ii7C/Ll5X9tW4kuElFb0/qwwUrIIZnrfyXCkRT AJC4ovyOIf9pN8ZmHE6RB5/jj8gSYaAlX6N2O4i/JldrvFeCb488HH7sB0y3fYfCnOd6 N7M7Fxa3LLqsizZwwWMALPZSReErzvrxZjaUqQF0Ncydcjn/9clsOvUBNv1G5Gk1k0+z dtJjOlQjV2f4c4rY7fFL3bqp6OonY47RHjULhVNSbh9OB8E2TDAUAtLzUziDPi6qIcYl A4xw== X-Gm-Message-State: AOJu0YxCTSPs4Yj+y6mJApS2jbpSf+HjB/CdVwz560W8mT5WI94SSOAU tvhjPARQjKEQOiP8F7pvuEbkkQUk9O3Z6XCIOmTU/FaP5aHBe2sPf9sDVYbFOFw53PCvltnsvlb PehrL3fUzZnDXJCpsPbjU2s4+ X-Received: by 2002:a37:c247:0:b0:774:15ad:f34c with SMTP id j7-20020a37c247000000b0077415adf34cmr1906249qkm.70.1698401889182; Fri, 27 Oct 2023 03:18:09 -0700 (PDT) X-Received: by 2002:a37:c247:0:b0:774:15ad:f34c with SMTP id j7-20020a37c247000000b0077415adf34cmr1906237qkm.70.1698401888896; Fri, 27 Oct 2023 03:18:08 -0700 (PDT) Received: from sgarzare-redhat (host-87-12-185-56.business.telecomitalia.it. [87.12.185.56]) by smtp.gmail.com with ESMTPSA id y3-20020a37e303000000b00774830b40d4sm420637qki.47.2023.10.27.03.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 03:18:08 -0700 (PDT) Date: Fri, 27 Oct 2023 12:18:00 +0200 From: Stefano Garzarella To: Takashi Iwai , mst@redhat.com Cc: Matias Ezequiel Vara Larsen , anton.yakovlev@opensynergy.com, mst@redhat.com, perex@perex.cz, tiwai@suse.com, virtualization@lists.linux-foundation.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, stefanha@redhat.com, manos.pitsidianakis@linaro.org, mripard@redhat.com Subject: Re: [PATCH v4] ALSA: virtio: use ack callback Message-ID: References: <87cyx0xvn7.wl-tiwai@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <87cyx0xvn7.wl-tiwai@suse.de> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 27 Oct 2023 03:19:07 -0700 (PDT) On Fri, Oct 27, 2023 at 11:27:40AM +0200, Takashi Iwai wrote: >On Wed, 25 Oct 2023 11:49:19 +0200, >Matias Ezequiel Vara Larsen wrote: >> >> This commit uses the ack() callback to determine when a buffer has been >> updated, then exposes it to guest. >> >> The current mechanism splits a dma buffer into descriptors that are >> exposed to the device. This dma buffer is shared with the user >> application. When the device consumes a buffer, the driver moves the >> request from the used ring to available ring. >> >> The driver exposes the buffer to the device without knowing if the >> content has been updated from the user. The section 2.8.21.1 of the >> virtio spec states that: "The device MAY access the descriptor chains >> the driver created and the memory they refer to immediately". If the >> device picks up buffers from the available ring just after it is >> notified, it happens that the content may be old. >> >> When the ack() callback is invoked, the driver exposes only the buffers >> that have already been updated, i.e., enqueued in the available ring. >> Thus, the device always picks up a buffer that is updated. >> >> For capturing, the driver starts by exposing all the available buffers >> to device. After device updates the content of a buffer, it enqueues it >> in the used ring. It is only after the ack() for capturing is issued >> that the driver re-enqueues the buffer in the available ring. >> >> Co-developed-by: Anton Yakovlev >> Signed-off-by: Anton Yakovlev >> Signed-off-by: Matias Ezequiel Vara Larsen > >Applied now to for-next branch. Cool, thanks for that! I just wonder if we should CC stable since we are fixing a virtio specification violation. @Michael what do you think? Thanks, Stefano