From patchwork Wed Apr 14 07:46:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Pan X-Patchwork-Id: 12202099 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D932DC43460 for ; Wed, 14 Apr 2021 07:46:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5310613C1 for ; Wed, 14 Apr 2021 07:46:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349752AbhDNHqo (ORCPT ); Wed, 14 Apr 2021 03:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349671AbhDNHqm (ORCPT ); Wed, 14 Apr 2021 03:46:42 -0400 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E883C061756 for ; Wed, 14 Apr 2021 00:46:20 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id c8-20020a9d78480000b0290289e9d1b7bcso4473510otm.4 for ; Wed, 14 Apr 2021 00:46:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HE1GrmBu4V6WQXUq6gjFYYmeNvbtG5Wm01EiBjvhCwk=; b=sE/A9dan6z2dFFoDGGs+eArXe3EE63A/eLyON1BvTN5Ozs1pzgmPTtw8wbX/Ldua5i OGEEEg0TNEJrF1FSbfk46bwFiR+3JBrMQ6SHsrMR99JrNSeKOfJm+i6y358aRrWSk62l hyplA9HxuVaUiT2hNpaKTggrtRTJ3F/VCoZdDOmkAElyVuWw/rAd0Y+0PApMnnxErmU7 b3cTbx52NQuT/e1C5KrqXAyPfNmrdZ5nyET1dgWPT4R5gV1DJ+3Q6jQhJ7M4VsgK2ROb ICfQkHZHDCQQGsga4VJQ+v7C2+GcDt/s/C8kkhAKd4WM5w4UZPaWKlEc3ypYtiffOuUc LftQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HE1GrmBu4V6WQXUq6gjFYYmeNvbtG5Wm01EiBjvhCwk=; b=XeYjD3FlUuPjlpicNMyVtbsWlcAbuwVY+2+IVVnNf0MNKwoZYsGC52DzpZq2dMaAiR As1lu/FbZxVOwSQFFun4yVyaqBbgVOh/OuySY13UiIsvl6+Ei1uR501b9tlZUtFta/ZT L34j2c4p0lNbF4oybeK3nay71575DRi2BJnUkYpXbqt1neL3SPKravaHvaLn8LYD1CJA dS6stN/WgpEdrXL7S/Q5i6sOpFlrPVcNaYkJvWvGmlCOAwdlKhyIrONN7sF9MkyXT3gV jvN5WN267Mi9HzhTrHdVkEIwRKM3xzSPh5X4JCRiD9vh5lw8qGRO4ScK9EFjMhoTpsHY 4Sdw== X-Gm-Message-State: AOAM5333TOz5SBgUqJaqwz7NOE/vbQ8czLPTA8hG5lpJeP0D85wfO0cl Bi9jpK9wx3+kEK2uMTVCWclkFCDRtCZabQ== X-Google-Smtp-Source: ABdhPJz9qhiup/78vKU7GJ8HtprfB3H+PwkSOUeuV5fhkPAR74JkQgx/mkJG16SZa5Tk1W8koQIQcQ== X-Received: by 2002:a9d:1e83:: with SMTP id n3mr18877296otn.233.1618386379484; Wed, 14 Apr 2021 00:46:19 -0700 (PDT) Received: from pear.attlocal.net ([2600:1700:271:1a80:7124:9f6b:8552:7fdf]) by smtp.gmail.com with ESMTPSA id w3sm2833015otg.78.2021.04.14.00.46.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Apr 2021 00:46:19 -0700 (PDT) From: Lijun Pan To: netdev@vger.kernel.org Cc: Lijun Pan , Thomas Falcon Subject: [PATCH net 1/3] ibmvnic: avoid calling napi_disable() twice Date: Wed, 14 Apr 2021 02:46:14 -0500 Message-Id: <20210414074616.11299-2-lijunp213@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210414074616.11299-1-lijunp213@gmail.com> References: <20210414074616.11299-1-lijunp213@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org __ibmvnic_open calls napi_disable without checking whether NAPI polling has already been disabled or not. This could cause napi_disable being called twice, which could generate deadlock. For example, the first napi_disable will spin until NAPI_STATE_SCHED is cleared by napi_complete_done, then set it again. When napi_disable is called the second time, it will loop infinitely because no dev->poll will be running to clear NAPI_STATE_SCHED. To prevent above scenario from happening, call ibmvnic_napi_disable() which checks if napi is disabled or not before calling napi_disable. Fixes: bfc32f297337 ("ibmvnic: Move resource initialization to its own routine") Suggested-by: Thomas Falcon Signed-off-by: Lijun Pan --- drivers/net/ethernet/ibm/ibmvnic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 110a0d0eaabb..2d27f8aa0d4b 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -1149,8 +1149,7 @@ static int __ibmvnic_open(struct net_device *netdev) rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_UP); if (rc) { - for (i = 0; i < adapter->req_rx_queues; i++) - napi_disable(&adapter->napi[i]); + ibmvnic_napi_disable(adapter); release_resources(adapter); return rc; } From patchwork Wed Apr 14 07:46:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Pan X-Patchwork-Id: 12202097 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB044C433B4 for ; Wed, 14 Apr 2021 07:46:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F58A61176 for ; Wed, 14 Apr 2021 07:46:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349708AbhDNHqn (ORCPT ); Wed, 14 Apr 2021 03:46:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349656AbhDNHql (ORCPT ); Wed, 14 Apr 2021 03:46:41 -0400 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B398C061574 for ; Wed, 14 Apr 2021 00:46:21 -0700 (PDT) Received: by mail-ot1-x330.google.com with SMTP id c8-20020a9d78480000b0290289e9d1b7bcso4473527otm.4 for ; Wed, 14 Apr 2021 00:46:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yB2GGPDSNhfxT0xSY1Kgyrf/E9Kc81aasNbjs8RhMUk=; b=GGoMCH0Z3bb1ofvykJT9sM/4QuB7t/do1P3w1WHQP3sNCOnURm5x0Xv1+q3r3ZZm0g nNHU98mZRr+ot2n3DXMLMzLreMNBI8tiPhmQg7sH9XAayWcywSB/C0Sq6eayCslhJHaf VNJ4OzzAtNI0Ud9ketj28dRuDoPoyZHmj+EcNatEnY8Hx4wZeXCVu+KPfOsXGJvsPVFT 1nm5W4cKqLsCTN8o80LAMxR+ympKEgus9rEFx0f0p6dVHVt87rue8kRWlsaAKmfTvQRO S8z28vs7Sxi8icqv2207LcyPgCVj2gsMdQsr7tqY4B2HzimHYV1b/3jHLko1xmKnyDQ0 nyAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yB2GGPDSNhfxT0xSY1Kgyrf/E9Kc81aasNbjs8RhMUk=; b=Q4/qU4OWeKi7/WojQIa1PGQCByyBA20VV/RW/5inpoq5VxFpZ8A1eJsEH/oHEHZHSA zkPyiWOz0RUXIzw9jsr2uyD2Ak5HSLXfyFwG6leZZKl45kTMC9/2MY5jK6qlwvCw0qtd zwAspG1QaYtk5ORL4loeLckWes6LoNMZLWg+711KTLhrjYxmXOaZivqCTXKyc513pJ5r 4b5jz1QqGQF26q79Yo4P1nwSqyulKEZVjCxwew2PjGRK4dvMF1EQqgdAvR/cpf5pYRZt oF/D7fvIn++aLB64QVlVlK2JaNWKy252d7gDS7AXdrX0UBkV+9VExNgwU2Gu+C8oY2tX SHvQ== X-Gm-Message-State: AOAM533rftA9LxJ7N+R1Iet9r5t2G9rZHyUJjmISKprnEJwBgdvqBrCz UV/vbOwFQ/mZ0ixGHndz6Cmwk3ovC+BNYg== X-Google-Smtp-Source: ABdhPJzU7UcEWuoLCQ3yHSKLZ125hVagnehAZXHiz1cHjs+FUZSTozNyEYM0Q8+ntuv0bFvU3bgyDQ== X-Received: by 2002:a9d:17e7:: with SMTP id j94mr32427140otj.41.1618386380360; Wed, 14 Apr 2021 00:46:20 -0700 (PDT) Received: from pear.attlocal.net ([2600:1700:271:1a80:7124:9f6b:8552:7fdf]) by smtp.gmail.com with ESMTPSA id w3sm2833015otg.78.2021.04.14.00.46.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Apr 2021 00:46:20 -0700 (PDT) From: Lijun Pan To: netdev@vger.kernel.org Cc: Lijun Pan Subject: [PATCH net 2/3] ibmvnic: remove duplicate napi_schedule call in do_reset function Date: Wed, 14 Apr 2021 02:46:15 -0500 Message-Id: <20210414074616.11299-3-lijunp213@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210414074616.11299-1-lijunp213@gmail.com> References: <20210414074616.11299-1-lijunp213@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org During adapter reset, do_reset/do_hard_reset calls ibmvnic_open(), which will calls napi_schedule if previous state is VNIC_CLOSED (i.e, the reset case, and "ifconfig down" case). So there is no need for do_reset to call napi_schedule again at the end of the function though napi_schedule will neglect the request if napi is already scheduled. Fixes: ed651a10875f ("ibmvnic: Updated reset handling") Signed-off-by: Lijun Pan --- drivers/net/ethernet/ibm/ibmvnic.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 2d27f8aa0d4b..f4bd63216672 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -1921,7 +1921,7 @@ static int do_reset(struct ibmvnic_adapter *adapter, u64 old_num_rx_queues, old_num_tx_queues; u64 old_num_rx_slots, old_num_tx_slots; struct net_device *netdev = adapter->netdev; - int i, rc; + int rc; netdev_dbg(adapter->netdev, "[S:%d FOP:%d] Reset reason %d, reset_state %d\n", @@ -2110,10 +2110,6 @@ static int do_reset(struct ibmvnic_adapter *adapter, /* refresh device's multicast list */ ibmvnic_set_multi(netdev); - /* kick napi */ - for (i = 0; i < adapter->req_rx_queues; i++) - napi_schedule(&adapter->napi[i]); - if (adapter->reset_reason == VNIC_RESET_FAILOVER || adapter->reset_reason == VNIC_RESET_MOBILITY) __netdev_notify_peers(netdev); From patchwork Wed Apr 14 07:46:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Pan X-Patchwork-Id: 12202101 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4315DC433ED for ; Wed, 14 Apr 2021 07:46:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C2B3613A9 for ; Wed, 14 Apr 2021 07:46:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349771AbhDNHqp (ORCPT ); Wed, 14 Apr 2021 03:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349686AbhDNHqm (ORCPT ); Wed, 14 Apr 2021 03:46:42 -0400 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8A22C061574 for ; Wed, 14 Apr 2021 00:46:21 -0700 (PDT) Received: by mail-ot1-x335.google.com with SMTP id a2-20020a0568300082b029028d8118b91fso85554oto.2 for ; Wed, 14 Apr 2021 00:46:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HsZiAAIPK9zxZbLQaDZtyVvDSUyuSo45EeY0Pr2AMK4=; b=D2vTFHEh7+529fWgn+/YzWIMJsXuQPKsudrRQgdzZtCLJxKDpOjtue/eudcYZ+INjO yN58AjUrriPNpI4nGGNrpw8SLU29iU/wIRrNc159/w9ShsH2eOWeexqfOs1bFgJaOiqG MLZJkUVR9/ZigdfwN7IL9uguvKbcb67Kxr+Af7xMapTb73+CvUj/HdWtYXpabC7M++/J 0udNlR1kYTHBQoSZOSPEDeCweaMiO6gTCa7XScr82RB7Hwae8PbVIQH9vHOZKHoXrCH2 62zyQaCY2ZDC4yF5rv5xGDZtG4kOhZrSxEIHqSGrjvy5JWyxS8V4H+cqaRRKuhveNP1S Y6Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HsZiAAIPK9zxZbLQaDZtyVvDSUyuSo45EeY0Pr2AMK4=; b=G1rZzEkfarrokKO7Qyzg1NX9YBdSpBZwoGnxQrH0ihr/aojQjQgAgbOPMSdW5o9edm AVO6ohHlGI/yDm3MbcU8X4YUvb+U1Rt8L+b8z5DY0WYIJSzvstEv9V5oAUjaHaqDvEXg XqhLw1Y4UijGrf2lWfBpmGpG+aNMCCR1Np3Jh/3zHezuugiLx8YK1Uo/vqwQq6RgB4fw SIE6QBYj8xz1O5uIeDvZG0i5DAd3zr06xzXHMJcRAs+sWeY+n2ALxduSTzkRDi+S204L KV4nlGItCb/XwJENfmgfZxSY0Q1oBnYemKCxBWFbciXpY4eT8nmi08daeiFnzdzHyJwO JU+g== X-Gm-Message-State: AOAM531YqGqx/62HVx0u5EoenwxgxFbDblZcO1r5Qk9kFHtI0ZT5l7uP Zj9OY4a/pA6QbNm05DiA7/w5UOMnIQz/ZQ== X-Google-Smtp-Source: ABdhPJyrdQKYaxjiDg0gnfQW2Uoa9yciG1f0EBlNt1OtO9iKqwzl7C9OJ2UgtSnk2p+y2CYt3L2VJw== X-Received: by 2002:a9d:12d2:: with SMTP id g76mr21727596otg.216.1618386381043; Wed, 14 Apr 2021 00:46:21 -0700 (PDT) Received: from pear.attlocal.net ([2600:1700:271:1a80:7124:9f6b:8552:7fdf]) by smtp.gmail.com with ESMTPSA id w3sm2833015otg.78.2021.04.14.00.46.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Apr 2021 00:46:20 -0700 (PDT) From: Lijun Pan To: netdev@vger.kernel.org Cc: Lijun Pan Subject: [PATCH net 3/3] ibmvnic: remove duplicate napi_schedule call in open function Date: Wed, 14 Apr 2021 02:46:16 -0500 Message-Id: <20210414074616.11299-4-lijunp213@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210414074616.11299-1-lijunp213@gmail.com> References: <20210414074616.11299-1-lijunp213@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Remove the unnecessary napi_schedule() call in __ibmvnic_open() since interrupt_rx() calls napi_schedule_prep/__napi_schedule during every receive interrupt. Fixes: ed651a10875f ("ibmvnic: Updated reset handling") Signed-off-by: Lijun Pan --- drivers/net/ethernet/ibm/ibmvnic.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index f4bd63216672..ffb2a91750c7 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -1156,11 +1156,6 @@ static int __ibmvnic_open(struct net_device *netdev) netif_tx_start_all_queues(netdev); - if (prev_state == VNIC_CLOSED) { - for (i = 0; i < adapter->req_rx_queues; i++) - napi_schedule(&adapter->napi[i]); - } - adapter->state = VNIC_OPEN; return rc; }