Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp1232099pxb; Fri, 13 Aug 2021 17:47:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2jLx5Mm7FHSJdakS053MGXnkRrQ2I0QKj/bZluxjn8u76Kg4tyuK/oxXPYJvOtbOsTng4 X-Received: by 2002:a05:6e02:1cad:: with SMTP id x13mr3745809ill.188.1628902070474; Fri, 13 Aug 2021 17:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628902070; cv=none; d=google.com; s=arc-20160816; b=JJ5kZ0Pza54ekqdCXmb6LqR4jYSfglusfN0ErL6ttmyMWRYx+zX+UEJwb8Xmq4bDWe 5f9U36bV+40Hpq9b3lPmM/NDXUT+xdBb56yJ0wKNeI15TrsIVSve98sMmhLuJpvNZVAo 93gbcHs6f4+B4t7rxt8CF4fCXgVSRY/ahN/UTogTFMhOZOC9tkOfiwv6YJvTDAfE4P/C A9SidmeVDO+hEpow467D9X5bgGJ1enjiYsGRsLEdWyWA9pwX3UttcJDrgZJkgbytOJZL YKiLiOr8oNc++EMjOToZKbNcWjlTVCqL/BXKNGl5MP/7+VBtmnV8blpiUyd2VxER09K9 S0gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=cDh0gOynvyvdOtOlyCm4vqBTXlYMO98W8Z4IgATK1xk=; b=d0P0f2Hyzx1F1cU4iK75N11Y7EoRvpLKjrTGSlNs0y6FzcS5dOSMHfKgCL+FEmXhaj 7h6Z7QCwdzBZPZ9MkbdHx+UfCQ2UmgXXKpG9PdkotkDSMCPQaUoerk68yestxQWPsTbo GoafzcHkJCit7ABncDza4bVP4GJlIPnXhLa/j6v2IxPgvmAb1CA8o0tmq/+oCluohX0W UHnxJe6DJb66r2JUiDFn/KtwNNh4D+Bq6uVf/wx2aEvW8R25uuHbHgIyqRJcUYaNvpaz myW7wPzgodUh7kKajif3DgJ7r3jHsIZE1zKgI4/7nZ80Hl9ZOdEtjtWa4S1mAKaJSE1r Nf0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jG6eZpNh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si2928298ioj.7.2021.08.13.17.47.38; Fri, 13 Aug 2021 17:47:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jG6eZpNh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235938AbhHNArY (ORCPT + 99 others); Fri, 13 Aug 2021 20:47:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:56102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235870AbhHNArX (ORCPT ); Fri, 13 Aug 2021 20:47:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CC27A60FC3; Sat, 14 Aug 2021 00:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628902016; bh=9UkrQu4UERxCxlPh6JNL/rrhNPf5QAK/8kvdoQ9pYlE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jG6eZpNhqrJNfmqQiiMT3LHqqvP6kL1hYxidkbhSoY3Jk07mNl2osjbyR8Ki0RcZB /ug0nR+uTouXqqxYyV/oBwsMbxCeWj8Ym9jTExK/3c88inrQjbrS4bdn6gwJamD5vz 7v47owpqLzDKfYFH4TbTkV3Rkz3coYfWH0CRVOkhJuSJv/hrYEZMH8/GduPw1c/9it bI7dJ9NCSx8EBPy1hHoLgXdmH+Bp/n9E3EE43uvKRrFpyCJQQOvnoayjjNgq2+Wl30 aAQSdW5//XwImtY4PhoBiHJblNyyZLFdBfKHV7eBY/DD12/2BY5yUVMjKmDvAs+Mxr GjPxxzzvXqsWQ== Date: Fri, 13 Aug 2021 17:46:55 -0700 From: Jakub Kicinski To: Alex Elder Cc: davem@davemloft.net, bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 4/6] net: ipa: ensure hardware has power in ipa_start_xmit() Message-ID: <20210813174655.1d13b524@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20210812195035.2816276-5-elder@linaro.org> References: <20210812195035.2816276-1-elder@linaro.org> <20210812195035.2816276-5-elder@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 12 Aug 2021 14:50:33 -0500 Alex Elder wrote: > + /* The hardware must be powered for us to transmit */ > + dev = &ipa->pdev->dev; > + ret = pm_runtime_get(dev); > + if (ret < 1) { > + /* If a resume won't happen, just drop the packet */ > + if (ret < 0 && ret != -EINPROGRESS) { > + pm_runtime_put_noidle(dev); > + goto err_drop_skb; > + } This is racy, what if the pm work gets scheduled on another CPU and calls wake right here (i.e. before you call netif_stop_queue())? The queue may never get woken up? > + /* No power (yet). Stop the network stack from transmitting > + * until we're resumed; ipa_modem_resume() arranges for the > + * TX queue to be started again. > + */ > + netif_stop_queue(netdev); > + > + (void)pm_runtime_put(dev); > + > + return NETDEV_TX_BUSY;