Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6025361rwb; Tue, 17 Jan 2023 23:32:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXviV2l+f4ijTXNSJOmgEENZS2LZfv6nP8whEK4MQRNkFBZx86BX/G5PY82FycSz6fjjPVcD X-Received: by 2002:a62:ea0e:0:b0:577:d10d:6eab with SMTP id t14-20020a62ea0e000000b00577d10d6eabmr6674189pfh.21.1674027148823; Tue, 17 Jan 2023 23:32:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674027148; cv=none; d=google.com; s=arc-20160816; b=WfTvPKjU9Mhv8v6Ap4zFGqGeTNB0Oc9gYDA0/qoeEJ56Qqzokfq46jBT+k6VcEp2bj X+zrsfqSWnyvhUk8l7IpCphvVX/IYWQrCF3fpVbgFhEz7+jeu2BAmVuE98bYCuC8aFHT w4A/0BgrBHo+iILGmEGdbuuHEij6d+ufKr3SFZl6/+7tXiYPEi4EXrUzNhtsWhKgmQQg B4Rv7C1Hc1+S+CPVqRCQysL1UiNIT7UltdjwNmwBJ8VPSJzaD7ouiEybtGF+7bSpnBGl gImA+5F4f2L+SBlsu2GMl8f5aJ+I9vuVamoV1lg52Y+sh3Zlt132F7ieqRip5DRpx2FI tX6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=0DkvDjC4+wQHsjoNXwjNuJHLSlLIOGpCPF00a5pWew8=; b=XCZqi1v98Y0AjHNZ2EaLPjBLkVX7Ko2i0ZHmmkUrNDffwsr4Ial/AYLAY1fIibovHB +8SzI88KtMlx4a5h1J2UpZLrq02EcIq9vFhwZ9kK1kVKbRAQTviwZgR0w9LVDSEZpFKF /1P7ZtgZZBE2IBVva3BusD8Tu0sajOy/3DIX9EH5/0FpT14Cs+ZLEX2hNZQk+ZfNnpwL MxhRlPZmPRNHgKaMa6Bu+zCKzhAxX0A2Zmc3hXSaY5nr2xX1C/rJ6h1CKIl0hVN2HiqL 7afcFZ5tawumTD28DX/I+NZtKoK3oWRitfQgvxhV1d2BKMeHG2myGSzBllmnd45Grs1Z 741g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=JiceMX0T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb9-20020a056a004c8900b0058de7c53548si800166pfb.149.2023.01.17.23.32.22; Tue, 17 Jan 2023 23:32:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=JiceMX0T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229612AbjARHCZ (ORCPT + 48 others); Wed, 18 Jan 2023 02:02:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229969AbjARHAu (ORCPT ); Wed, 18 Jan 2023 02:00:50 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BFE165EF6 for ; Tue, 17 Jan 2023 22:33:06 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id g205so8312453pfb.6 for ; Tue, 17 Jan 2023 22:33:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0DkvDjC4+wQHsjoNXwjNuJHLSlLIOGpCPF00a5pWew8=; b=JiceMX0TWkJc6gOrwosaDJT/narGqlJWljJ+KSVAWhZnbVF/NKNCkFfB+tNJVKhnM1 NYZa88f/U0eOqdjL0VYe+dAbUL0xiNnd+qlCaV0FEsLrqlrmc+9abL/rub+4hJcC+YLh 6QaBacb+B8HnPcatvh/ta/Jbz56g72FxHAblg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=0DkvDjC4+wQHsjoNXwjNuJHLSlLIOGpCPF00a5pWew8=; b=NffeohaW0f6buMCWVdNLas5dNtC4fFNMEaH/WL1mIUu33PgvLnRKhStV4P4Xj/ROHX Nvryml+acnaRmDiSoirmQaJBGwKe08QXKeVGCLLqWzD+Ntkw/EWL5/eEkSIsDz8Gas94 onGyknD7NEZre4usHw4PP5T9Gh4zjSu9IBGhGMABywP1BldScxJAY+QrGqvk1rOHIMHb Ov1MY/e38Li+ycW6BhXr9ZWlVuw+jCpg9AfNr9/AGE0oNCPP2uidmvIGHDSQZ5NQIK7Q OhK2Px9DW/eeD5gATj4v2J7NP+6HQFVpfF8yvxpYiGqc3wj+46+NBttGsAZctm+RaG+R +9/g== X-Gm-Message-State: AFqh2koQlKkZ77kzptR23tyL5fqlJQRXxKpfQxNqNpuPHP6BjJcvm23i JUnnk7QiaDKWCFQubeJT42LL/UAkYb/wGuysGjCeFw== X-Received: by 2002:a63:2003:0:b0:48e:bdef:b6fb with SMTP id g3-20020a632003000000b0048ebdefb6fbmr355777pgg.457.1674023554993; Tue, 17 Jan 2023 22:32:34 -0800 (PST) MIME-Version: 1.0 References: <20230112202939.19562-1-ajit.khaparde@broadcom.com> <20230112202939.19562-2-ajit.khaparde@broadcom.com> <20230113221042.5d24bdde@kernel.org> <20230116205625.394596cc@kernel.org> In-Reply-To: From: Ajit Khaparde Date: Tue, 17 Jan 2023 22:32:18 -0800 Message-ID: Subject: Re: [PATCH net-next v7 1/8] bnxt_en: Add auxiliary driver support To: Leon Romanovsky Cc: Jakub Kicinski , andrew.gospodarek@broadcom.com, davem@davemloft.net, edumazet@google.com, jgg@ziepe.ca, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, michael.chan@broadcom.com, netdev@vger.kernel.org, pabeni@redhat.com, selvin.xavier@broadcom.com Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="0000000000005dfdfd05f283fbf1" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0000000000005dfdfd05f283fbf1 Content-Type: text/plain; charset="UTF-8" On Tue, Jan 17, 2023 at 4:31 AM Leon Romanovsky wrote: > > On Mon, Jan 16, 2023 at 08:56:25PM -0800, Jakub Kicinski wrote: > > On Sat, 14 Jan 2023 12:39:09 -0800 Ajit Khaparde wrote: > > > > > +static void bnxt_aux_dev_release(struct device *dev) > > > > > +{ > > > > > + struct bnxt_aux_dev *bnxt_adev = > > > > > + container_of(dev, struct bnxt_aux_dev, aux_dev.dev); > > > > > + struct bnxt *bp = netdev_priv(bnxt_adev->edev->net); > > > > > + > > > > > + bnxt_adev->edev->en_ops = NULL; > > > > > + kfree(bnxt_adev->edev); > > > > > > > > And yet the reference counted "release" function accesses the bp->adev > > > > like it must exist. > > > > > > > > This seems odd to me - why do we need refcounting on devices at all > > > > if we can free them synchronously? To be clear - I'm not sure this is > > > > wrong, just seems odd. > > > I followed the existing implementations in that regard. Thanks > > > > Leon, could you take a look? Is there no problem in assuming bnxt_adev > > is still around in the release function? > > You caught a real bug. The auxdev idea is very simple - it needs to > behave like driver core, but in the driver itself. > > As such, bnxt_aux_dev_free() shouldn't be called after bnxt_rdma_aux_device_uninit(). > Device will be released through auxiliary_device_uninit(); Ok. But.. bnxt_aux_dev_free() is actually freeing up the private memory allocated for holding the pointer returned by my_aux_dev_alloc(xxx); The aux device is freed via the auxiliary_device_uninit only. > > BTW, line 325 from below shouldn't exist too. ACK > > 312 void bnxt_rdma_aux_device_uninit(struct bnxt *bp) > 313 { > ... > 325 if (bnxt_adev->id >= 0) > 326 ida_free(&bnxt_aux_dev_ids, bnxt_adev->id); > > And one line bnxt_aux_dev_alloc() needs to be deleted too. To avoid confusion, I will refactor and rename the code handling auxiliary_device alloc, cleanup and the alloc, cleanup of priv pointers used for bookkeeping. I hope the new patchset will address the concerns raised. > > Thanks --0000000000005dfdfd05f283fbf1 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQdgYJKoZIhvcNAQcCoIIQZzCCEGMCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg3NMIIFDTCCA/WgAwIBAgIQeEqpED+lv77edQixNJMdADANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA5MTYwMDAwMDBaFw0yODA5MTYwMDAwMDBaMFsxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXN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