Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1024431rdh; Fri, 27 Oct 2023 02:28:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoP+sgAGBZT+B1SLg7Hme6H1vpfrNbeB63D106krtPv9lzKpqxFyKeOieRo4os+nPpYY3g X-Received: by 2002:a81:4149:0:b0:5a7:dad3:cd21 with SMTP id f9-20020a814149000000b005a7dad3cd21mr3447165ywk.10.1698398882203; Fri, 27 Oct 2023 02:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698398882; cv=none; d=google.com; s=arc-20160816; b=tr4Y++4Cr8jAX3xHP0lcnWMcrWtaoTC7Yd3iqAVN9UWoO7027D1NXQRWghNNzK9lmp UYKafJRH6gOcCQr5pEqCYPcTBpGNv9JKt0v3MKXx45e/o3aQOXaOIYI2JyZeK//Cr4IM GVgSXlWz+4+3X/I1z2gnnm7lPyWwTkO2x1HWUQrMOcF413QROUOqDiYvFCU90Euk90dL iQrKhvPOA2YMUBkhVrf+YtVcgSBWvxMQtq33Z7J5qi/Pg3fCf2xI5uRwkkuZdoVsgiKo KV7OExN6B97glLCBSk/tOe+WK9FtUkZ4FcPKvQhaioY5JFUZjmECvDqDmjdPoG9GgTUD QwfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=8l7XG7IF12qPA22idso0jBKs3a39vbEIsjf6aRpnkMY=; fh=4Cf43DImL3olS4/DRydcrQ5ZRc5sdN/BZkZZoiyvjw4=; b=QHxECii+0n6AWrkjpXtnsGTBDBVG0W5zSOwXfHKXjZeznIvcuRfa3UZt5zPEsa9ZSk g1F/de0CSKDIhAcOzgCHyWhziv55WY0gJzDm3a72tv36LxKY175WLmkyNQjVtGwHEWRo +Qx2mL6d8w5dk/8e6e+vp08J2CNluDroeuMDGMq9GqEYgI1FXmEaa6cACbVN5eLquQTw w1lA0Rzql+mrRxbjLQyQTywZr3clbl1M+ZOw3VoKftYpsUJMD3RsBdbKNnE+i58LTIJH tUuoXRI7MjrPyBnoZc+444zbJJqxCj6q4Uzgc+GAD8qKnyMnWhqr/pCTq9o/R/kVtEAh Z53Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=o1A8E+Hq; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id z14-20020a81c20e000000b005a8a753979esi1832243ywc.245.2023.10.27.02.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 02:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=o1A8E+Hq; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3B45580290CA; Fri, 27 Oct 2023 02:27:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235036AbjJ0J1r (ORCPT + 99 others); Fri, 27 Oct 2023 05:27:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231340AbjJ0J1q (ORCPT ); Fri, 27 Oct 2023 05:27:46 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84798E5 for ; Fri, 27 Oct 2023 02:27:43 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id CAA1221ADB; Fri, 27 Oct 2023 09:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698398861; h=from:from:reply-to: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=8l7XG7IF12qPA22idso0jBKs3a39vbEIsjf6aRpnkMY=; b=o1A8E+HqwlRvZgV+HwDfH2+HqOVy45ei2Y5WhszxYL7izbS03WJ8qX90AyFrKIocFRgCVi pTg0/cY//3opUEaOeN6RUZ6gA54qg0zP9pSPXluoXEL+KZ8eWyeVKYE91XClnu2MRp05z4 df9MhQwCsOxlvxM1djZwKtmAsRA3i74= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698398861; h=from:from:reply-to: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=8l7XG7IF12qPA22idso0jBKs3a39vbEIsjf6aRpnkMY=; b=fOEri0M0V0LzxpQaqG9VFRUqqQTYpNL+AHoTxol/xf1ys3mGuhxe2OX+gDJ2f1CQgge5Nc OFyMpt92hcemcMAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6D89C13524; Fri, 27 Oct 2023 09:27:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id xL9/GI2CO2UhWwAAMHmgww (envelope-from ); Fri, 27 Oct 2023 09:27:41 +0000 Date: Fri, 27 Oct 2023 11:27:40 +0200 Message-ID: <87cyx0xvn7.wl-tiwai@suse.de> From: Takashi Iwai To: Matias Ezequiel Vara Larsen Cc: 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, sgarzare@redhat.com, manos.pitsidianakis@linaro.org, mripard@redhat.com Subject: Re: [PATCH v4] ALSA: virtio: use ack callback In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -10.10 X-Spamd-Result: default: False [-10.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWELVE(0.00)[13]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Status: No, score=-0.8 required=5.0 tests=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 groat.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 (groat.vger.email [0.0.0.0]); Fri, 27 Oct 2023 02:27:59 -0700 (PDT) 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. thanks, Takashi