Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp1277753pxb; Fri, 13 Aug 2021 19:26:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAZkmPmB2z1wPcVh6qu1IWwiraOtkBhDSN186iH9BKEWo31TDrXYjJNWzEeCooMqnchhuH X-Received: by 2002:a05:6e02:1d96:: with SMTP id h22mr3746236ila.294.1628908013574; Fri, 13 Aug 2021 19:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628908013; cv=none; d=google.com; s=arc-20160816; b=gmOoKHvBteHECMu7btCtA9CWR+sKYxRbn8+yLXsVy/A7Tx4zxVZIEKo7NOP97BGKeG ntMZVu8iSRtZIv0Xw9kfgVbPlOzfujnRxpylHH0NOnQQ9NIxK5xNsJjraaucT5IEfOgx THwgFk+wJSvASHpxN4G+oAebzXtnULpE48IN0NkgVplbqO7L/Eyg3u6QQrYabSat55pY ADulL6QaT2sSOf8Qxj8AL3D68gTMDnm8dTLexexjy5wjJ2lsOIcTJxE77kuBtMT649Od M11a1RSOsIhyl76sZeR2RhvYbs6AJliEZhZ5w+n22veN5WBlprnU+g93OwMoKQHq9AXO SPlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=g+h4YdA10rVYLoy91RdRh05aT4UGlm+BaDf29HhFh7M=; b=k3W5UWK3QiaXQa43OzPSVo5LlBJMHwASskQ7m5ASTvJ3HiKPEAx9dW/Tk0Mrallj6P V7Hp4gVUwQRkRVTchxGPYf89W8d3Q4CJ0FLHQ38Ma3OiUynvC1e7//sEnEgshi+3OvjL T3c8YtW8G/Fws+mh8h1omd8e1YAM55h/iNK3I4e20ZKj4w6OEEzuq4tU8aVyNRjFldms oNwNnHF0KGgL7dfCQ8DtIy+/YJfsZnPW82E+1f/69BZ7bNT/y7fIzjyEGMNEiI+1ewFj 9+qVFLv3Wu/jxi4XcEnW3Pm+jyaiL4JmhOqk59+4PQFQXbxSIA/19YEHt/j8K7PeVTTv ImgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JrmfQNjD; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si3306420ilj.65.2021.08.13.19.26.41; Fri, 13 Aug 2021 19:26:53 -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=@linaro.org header.s=google header.b=JrmfQNjD; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236555AbhHNCZx (ORCPT + 99 others); Fri, 13 Aug 2021 22:25:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236487AbhHNCZw (ORCPT ); Fri, 13 Aug 2021 22:25:52 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60E5AC0617AD for ; Fri, 13 Aug 2021 19:25:25 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id y3so12802503ilm.6 for ; Fri, 13 Aug 2021 19:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=g+h4YdA10rVYLoy91RdRh05aT4UGlm+BaDf29HhFh7M=; b=JrmfQNjDCsooCATbytaYIpJCtaeY7BuUCMpzvndME5z1Xl8ifWHr0gP+uIKxvgGOt/ eopFms6IIU7bYWzj3aJNfMR2EHMRPMzlWoL4v6sH3PYFZOARe2Bh2MLM4gTDzv1D7gKO 2dk8N3fN6yfK3EAtY2WiDbmOIACaTVTJH1RsJW21b20bu+DLi1+ZmVGLkhY88WiLIrcE 0UNQIGqXRaxchmodrll6oOMxqt2A65Tnw2lVLuW2xz+ilTW6LgOaE8EiMVgjqtIns1WK p6J9z7tHpQ0bP6+rRy4vrpMY8oI0ifCtZA568J7TESQQoax2miGv0bEZH5jYKGNokzYb 1qHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=g+h4YdA10rVYLoy91RdRh05aT4UGlm+BaDf29HhFh7M=; b=gLsNiwT7M2qn7YEB2EVlapvqYkiuBFhr6AxCnrXPAJkrHD39nkdSWbFAa7rAzeRkN9 nWUdBZJFU30K27HlU+gmZeY6wHuqq+HrHpXSYevkSdB/td/ZjXo7ODzMzW+19jFgvw2I P2VvbiF5PU4TbgqgkgdGbH4JoVwHDbym3yKRJapFe4CH7E4fBtmJswFW7SnR07g1K8/u ANgqPlQcrf44zxu8lIj/H6AzQW+4kCemLqdg8a9VzJaMaS/lrakpyvPgw1GBlBxgWas7 GBM4XjrAZ87dheEjlRuPb+WbOmssWuGoqLbOKVD2V3RNC6lfCVVoINZqR4+j4+i+ypNO px3A== X-Gm-Message-State: AOAM532+ed+GwzpO/mtI5EfheoEfUMor24nA04T/WEeRIzGmac4tm8ce sGqUPb5b41SS9Yog4H7AJ526MWXH0U3lIRU9 X-Received: by 2002:a05:6e02:1107:: with SMTP id u7mr3622311ilk.39.1628907924549; Fri, 13 Aug 2021 19:25:24 -0700 (PDT) Received: from [172.22.22.26] (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.googlemail.com with ESMTPSA id w10sm1921603ioc.55.2021.08.13.19.25.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Aug 2021 19:25:24 -0700 (PDT) Subject: Re: [PATCH net-next 4/6] net: ipa: ensure hardware has power in ipa_start_xmit() To: Jakub Kicinski 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 References: <20210812195035.2816276-1-elder@linaro.org> <20210812195035.2816276-5-elder@linaro.org> <20210813174655.1d13b524@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Alex Elder Message-ID: <3a9e82cc-c09e-62e8-4671-8f16d4f6a35b@linaro.org> Date: Fri, 13 Aug 2021 21:25:23 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210813174655.1d13b524@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/13/21 7:46 PM, Jakub Kicinski wrote: > 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? I haven't been seeing this happen but I think you may be right. I did think about this race, but I think I was relying on the PM work queue to somehow avoid the problem. I need to think about this again after a good night's sleep. I might need to add an atomic flag or something. -Alex >> + /* 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;