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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12744C64EC4 for ; Thu, 9 Mar 2023 10:52:42 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0DE15189E; Thu, 9 Mar 2023 11:51:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0DE15189E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1678359160; bh=GbGQ/fwDNvN+/pu6HYvqj949amyLq1PdWpXxkRORvhE=; h=Date:From:To:Subject:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=H0lnHmm+AnqPxwL2ImBwsAYvMB2omyHlRfISc/Vlk0r5NCifHCxdKR6WJjyqcgOwG i+7S8j+zUFMqh0RQ6ZeAXeUQYLYwPpFAYRUzjSEThegnUpleQ3ppIUiX4rWAU6GfCA kv24oK7mH4RE6lhUhjnglnR4TaOXI4+M8PJ5xXkg= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 5B4F9F8042F; Thu, 9 Mar 2023 11:51:27 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E38D4F8042F; Thu, 9 Mar 2023 11:51:23 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CED17F8007E for ; Thu, 9 Mar 2023 11:51:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CED17F8007E Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=s6TuZFD4; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=OROPJXhr 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-out2.suse.de (Postfix) with ESMTPS id F030320039; Thu, 9 Mar 2023 10:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1678359079; 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=5z2z1TJRrdW4HC7J8YkWQ4B4sI+z+nwQyG06Gl2UpNU=; b=s6TuZFD4hUUzMvLOY0n/a3FbGguBQZrA9xzMLNkZYyabhbTdgD1fHao1uVahkZ2m3AEaxa e28LW86HNtiQooegxTnT/GnfyBNlJaGuG7WE5DghorZP68g1lCBU+8iWIgJhYMbOGju+fA DivY3jFcnlwgEBSQkVpPASiEmsiNDoQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1678359079; 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=5z2z1TJRrdW4HC7J8YkWQ4B4sI+z+nwQyG06Gl2UpNU=; b=OROPJXhr44+iv79vzrIuVXGiS4nuc4IpTbFyPLtrCFNleZh2uKWD8Qqu71+tucY98rhZL9 f/S1VATGqy0pkIBw== 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 930E313A10; Thu, 9 Mar 2023 10:51:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id dhekIia6CWR9OwAAMHmgww (envelope-from ); Thu, 09 Mar 2023 10:51:18 +0000 Date: Thu, 09 Mar 2023 11:51:18 +0100 Message-ID: <87356egpuh.wl-tiwai@suse.de> From: Takashi Iwai To: Wesley Cheng Subject: Re: [PATCH v3 01/28] xhci: Add support to allocate several interrupters In-Reply-To: <20230308235751.495-2-quic_wcheng@quicinc.com> References: <20230308235751.495-1-quic_wcheng@quicinc.com> <20230308235751.495-2-quic_wcheng@quicinc.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 Message-ID-Hash: XVJTQWZHCHKI2SK6YISN7RDX7ZK7UPUA X-Message-ID-Hash: XVJTQWZHCHKI2SK6YISN7RDX7ZK7UPUA X-MailFrom: tiwai@suse.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: srinivas.kandagatla@linaro.org, mathias.nyman@intel.com, broonie@kernel.org, lgirdwood@gmail.com, krzysztof.kozlowski+dt@linaro.org, agross@kernel.org, Thinh.Nguyen@synopsys.com, bgoswami@quicinc.com, andersson@kernel.org, robh+dt@kernel.org, gregkh@linuxfoundation.org, tiwai@suse.com, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, quic_jackp@quicinc.com, quic_plai@quicinc.com, Mathias Nyman X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 09 Mar 2023 00:57:24 +0100, Wesley Cheng wrote: > +struct xhci_interrupter * > +xhci_create_secondary_interrupter(struct usb_hcd *hcd, int intr_num) > +{ > + struct xhci_hcd *xhci = hcd_to_xhci(hcd); > + struct xhci_interrupter *ir; > + unsigned int i; > + unsigned int idx = 0; > + unsigned long flags; > + > + if (!xhci->interrupters || intr_num > xhci->max_interrupters) > + return NULL; > + > + spin_lock_irqsave(&xhci->lock, flags); .... > + if (idx > 0) { > + ir = xhci_alloc_interrupter(xhci, idx, GFP_KERNEL); > + if (!ir) { > + spin_unlock_irqrestore(&xhci->lock, flags); > + return NULL; > + } > + ir->intr_num = idx; > + xhci->interrupters[idx] = ir; > + spin_unlock_irqrestore(&xhci->lock, flags); You can't use GFP_KERNEL allocation inside the spinlock. Takashi 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 4CC7BC6FD1C for ; Thu, 9 Mar 2023 10:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230143AbjCIKvY (ORCPT ); Thu, 9 Mar 2023 05:51:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbjCIKvW (ORCPT ); Thu, 9 Mar 2023 05:51:22 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7701BE1C8D; Thu, 9 Mar 2023 02:51:20 -0800 (PST) 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-out2.suse.de (Postfix) with ESMTPS id F030320039; Thu, 9 Mar 2023 10:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1678359079; 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=5z2z1TJRrdW4HC7J8YkWQ4B4sI+z+nwQyG06Gl2UpNU=; b=s6TuZFD4hUUzMvLOY0n/a3FbGguBQZrA9xzMLNkZYyabhbTdgD1fHao1uVahkZ2m3AEaxa e28LW86HNtiQooegxTnT/GnfyBNlJaGuG7WE5DghorZP68g1lCBU+8iWIgJhYMbOGju+fA DivY3jFcnlwgEBSQkVpPASiEmsiNDoQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1678359079; 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=5z2z1TJRrdW4HC7J8YkWQ4B4sI+z+nwQyG06Gl2UpNU=; b=OROPJXhr44+iv79vzrIuVXGiS4nuc4IpTbFyPLtrCFNleZh2uKWD8Qqu71+tucY98rhZL9 f/S1VATGqy0pkIBw== 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 930E313A10; Thu, 9 Mar 2023 10:51:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id dhekIia6CWR9OwAAMHmgww (envelope-from ); Thu, 09 Mar 2023 10:51:18 +0000 Date: Thu, 09 Mar 2023 11:51:18 +0100 Message-ID: <87356egpuh.wl-tiwai@suse.de> From: Takashi Iwai To: Wesley Cheng Cc: , , , , , , , , , , , , , , , , , , , , Mathias Nyman Subject: Re: [PATCH v3 01/28] xhci: Add support to allocate several interrupters In-Reply-To: <20230308235751.495-2-quic_wcheng@quicinc.com> References: <20230308235751.495-1-quic_wcheng@quicinc.com> <20230308235751.495-2-quic_wcheng@quicinc.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-arm-msm@vger.kernel.org On Thu, 09 Mar 2023 00:57:24 +0100, Wesley Cheng wrote: > +struct xhci_interrupter * > +xhci_create_secondary_interrupter(struct usb_hcd *hcd, int intr_num) > +{ > + struct xhci_hcd *xhci = hcd_to_xhci(hcd); > + struct xhci_interrupter *ir; > + unsigned int i; > + unsigned int idx = 0; > + unsigned long flags; > + > + if (!xhci->interrupters || intr_num > xhci->max_interrupters) > + return NULL; > + > + spin_lock_irqsave(&xhci->lock, flags); .... > + if (idx > 0) { > + ir = xhci_alloc_interrupter(xhci, idx, GFP_KERNEL); > + if (!ir) { > + spin_unlock_irqrestore(&xhci->lock, flags); > + return NULL; > + } > + ir->intr_num = idx; > + xhci->interrupters[idx] = ir; > + spin_unlock_irqrestore(&xhci->lock, flags); You can't use GFP_KERNEL allocation inside the spinlock. Takashi