Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1189020rdh; Fri, 27 Oct 2023 07:12:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFq3KfwcR83uUkDuzPpkophHH8xSoHn+9y5thd2Yf6QchQqipgaiNxjaDtsLy99WVUiW/BC X-Received: by 2002:a25:b305:0:b0:d9a:3f42:d89f with SMTP id l5-20020a25b305000000b00d9a3f42d89fmr2480074ybj.59.1698415926356; Fri, 27 Oct 2023 07:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698415926; cv=none; d=google.com; s=arc-20160816; b=XU0z/kGVRaJZwbXJEtMSc2DdsOCqLqBBi07Cf0WOcBsRvYzRJkbN80k2aY1qON/SyJ FSgLlso+n+TjIdF6WTcrDgwBNFRTS16n2u3ctpFMuFc1d+LgIfwgYnL/8t74nfPGK9RX ZECp4Gco8AB7wNIGL5ICcEr+fB7W8556ezfGra3S8DfQf4erKjj/KjmONwtnDo1jIB0i AYxZABvwWQwTcPHJ6ocnQ/6SR1bp/fIg/KFEn6BmUM1vx5PhM2sgKrGZh6m1+tPUw2uk lWS7SsuM+w0kOxnEsCse69ty4pIwIyY7OS9zaK5hzCAMwZyiDKaXBR6AQ2PdmCIyfRZS nouA== 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=dRdYkYxdau6CHgpGFJcrqTFnU1sI1stdpBHA/cH/+NM=; fh=irFTy/LqpUhHpDQQ7J9j5ncUJ7haFO6cTPEl6vohzxk=; b=PpXSR63ecg5xMeQpqIEYRguUZ2mFqzW48xizzFdJiT6HOcIs2/kkrieIReuqBqKxLT ce0pu9GhJN/FzN19R9TaPYGb3CkWbjAstzhzyVWzmGE2MDO1evQMJ+N7JIJCcSDCMDgY k9+crcsX7z8RenFqf6GDoSpTrmjB2sb7gHYh98TaIlhkikqvj/17ikFfeQaRKQeyNk+P H+pm+yVJf8fcSO1J+OyvgGqjiHH8aKqHydTM/vsOQwddng27ruqSaM7rtUI4Y+R7xHYI LnnMOgFgIy90JFWl6mZAeCgXbdlXcNnCB4vSTE4/s16qsxYMhm30gYLqakpSKbJhtl2H 7RgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YmTis0aB; 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 e22-20020a25e716000000b00da08c840871si2510054ybh.544.2023.10.27.07.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 07:12:06 -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=YmTis0aB; 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 0E18283845C4; Fri, 27 Oct 2023 07:11:44 -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 S1345997AbjJ0OLb (ORCPT + 99 others); Fri, 27 Oct 2023 10:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345517AbjJ0OLa (ORCPT ); Fri, 27 Oct 2023 10:11:30 -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 CB9CFC0 for ; Fri, 27 Oct 2023 07:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698415841; 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=dRdYkYxdau6CHgpGFJcrqTFnU1sI1stdpBHA/cH/+NM=; b=YmTis0aB/SStviEMk7d58pGaI2uuqac2rO1XmPu5kxuR/k3N5j/IuKUyS/jdnTVZ9RVd7N GirI0kIMCON3hV2OSZDbbz8leMZkW1Kwn1CtJxNEyILlZmHduS02YfKQmSv8awHlHW1kul u5umDkxkjPsyT9GVeiriPu4DcDWZ0KI= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-492-E_3SK5IaPtWhyecp-9vVSQ-1; Fri, 27 Oct 2023 10:10:37 -0400 X-MC-Unique: E_3SK5IaPtWhyecp-9vVSQ-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9c7558b89ccso141651266b.3 for ; Fri, 27 Oct 2023 07:10:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698415837; x=1699020637; 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=dRdYkYxdau6CHgpGFJcrqTFnU1sI1stdpBHA/cH/+NM=; b=cFHcQql86PRxpb+piUFe9AQQK3ZIk5KYsbmN321Nm7UlLVxoaiEERXKNytafHYvVp5 p9pkgDfxCWKbVFcSGNtyhDWW4/TBZ8zTasK/Rj9He2mdaEdveFmGEKiSbESHqScj3Wnq nhd3NczbtHiuE95kMZr5CTNXILgrBWp2Tv3VWyWcyewvRd6nL52xqRvc66EjfA1bWiah b4/pA4LORt/tp9yPZ89qfgBCZ6r/PgdpVXDZP0kyZriefAP2JONp++ad0pgGITKtup39 P1qy26Z/+TAqOAQuotIq/mrrp+h9U/b5P/0Bif5DFgAmFV0zh9S/Qp8AxlS7ETHkq1mY FG8A== X-Gm-Message-State: AOJu0Yye2l+rWqG8NHp8PU9pglTMbwdvD0UTatAF8J+h8w2otILdu1Hr RGQ4Y6dlAOSjX0LAd46/uRi3W9paITVhNsG0ToSOwZzZIFN3O8s/eafZ4ew5hlNdqxzz+7HMT9v oOUtq0FZG+KOS4tsjQNUXcUzL X-Received: by 2002:a17:907:26c4:b0:9b9:f980:8810 with SMTP id bp4-20020a17090726c400b009b9f9808810mr2403288ejc.34.1698415836781; Fri, 27 Oct 2023 07:10:36 -0700 (PDT) X-Received: by 2002:a17:907:26c4:b0:9b9:f980:8810 with SMTP id bp4-20020a17090726c400b009b9f9808810mr2403261ejc.34.1698415836321; Fri, 27 Oct 2023 07:10:36 -0700 (PDT) Received: from redhat.com ([2a02:14f:173:52a8:fc3f:6e84:948f:e841]) by smtp.gmail.com with ESMTPSA id cf17-20020a170906b2d100b00997d7aa59fasm1275905ejb.14.2023.10.27.07.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 07:10:35 -0700 (PDT) Date: Fri, 27 Oct 2023 10:10:30 -0400 From: "Michael S. Tsirkin" To: Stefano Garzarella 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: <20231027100703-mutt-send-email-mst@kernel.org> References: <87cyx0xvn7.wl-tiwai@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 07:11:44 -0700 (PDT) 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 -- MST