Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp3016082rdb; Mon, 4 Dec 2023 14:13:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHC7BaMTp+2eQRGvxaNyww+0nZ4wsmEfzxWMS/XxYfuOcs/TxJH4jaJY2da5ZP3ccnyFnyY X-Received: by 2002:a17:902:e5cc:b0:1d0:7293:ec2c with SMTP id u12-20020a170902e5cc00b001d07293ec2cmr4899686plf.14.1701728030846; Mon, 04 Dec 2023 14:13:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701728030; cv=none; d=google.com; s=arc-20160816; b=mGEE1UITSITMR7vOyfMLMLYzPwSmHlOx1Wr+ENWmvJiGo312+LAXCUE8Jhslkkoiwh 6qjQ1mCrsxrenayaFOOPp7j7Ojz/bALvgoKMQoP9fJu0bI1RYgPk1n4DYnk+NAQlMssv L2xIY3L/vf73/glr34N2fvLJmxm1MSoCqPpMCCzfcjwP6Eob7cuI+zuzOPMV+P7M+BCb ny3nZ3KkSXCaT9M6QIPbk/m3Ut6odUNgLMPt/FmNL+Bfwo8u8tFLgeo/HYGj8anjLrBe /HWhB0bKLvAnekA/5gAft80gTAOa0rvD7L0/fEtsZi2sQd3Ea2a7MxsAbYNVrIWtxcnH B+YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ArZo5LGYTBaOx/Vwapx48n76DlSMubqakK9kENEDfug=; fh=lb5BetBTb5HQhvYiXA9iQa6EH3piq0yr/ljvC/rW1sE=; b=amYvE8/Gg30//WedcwEePHReDd17yRcmJfBVozBIW2EQ/c9mYBcrcE53wKkBAsUU09 dg48Qm92y71y7ISx0IxGPeb16+A+99WDp8QIPCMb6ZLx2gotKAULwH40clPWIqKMyyVu kLVfYGHkSeucwDgA4xIBWETwhPo85YUPozGx01NY9PvVuXwBbpsEZOLrD0W+nDhAE+Z/ u7rKx+CngdsTnfMlSb+L4IqxHViA2JicncDs/7qdtUMdcgROBQIvnoKct8911bMdo0aK r9yQTAyjDIVWMiTmIK2wlXoBUv2Xnzmb5DvvaCtoNX6DrtTzU/SNuHCU4upUoin9YzkC Rfbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KBZdqTNv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id c3-20020a170902d90300b001d0545646d0si6140522plz.312.2023.12.04.14.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:13:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KBZdqTNv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 6C4EE80B1E56; Mon, 4 Dec 2023 14:13:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231317AbjLDWNe (ORCPT + 99 others); Mon, 4 Dec 2023 17:13:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbjLDWNd (ORCPT ); Mon, 4 Dec 2023 17:13:33 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D29CB for ; Mon, 4 Dec 2023 14:13:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701728019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ArZo5LGYTBaOx/Vwapx48n76DlSMubqakK9kENEDfug=; b=KBZdqTNvs6DEFlZicCzKa7UfMpTAup4yldI5tmzxBi99yyMHYhfrGx4isLmMiLS4Zi1XQ8 6vOIJ/XX4FMDRHiKr2+/PIfgWLdxB72a073luy+slD4p6/QEoX5W6CgHv12EOdDn8hhpoj glfQG0GqSQlqADpICzh/eW00D6y9Iv8= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-296-7cMHBwTLO56OA99lFMhS0w-1; Mon, 04 Dec 2023 17:13:37 -0500 X-MC-Unique: 7cMHBwTLO56OA99lFMhS0w-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-54c7a341490so1569286a12.0 for ; Mon, 04 Dec 2023 14:13:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701728015; x=1702332815; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ArZo5LGYTBaOx/Vwapx48n76DlSMubqakK9kENEDfug=; b=dq2a7YDBz0SXHQ7426Fu2yBe7S7uPLbhAfcl5shNcJRLr14jzlXZyVh/FxpIhzDHYo QzQxfNihlF88Yu4ocTb8nIWlTFgRf5VLg3qZTjKOKfaaQzXiBZ1iTFhY+n9OA3YbOMgd /Djv71RLWw/CcxMq9FZfH8h22yQ2F6nrfxHctAIq14Q7xrnV7JuD21QmpSMQ54GzdL23 Zvt5y9abXaBPApHRe+K0uo+iauzlorRuvWmPd6AWKxczI5MjVR3mYgJ7iLFMWFRD9y7Z VnyBsKr36X4F/ToKU8ODPD+H+dg90BcMWxR8YIODsuAwcidoWasHz+/pDu3aOuiRwTAc CIHg== X-Gm-Message-State: AOJu0Yzweq/qMjAHhj/2Qs1S7hXOGhOZLjxF2uYB9udb9maJ1Wmtj7pp 4o7qGT2b+bjXqZrUdVyob1a37QbmcToXRO4BL4JAlFmHs6zcB4GREqKINtz59BCfus4Xwjd+X1D 0GieltSDXi6CSOmnbJwgSwNex/yXjmiEsSeM0EK4N X-Received: by 2002:a05:6402:516b:b0:54c:5257:f3 with SMTP id d11-20020a056402516b00b0054c525700f3mr3015336ede.83.1701728015710; Mon, 04 Dec 2023 14:13:35 -0800 (PST) X-Received: by 2002:a05:6402:516b:b0:54c:5257:f3 with SMTP id d11-20020a056402516b00b0054c525700f3mr3015327ede.83.1701728015401; Mon, 04 Dec 2023 14:13:35 -0800 (PST) MIME-Version: 1.0 References: <20231202150807.2571103-1-srasheed@marvell.com> In-Reply-To: From: Michal Schmidt Date: Mon, 4 Dec 2023 23:13:24 +0100 Message-ID: Subject: Re: [PATCH net v1] octeon_ep: initialise control mbox tasks before using APIs To: Shinas Rasheed Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, hgani@marvell.com, vimleshk@marvell.com, egallen@redhat.com, pabeni@redhat.com, horms@kernel.org, kuba@kernel.org, davem@davemloft.net, wizhao@redhat.com, konguyen@redhat.com, Veerasenareddy Burru , Sathesh Edara , Eric Dumazet Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 04 Dec 2023 14:13:48 -0800 (PST) On Mon, Dec 4, 2023 at 11:10=E2=80=AFPM Michal Schmidt wrote: > > On Sat, Dec 2, 2023 at 4:08=E2=80=AFPM Shinas Rasheed wrote: > > Do INIT_WORK for the various workqueue tasks before the first > > invocation of any control net APIs. Since octep_ctrl_net_get_info > > was called before the control net receive work task was even > > initialised, the function call wasn't returning actual firmware > > info queried from Octeon. > > It might be more accurate to say that octep_ctrl_net_get_info depends > on the processing of OEI events. This happens in intr_poll_task. > That's why intr_poll_task needs to be queued earlier. > Did octep_send_mbox_req previously always fail with EAGAIN after ^^^^^^^^^^^^^^^^^^^^^ I meant octep_ctrl_net_get_info here. > running into the 500 ms timeout in octep_send_mbox_req? > > Apropos octep_send_mbox_req... I think it has a race. "d" is put on > the ctrl_req_wait_list after sending the request to the hardware. If > the response arrives quickly, "d" might not yet be on the list when > process_mbox_resp looks for it. > Also, what protects ctrl_req_wait_list from concurrent access? > > Michal > > > Fixes: 8d6198a14e2b ("octeon_ep: support to fetch firmware info") > > Signed-off-by: Shinas Rasheed > > --- > > .../net/ethernet/marvell/octeon_ep/octep_main.c | 14 +++++++------- > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/driv= ers/net/ethernet/marvell/octeon_ep/octep_main.c > > index 552970c7dec0..3e7bfd3e0f56 100644 > > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c > > @@ -1193,6 +1193,13 @@ int octep_device_setup(struct octep_device *oct) > > if (ret) > > return ret; > > > > + INIT_WORK(&oct->tx_timeout_task, octep_tx_timeout_task); > > + INIT_WORK(&oct->ctrl_mbox_task, octep_ctrl_mbox_task); > > + INIT_DELAYED_WORK(&oct->intr_poll_task, octep_intr_poll_task); > > + oct->poll_non_ioq_intr =3D true; > > + queue_delayed_work(octep_wq, &oct->intr_poll_task, > > + msecs_to_jiffies(OCTEP_INTR_POLL_TIME_MSECS)= ); > > + > > atomic_set(&oct->hb_miss_cnt, 0); > > INIT_DELAYED_WORK(&oct->hb_task, octep_hb_timeout_task); > > > > @@ -1333,13 +1340,6 @@ static int octep_probe(struct pci_dev *pdev, con= st struct pci_device_id *ent) > > queue_delayed_work(octep_wq, &octep_dev->hb_task, > > msecs_to_jiffies(octep_dev->conf->fw_info.hb= _interval)); > > > > - INIT_WORK(&octep_dev->tx_timeout_task, octep_tx_timeout_task); > > - INIT_WORK(&octep_dev->ctrl_mbox_task, octep_ctrl_mbox_task); > > - INIT_DELAYED_WORK(&octep_dev->intr_poll_task, octep_intr_poll_t= ask); > > - octep_dev->poll_non_ioq_intr =3D true; > > - queue_delayed_work(octep_wq, &octep_dev->intr_poll_task, > > - msecs_to_jiffies(OCTEP_INTR_POLL_TIME_MSECS)= ); > > - > > netdev->netdev_ops =3D &octep_netdev_ops; > > octep_set_ethtool_ops(netdev); > > netif_carrier_off(netdev); > > -- > > 2.25.1 > >