Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp572349rwd; Sun, 14 May 2023 02:24:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5hB8yjmkRQJoyUXZvIFoPvgERLSITc3lF0iYuBM4XqBxl4FQucqez4tMBXupCnqOXxO8Xs X-Received: by 2002:a05:6a20:a122:b0:103:ef39:a832 with SMTP id q34-20020a056a20a12200b00103ef39a832mr14481451pzk.23.1684056257751; Sun, 14 May 2023 02:24:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684056257; cv=none; d=google.com; s=arc-20160816; b=g+zjlNMam9kjiDwwgQRIMxmS30H+aiHpME8z0ZO9NWt7DvPaY7wvHkNurSEYXVn0Ym GNBjGq3qnYmkJ4+EnUa0ao9lR60jDtpcRmWYkLFZps6Dl/zJYKApMoO/zyfjvIneypRC Jky6x3je+ZRNe+jnkwU51ZK8yAwWr8fIg3KFcNbpa13Us6l75JhmFj7DFsOXHrjTT8/l 9RF/qUqrS7K8ioNYmvQUvZsAYST5qktpCA4849umnZOYWiQ97MNHoetL/Eiw9g0IHFMk UreKvBmW0/r4fuKu4e6pnBYx1e6eqnwU4mEHGV26Wlfn5QwuDRFsiOxrGIHMiRgfpIdn ZPOA== 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=YbTG3QHxp4xkrUDBC3uMLRB5y/TSfnVZ4mREVa2fxCE=; b=LU5rQdiojxdzHzT4A+o38dn/Tczgf6c/83gvP91B9vx8INuU4Jw2TKoBphhDPP4n57 RgaRz4p5HjlRCQnP7y+s2BHC5PrJ+9LNpcNAK6h7PRSRsKRfzhqvRe1gaHMxOXC4Ti3k XTLDjf0/MvcABixnCRVp6fucvLwoPniz2XClkrrhzsG3HsUjV8WWSf3X0SqMeqgc1iN1 dXNd427ctk1XcLgqmX220qm9+Xl6VmkVkHgL8v8B063I/kgyHplch+3ZQC2HVhGiiqbI zJHtsiSm+XruFHYd72IDxD0qbksKEgMt+JhELLiyn1frqAi/KlSAaukoKDUMsQ/Cf2ZB QkAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YYzOgtkI; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=SUM2jczq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a63af52000000b00530b3b5ec09si3283460pgo.225.2023.05.14.02.24.03; Sun, 14 May 2023 02:24:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=YYzOgtkI; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=SUM2jczq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbjENJSZ (ORCPT + 99 others); Sun, 14 May 2023 05:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbjENJSY (ORCPT ); Sun, 14 May 2023 05:18:24 -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 54458A0; Sun, 14 May 2023 02:18:23 -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 9297D21FF0; Sun, 14 May 2023 09:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684055901; 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=YbTG3QHxp4xkrUDBC3uMLRB5y/TSfnVZ4mREVa2fxCE=; b=YYzOgtkIKMTo5ApVh3WkkM+zMdRBiHBYGIEQHqaspfVEWEuuJxHfHDRYelInR7fW3ujizU hWBBTFGjbvE6kRCdpsFGU6m2V+IEjJvi56IKO7NyCL5FVwdEsUQpcSNMCLOEBWm/oCGYh8 xBYsbKQv9Jtq92G+ahsmj0KKO/XE4RY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684055901; 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=YbTG3QHxp4xkrUDBC3uMLRB5y/TSfnVZ4mREVa2fxCE=; b=SUM2jczqVqNtlR26shiac1QIfpQGMBoUdxPlIfI+gXnnxU1iHIBbsLc5qryuKg6PQ51cLi vS/KJrldFTlDp4CA== 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 41991138F5; Sun, 14 May 2023 09:18:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8IUQD12nYGTNTwAAMHmgww (envelope-from ); Sun, 14 May 2023 09:18:21 +0000 Date: Sun, 14 May 2023 11:18:20 +0200 Message-ID: <878rdr8e5f.wl-tiwai@suse.de> From: Takashi Iwai To: Ivan Orlov Cc: corbet@lwn.net, akpm@linux-foundation.org, perex@perex.cz, tiwai@suse.com, broonie@kernel.org, skhan@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org, gregkh@linuxfoundation.org, himadrispandya@gmail.com, linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [PATCH 2/3] ALSA: Implement the new virtual driver In-Reply-To: <20230513202037.158777-2-ivan.orlov0322@gmail.com> References: <20230513202037.158777-1-ivan.orlov0322@gmail.com> <20230513202037.158777-2-ivan.orlov0322@gmail.com> 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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 13 May 2023 22:20:36 +0200, Ivan Orlov wrote: > > We have a lot of different virtual media drivers, which can be used for > testing of the userspace applications and media subsystem middle layer. > However, all of them are aimed at testing the video functionality and > simulating the video devices. For audio devices we have only snd-dummy > module, which is good in simulating the correct behavior of an ALSA device. > I decided to write a tool, which would help to test the userspace ALSA > programs (and the PCM middle layer as well) under unusual circumstances > to figure out how they would behave. So I came up with this Virtual ALSA > Driver. > > This new Virtual ALSA Driver has several features which can be useful > during the userspace ALSA applications testing/fuzzing, or testing/fuzzing > of the PCM middle layer. Not all of them can be implemented using the > existing virtual drivers (like dummy or loopback). Here is what can this > driver do: > > - Simulate both capture and playback processes > - Generate random or pattern-based capture data > - Inject delays into the playback and capturing processes > - Inject errors during the PCM callbacks > > Also, this driver can check the playback stream for containing the > predefined pattern, which is used in the corresponding selftest to check > the PCM middle layer data transferring functionality. Additionally, this > driver redefines the default RESET ioctl, and the selftest covers this PCM > API functionality as well. > > Pattern-based capture stream data generation works in the following way: > user can set the pattern by writing to the 'fill_pattern' debugfs file. > After that, the capture stream in case of reading will be filled with this > pattern (for example, if the pattern is 'abc', the capture stream will > contain 'abcabcabc...'). The pattern itself can be up to 4096 bytes long. > > After all, I think this driver would be a good start, and I believe in the > future we will see more virtual sound drivers. > > Signed-off-by: Ivan Orlov The idea is interesting, and it's a definitely good thing to have. I wonder, though, whether it could be better provided as an extention to the existing snd-dummy driver. The advantage of extending snd-dummy driver would be that it already supports different formats, etc. OTOH, if we create an individual driver, the pro side is the simpleness of the code. I'm inclined to go with a separate driver, but I'm open about this. Maybe Jaroslav and Mark have some opinions? About this patch set: the driver name should be a bit more specific, as this isn't a generic virtual driver that is used for general purpose but it's only for testing. And it's only for testing PCM. So, a name like snd-test-pcm would be more appropriate, IMO. And, we want the coverage of different formats, channels, rates and accesses (interleaved vs non-interleaved). How can we extend somehow more for that? thanks, Takashi