Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp374599rdb; Tue, 31 Oct 2023 09:47:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYf5jJ8RjUdpkPscaxsWmLzeGSfT9YT8eBS8RbFrznvbEFT2ENDj0le4rCNUHHF6WMsXpp X-Received: by 2002:a17:90a:31c2:b0:280:11e2:12d6 with SMTP id j2-20020a17090a31c200b0028011e212d6mr8555188pjf.45.1698770863692; Tue, 31 Oct 2023 09:47:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698770863; cv=none; d=google.com; s=arc-20160816; b=hzrwhf2UNG1tmv15MjkxoFC53xrq/SRJj9D7TOOPanE7Bm6YqTQO+mGq8Ra24fExUP /CtJMm2KXZQmG/Td5+n44Mg7i076HvkGPHH1yalEaA3Gn08z2L5lCsmp7iV92NCJj4wO sRRV7mROTVifrOvuyqRdpgX4u6cpnMAjMlfxH7/OboeCbYnMC6RNAP2ZLGPjldzY8QZj YUPMrm6XD6RelofWx3GeUrjWmdRJUajLg7fkPD5RfmON9dQvTU17VG09+Rb2rH3zdruK E3DFMH1ln49UU+v8/PtsFc+V1eDm+KeepnWLA72h6C0SAnzDVbsWvNUHfHbh+xV4itZR ytdQ== 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=V8RNrz/Yva6AAXDhSbIVEu5DSJqLVVmt8DdeJIQrB/I=; fh=C6Ey5ojm8atD7brROMGwviUix6+jumipPhcvNo3vHVk=; b=O8nG989hKSKhyz0+AtPvyntS8lUnO1/M4GAVxfzhLD5OxGWZF3scdXnxfFkCTtvOmb tWG8DkD9Ny0nWqARejIOajvkuKmUsc+l8cKFHWo/WMljh1dNUkHIAOL+KfqZ39EsMHy0 5jX7hC1Y91QCnE4cMf5pZBljwiXLrVkKCZTYk0j5KyQ09TC9RrG9ya3nZ0I8Egq1g4Ka +lhDILqUtMZIR8pvIM700CCkvVwrChVBqx4XvAeRTqyiYVBg6kTujk0fsQD+5E+PTC38 C9EdsMJhAkvyZqcrW/zff+y+0TLfD5Nc5RFNBFVEBcvzDQNY0lJZIaYSwYqQHAUFA30Z p62g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XFB3/td4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id om9-20020a17090b3a8900b0027408bd8420si1178612pjb.13.2023.10.31.09.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:47:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="XFB3/td4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 36645802D3F2; Tue, 31 Oct 2023 09:47:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236366AbjJaQrY (ORCPT + 99 others); Tue, 31 Oct 2023 12:47:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236496AbjJaQrK (ORCPT ); Tue, 31 Oct 2023 12:47:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D97F6468E for ; Tue, 31 Oct 2023 09:35:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698770155; 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=V8RNrz/Yva6AAXDhSbIVEu5DSJqLVVmt8DdeJIQrB/I=; b=XFB3/td4WwpQoWVwASiSjV59GEmSjL7c16qDtQTPEgg5GelEzqG33f1pShScgvi2KH67w4 kzcfKMiaQ6zS/iLOn9tJNHPX/YNOcOQWlXBCJsilkHlCkjEvDhg02poRpL6YyRFLpOE1mi Be1z0z+OnnkEt3eCMpjD3EoUeo/Im2M= 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-68-czRgGzCpO267_XlNWsZOZQ-1; Tue, 31 Oct 2023 12:35:49 -0400 X-MC-Unique: czRgGzCpO267_XlNWsZOZQ-1 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-542fe446d45so2156160a12.0 for ; Tue, 31 Oct 2023 09:35:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698770148; x=1699374948; 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=V8RNrz/Yva6AAXDhSbIVEu5DSJqLVVmt8DdeJIQrB/I=; b=IZVbKMAwxc+MGW6vyg0GPzGuEpelJ18Ys6F65rXlDQ+dBVfYcsaJC+sGSML/o5hkbA rG3USq7kD2becUNU3O5T1O+Emp4Erl6vzE4VXuT1KvEjvjBIHWrYx23Ul8sNgqYWhx6i SWcI7IxR8ZZNQDWyxzRc6M4zn39/1X79dSPHo2VJkNVrwvKEvmZekovYf21V+J2hNggy sIu4PsEOyL2ZAMcpijV172H3H9idojyXNLSPIk61CJr2nwK+dfqtv4+5/tKVpiUFqlFt TN7HQk+ovBcwnllyoeF72O6oUfkfUSrls+9ezoZWBaysY2cwjilPnjAmdB8Sap7OOQKs HGYw== X-Gm-Message-State: AOJu0YzP6hojbWEnEo3KQbueTugLpq5ttrYscVc7keu6UwKNxFBEGfza EXb6NjpcEP6YTMqkX7l1Fns371PZ/rDPSYRy1nNUq27+bi1AGEzFj+TRA5vuriLEy2UrNwh/5gb HBO8L11A3+r81GxS3o5wO/Wr4 X-Received: by 2002:a05:6402:221a:b0:53e:3d9f:3c72 with SMTP id cq26-20020a056402221a00b0053e3d9f3c72mr10202179edb.18.1698770148015; Tue, 31 Oct 2023 09:35:48 -0700 (PDT) X-Received: by 2002:a05:6402:221a:b0:53e:3d9f:3c72 with SMTP id cq26-20020a056402221a00b0053e3d9f3c72mr10202159edb.18.1698770147712; Tue, 31 Oct 2023 09:35:47 -0700 (PDT) Received: from sgarzare-redhat ([5.179.178.82]) by smtp.gmail.com with ESMTPSA id z7-20020a50cd07000000b0053e5a1bf77dsm1412398edi.88.2023.10.31.09.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:35:47 -0700 (PDT) Date: Tue, 31 Oct 2023 17:35:42 +0100 From: Stefano Garzarella To: "Michael S. Tsirkin" Cc: Takashi Iwai , Matias Ezequiel Vara Larsen , anton.yakovlev@opensynergy.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: <7agwvbpra7ywyeghawq6xs4l2rxyksyyarborezzndb73wfd6t@bxtb2n4dsrfa> References: <87cyx0xvn7.wl-tiwai@suse.de> <20231027100703-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20231027100703-mutt-send-email-mst@kernel.org> X-Spam-Status: No, score=-1.3 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:47:40 -0700 (PDT) On Fri, Oct 27, 2023 at 10:10:30AM -0400, Michael S. Tsirkin wrote: >On Fri, Oct 27, 2023 at 12:18:00PM +0200, Stefano Garzarella wrote: >> 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 > > >Acked-by: Michael S. Tsirkin >Fixes: de3a9980d8c3 ("ALSA: virtio: add virtio sound driver") > > >The patch is too big for stable - more than 100 lines added. See: >Documentation/process/stable-kernel-rules.rst Yeah, I see, thanks for sharing! Stefano