Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4126532pxb; Mon, 27 Sep 2021 09:55:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxHJw5pu74cVYu0ghVT7DoukfYELd/T3vecu46WCh/NyHfeX+ryUZ/N0CL7YeXoZZHTYsC X-Received: by 2002:a17:906:60c7:: with SMTP id f7mr1160848ejk.57.1632761746257; Mon, 27 Sep 2021 09:55:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1632761746; cv=pass; d=google.com; s=arc-20160816; b=dsjQjLIUOO8xUtz6/VHKd34kJPpBo9pBE1585QlrU4H3AyunXzagXxlJro1bqLFl9t bpRmllEXiOLREG/kMNWhnjoNnBFpScYMXr17jPEFlJYBSHppkN4nxzxMdGIgEa/fXBlr 7zFj+D6N5n8TPF4j7jO2IZbZnmHMLQ0w9CGfffuSRM75eBDtA3qw0ZkKa9iIMWRqWXla Ztc5AatgOOAUndCjZ7vrjqByt6V7fMNLxIjCHGb0LPh08ksueJmS5ZBtDe88Riuhwmz0 SJg618dBA26xaT7mfN9nxJkt8RmdtHESTJ3Yk0mSAN8BQNGiNXVrNBOf9qVnrpuZgBP0 nKdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rjWVqA+nsUSTN3WZXT22MhzX0KmmzsaWqgYN8LWn3hA=; b=ifHinZRaFHaxOF9vstoP7G13ojlzsDC90d0Lrx53EHmIg+RF1bL4AboCx6gAVeEp1N 64Z13GsjIAjuUCp7HkROtnluVyjA9b3hNgCRHjV/642ft+eLU68twhGPWgefTLlhSHpy S/wLkdQ5vZPiD3qE788np1QQaiJWF1pwytSGAoLuJHaLHT8JxL3nKkg0DEg03qkHHT01 IKHcmGcQgZ6AJQTLktBqdcpzRo+qO2EhBk/z04Kh1gXJpWrCojf+9Fo6lOgDaqObbPoH SsowMOmbYfe5nNDLe5ytqpPRcLefgpeIEF8l2rrDHl3b0l6UdAGjzt2Eo8uyvZse1xT0 l2Fg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=IeLbuICr; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jy1si9659920ejc.592.2021.09.27.09.55.21; Mon, 27 Sep 2021 09:55:46 -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=@Nvidia.com header.s=selector2 header.b=IeLbuICr; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235425AbhI0Qzd (ORCPT + 99 others); Mon, 27 Sep 2021 12:55:33 -0400 Received: from mail-mw2nam10on2084.outbound.protection.outlook.com ([40.107.94.84]:35086 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235295AbhI0Qzc (ORCPT ); Mon, 27 Sep 2021 12:55:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z9u6Iq9S9HneU0LXNA/VnvktG2OL/K4zs1avqBopx1uEHJFx4ZlQciJmpNn83ePERZ2JB1uPJzU2Fa7VCxHeH5gGZY1Su3enyivBBnjL0aLNm8i2W3zQ8vEkwU/5xUoSbpB/ZWaAy9EVRGu+vDpXpFVmkaJJ7rfW3V2urC/egklCs4qjH00aFCA4Y/v1EWB8/35IsPTagBct42Unup5icnlCPfotV8juaBfFDmzkoMdbHa1ZPY2/SAR38lHErYrq34Ww4NUc8gqy8xtoBwcmDW789ycnOYXiiQCTZCwctXObp9fkXU8pee3yfVIoEKmzY6Yv7E5Xz2+JRbfsH4DpYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=rjWVqA+nsUSTN3WZXT22MhzX0KmmzsaWqgYN8LWn3hA=; b=R3Ejc1+H3liZzUEJbJFLfzThFwOeIVEdExqRGuyJ6IVBNJJ4j8GD1bubuIEGSTJizHk63qiqWyJDOdYWEK9Zvv6SM3h0EOyQ+cn4w5oEA8fUfvaW/FvbSOloW3AsC+7lkHzgiHzG8lu7DujpSe7o5uyavaxwhjNkMabR6neHu3ZdmOcfOnemOKtc7KjBxZb5UrQRLu/s/qvGKTZhqd9L/0gPfQN5eys79qH4JcinBbwBqjy4CYDCjRsnfC+11Cy5eJkNxLO3IdGBsqBpPiZkxb96JzDlHn0Fe7idSAVZ9/8LCl6TMa0AHMxtMVGma07Ih25nmvMzB+wmiDB7vfqymA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rjWVqA+nsUSTN3WZXT22MhzX0KmmzsaWqgYN8LWn3hA=; b=IeLbuICrwG5cy9W1uvPMLEb1mfbZo6MBoGlgNfhtopzi7HA9TcUhDFPhphElEJARE4PUBteuz7nwuMyOOvCMLuyV0vZHjtZkhTwjctII7KR/isaNa2pDA4FgpgLS0bBknKiNcke8e0S12GCgAW4SdW4tiltf5fiN7ZgviQigrDfBeQmEgpIgE+mFW1jaRe5dAXFhVBTOmoMc5IBMZUkW7/91h/TCiBUOzJNJiuENSoNsLGpIPQhsqtM3SXln02ycqZ5exgUSya5N9qciWVh8f2ydsUFXIADxO69excU+LhuMJs3Cmxwws5JjaFzChHTp7hRHzOe7b1OaH6losiG3ag== Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL1PR12MB5176.namprd12.prod.outlook.com (2603:10b6:208:311::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15; Mon, 27 Sep 2021 16:53:53 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::e8af:232:915e:2f95]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::e8af:232:915e:2f95%8]) with mapi id 15.20.4544.021; Mon, 27 Sep 2021 16:53:53 +0000 Date: Mon, 27 Sep 2021 13:53:52 -0300 From: Jason Gunthorpe To: Leon Romanovsky Cc: Doug Ledford , Aharon Landau , "David S. Miller" , Dennis Dalessandro , Gal Pressman , Jakub Kicinski , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Maor Gottlieb , Mark Zhang , Mike Marciniszyn , Mustafa Ismail , Naresh Kumar PBS , netdev@vger.kernel.org, Potnuri Bharat Teja , Saeed Mahameed , Selvin Xavier , Shiraz Saleem , Yishai Hadas , Zhu Yanjun Subject: Re: [PATCH rdma-next v1 04/11] RDMA/counter: Add an is_disabled field in struct rdma_hw_stats Message-ID: <20210927165352.GA1529966@nvidia.com> References: <97ef07eab2b56b39f3c93e12364237d5aec2acb6.1631660727.git.leonro@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <97ef07eab2b56b39f3c93e12364237d5aec2acb6.1631660727.git.leonro@nvidia.com> X-ClientProxiedBy: BL0PR1501CA0001.namprd15.prod.outlook.com (2603:10b6:207:17::14) To BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) MIME-Version: 1.0 Received: from mlx.ziepe.ca (142.162.113.129) by BL0PR1501CA0001.namprd15.prod.outlook.com (2603:10b6:207:17::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Mon, 27 Sep 2021 16:53:52 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mUtt2-006Q4E-6O; Mon, 27 Sep 2021 13:53:52 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b3c0b40d-bdc8-473d-7326-08d981d76315 X-MS-TrafficTypeDiagnostic: BL1PR12MB5176: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lKbGRMULr+tSHT5KFLllHPMeFmC/wGhfeSWb2dEKLMd6JFBPcgxTd+LRkDnIrBi+6v69KFlr96Pz6sbZrJ95gZ0ZpsFV630Gha6/B+uGZWdhh6vo2pqWR6wJc654Ap6ePxoQO1als4yReSgErFC1d2Ly6F8tZYvzwsuPH/ok+yLgBRpUnpSbe7h5lHlovvOagTZL/ve/oU1YSKeukgeM7eXjcUQtmT5ajjQwgodQwqv3tPwNz8DShy9gm78Y8Z/71AGttyfbm5Paih7WwsXokTCuffaYYhbcaKdatEEtEHjOH/KPdRpFX0vgiZMLU52LyQs8L8kDloovvcqevqohkVR6zJD4N11yD8Ueb2S1gBv70nQ+ke439kukVFr8C6Rzy1nn9ED7DrBIPGoawx4JuGuQaZdnahny9Ip4D+tPKXepvEq6osPvy5B8HL9bHpVbPBZb0svQX4Xso04MvD2moAEZ5V/Ol24fDGxXeQUbtsqpzZE2FYECHUXY6mq/n+qnpymoJj56JV8xRx5hGuEFopMcF2hTRn+eB+0U6DKt8psCQS6AHXP+2Bz5E1WGCG03rgWjevTcqeoc23CFDo1tUpmy1gUSU8NqMKOZE/2qYlY2niRNaPDNNoRzh4uN7BPgxuX4O2PF3SDJolNkwKrfZg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB5506.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6916009)(8676002)(9746002)(9786002)(36756003)(8936002)(1076003)(7416002)(186003)(316002)(83380400001)(26005)(4326008)(5660300002)(2616005)(426003)(66946007)(33656002)(54906003)(4744005)(38100700002)(2906002)(66556008)(508600001)(66476007)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Jvu8T0EZ10+LS+J81aEVMi/E2gHFo/xKu/ND/JkLEMRboij0Cc8zlmVRkYlG?= =?us-ascii?Q?ptHKRKp1+he3F76jhKKYvcRQDUQpWj1VCwyDxFnnwQvtXZk5VvDwxgZz9MqL?= =?us-ascii?Q?XH1FVmglDga13xQWMtPHkwmeoYXENyLeZYedJWNxkpVEPjVN/cpFeOYWcvxv?= =?us-ascii?Q?loccCTjkl2rJu5lf2xPPZ2GjKTkuCWeSrWV3gz1zxXicDfQyGScnC9D9obVB?= =?us-ascii?Q?jpzzyRxWmRlsyNWQLyMMciZXh7CvMwcMaSDwXExII5pkd7ztRwm+kwIEmtAP?= =?us-ascii?Q?+y5NjZBE7S9VLB9bZ8+uy7edk62wqQeaqRvAC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U?= =?us-ascii?Q?pWjDK9922PLYTqootRXUmAmHz1ZV3uhHzTWHmpK68Ge1QZA+WKbI6BXGA4nq?= =?us-ascii?Q?XPqXxUtXepx0e/dz2fqjY/GF9DH7CyiYjEb8nDh105kP/IPjaztclSrWStQR?= =?us-ascii?Q?NLRAIy+feeo6AcUeAnm2VV9f?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3c0b40d-bdc8-473d-7326-08d981d76315 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2021 16:53:53.2247 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: egSF3UvrEk/0R3sZG3rMdiXivdbMO1jQwxLJGTn/2kvBc2i8R6xisdK8iZaMm3MR X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5176 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 02:07:23AM +0300, Leon Romanovsky wrote: > diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c > index 3f6b98a87566..67519730b1ac 100644 > +++ b/drivers/infiniband/core/nldev.c > @@ -968,15 +968,21 @@ static int fill_stat_counter_hwcounters(struct sk_buff *msg, > if (!table_attr) > return -EMSGSIZE; > @@ -601,11 +604,20 @@ static inline struct rdma_hw_stats *rdma_alloc_hw_stats_struct( > if (!stats) > return NULL; > > + stats->is_disabled = kcalloc(BITS_TO_LONGS(num_counters), > + sizeof(long), GFP_KERNEL); > + if (!stats->is_disabled) > + goto err; > + Please de-inline this function and make a rdma_free_hw_stats_struct() call to pair with it. The hw_stats_data kfree should be in there. If you do this as a precursor patch this patch will be much smaller. Also, the stats = kzalloc(sizeof(*stats) + num_counters * sizeof(u64), GFP_KERNEL); Should be using array_size Jason