From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD66AC433F5 for ; Mon, 30 May 2022 11:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235584AbiE3LIE (ORCPT ); Mon, 30 May 2022 07:08:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235466AbiE3LH6 (ORCPT ); Mon, 30 May 2022 07:07:58 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 713016D194 for ; Mon, 30 May 2022 04:07:57 -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 311FE21B3A; Mon, 30 May 2022 11:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1653908876; 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=p0MKv9MLeereOpdqp4/ju4WfXJfIR9HPdAiJse/OPeU=; b=pJjRJdr08h1S9f955jW068pEFv3RTUqlwfYZLqDC3hACmeWr3MliwdbgAGxZsBJMQfRSJh 2qo/Lxd4xZsUwg24ZSi8cGGciBTgeBAmhn36sxeTVrfwFaTKjaeBQjbeZ3VLo0vLoUK+VJ JioQlDEC2JXfXYMhLzZDgmRCwB+hJhg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1653908876; 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=p0MKv9MLeereOpdqp4/ju4WfXJfIR9HPdAiJse/OPeU=; b=xV2Nux3WDIJaiuvAgWNYozyQyEOPOFxaVsOFqn0WS4uS99hWx1Ra48XUlmETIPqn7RQg+R zAs1v3wTUHo1q6DQ== 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 F349413AFD; Mon, 30 May 2022 11:07:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +k16OoullGIyZwAAMHmgww (envelope-from ); Mon, 30 May 2022 11:07:55 +0000 Date: Mon, 30 May 2022 13:07:55 +0200 Message-ID: <87wne3wa5w.wl-tiwai@suse.de> From: Takashi Iwai To: Charles Keepax Cc: Vitaly Rodionov , Jaroslav Kysela , Takashi Iwai , Mark Brown , , , Subject: Re: [PATCH v4 00/17] ALSA: hda: cirrus: Add initial DSP support and firmware loading In-Reply-To: <20220530105329.GV38351@ediswmail.ad.cirrus.com> References: <20220525131638.5512-1-vitalyr@opensource.cirrus.com> <871qwf0x8t.wl-tiwai@suse.de> <20220530090846.GS38351@ediswmail.ad.cirrus.com> <87czfvxtsc.wl-tiwai@suse.de> <20220530093639.GT38351@ediswmail.ad.cirrus.com> <87a6azxr7h.wl-tiwai@suse.de> <20220530103415.GU38351@ediswmail.ad.cirrus.com> <871qwbxpsb.wl-tiwai@suse.de> <20220530105329.GV38351@ediswmail.ad.cirrus.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 30 May 2022 12:53:29 +0200, Charles Keepax wrote: > > On Mon, May 30, 2022 at 12:45:08PM +0200, Takashi Iwai wrote: > > On Mon, 30 May 2022 12:34:15 +0200, > > Charles Keepax wrote: > > Well, if an ALSA control can trigger the firmware loading, that's > > already fragile. A firmware loading is a heavy task, which should > > happen only at probing and/or resuming in general. Do we have other > > drivers doing the f/w loading triggered by a kctl...? > > > > > I guess we could look at adding locked versions of the add > > > control functions as well if that might be preferred? > > > > If the patterns of additional kctls (specific for firmware?) are > > fixed, we may create all such kctls beforehand and let them inactive > > unless the corresponding firmware is really loaded, too. > > > > I am afraid we do, basically all the Wolfson/Cirrus audio devices > allow you to select the firmware through a kctl. The patterns of > controls are specific to the firmwares, so we can't really create > them ahead of time. One could maybe look at changing when the > firmwares are loaded, such as attempting to load all possible > firmwares on boot or something but its a fairly sizable change > that isn't without some side effects. The call of request_firmawre() itself can be pretty lengthy (e.g. it may hold until user-space process uploads the firmware if the fallback mode is enabled), and it implies that the request_firmware() call doesn't fit well as the operation to be done in a kctl put callback. So, even if we accept the firmware loading behavior via kctl as-is, the whole procedure should be async in work instead; namely, not only kctl creation/deletion but both request_firmware() + post-process should be done in the work. And yet moreover, we'll need to consider some way for protecting against DoS-like behavior by frequent kctl changes. thanks, Takashi