Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3232214pxj; Mon, 7 Jun 2021 05:51:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPVjqqzGetI2zxnrq/zEIiqmOJZbk8ENNhwgtqo+qtRMlf8KH6dc+7YKMgV++kt9IM8laN X-Received: by 2002:aa7:dd57:: with SMTP id o23mr19497020edw.98.1623070305731; Mon, 07 Jun 2021 05:51:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1623070305; cv=pass; d=google.com; s=arc-20160816; b=QSKig2JPAvV0Jw0Csy50FjW0hZB6SAfMzj7SFARIJ/9xr3u6JFIxkqcHhcLnONWtFk yk4W1o5wuyI6PW/jgV/Eo+k4AzPBcyexHSTv+0+jYt67KRv3k24WKYHjE5GCA2rBmJ4r YMexsgS1kOafNzpF3y6GEN0f7wPeEYdwhs8lBYBgqYv4ehrciGvA9ljTPgZmmFUS44lp qwZxduK+CNs9UqBWhbHNCfsj1s7j7VeZj0yNBi1ZGQuhZoAGHESFbT6Eo6Eh4+TQ73GN AB1XZ7WYpsX7oDtDiVLKq0+H3w8sNnRPAu9OALZRPD7C0ktKplsYf1QegGHBlECp3C/E HWHQ== 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=h0X8ivA5RIbq1KQPqriIiFa4RMjlmtZOOxxBxMnHJjo=; b=eW31uZLkU4tO0p5tNcccdA8E6Sge3LOaaOll2Zdckik3iRpSgDBnxc5hGJ9uYjfZrs 5o/RXRq18WixoXY5XzxbgpGGbBRN6Khg8T35MJWdN0ZZF9aLbX9yZWg73OZXKbFmoMtw 3uQccJ7ekuVucW6FcsFtKppj8Rm2faWCSfyNm+G7sqkiXD2rcmWPNCvkUQOa3Lw5xXAY wqfCnTsJGUM15s0cx3rFkS0+PmUB2WK3lRDpsZngoMt7632YH00ly9HGdz5NpY6T1R1N I4HRzCZs3evEWsW3lm5jNM/LoOOKi0QkLZQwpyPAQ0WPSr6+zLHgqFoN+H6UDrOSABdJ iApQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="hW3N/R/x"; 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=NONE 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 y18si12053039edr.488.2021.06.07.05.51.21; Mon, 07 Jun 2021 05:51:45 -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="hW3N/R/x"; 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=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230351AbhFGMwI (ORCPT + 99 others); Mon, 7 Jun 2021 08:52:08 -0400 Received: from mail-dm6nam12on2058.outbound.protection.outlook.com ([40.107.243.58]:54624 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230396AbhFGMwH (ORCPT ); Mon, 7 Jun 2021 08:52:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=htw3Te87RZaFhL5Q54+puTt9regJ16TbmsEDomqNNaGqLqyQ1H2PMbu783byopWu8M93caBOO5P1tdin08D37acT1HrlTOA6egPplA8zK78/z3i/0tvbK7vqoIY5u+T5S26WrhA6JlDKvWujcsTBbqezQL86RVuo2BcQ2s2UPe1V2ZjPpUiYceAVxs5WNM+819bNHamtNIpQP7W0OAshrxjHTL/C8hEHBtcIKQBB4TvoUPfTAqqpdqj6OKze5caf7r/RIEC0KV6MYs5wRb+qFAs4HEvZ4nTS/xgfZbcyuqZYiNxOSgAez/uWHPfZ4pn6NJlElpNerrf6zZPitwgU/A== 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:X-MS-Exchange-SenderADCheck; bh=h0X8ivA5RIbq1KQPqriIiFa4RMjlmtZOOxxBxMnHJjo=; b=nDihR0zGVqoKLFhyIvDzUDG9rnsy3UcskrNCf5hTT1uimLV8f7QjNjFB7A6gi7qb8I/GBEaSHYvaQmnV2P8YK2gYrMyWyE6lTYqfMLmVmMgg09bkiK2PEwCrLdc/4o+yzD95gQqBanhRT85qR5ACW1mPMpexOpcCRu0t4MfJVueUFO/+NDqaUOaZYVplT4FUJqJxZfckj2knDCjDoSAqIpFuw2PlbYmCOMsfAh3oYjKx570EISiJF7W+FeXyLIcxFDaW0xXjaHRfLdXfiSFom9KjXthxB1jM7qxXEDrSNy9VNR1rmVq69wUMdChbLlPAdJeILNYiOBfxyIvkFXieyg== 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=h0X8ivA5RIbq1KQPqriIiFa4RMjlmtZOOxxBxMnHJjo=; b=hW3N/R/xaJ+kP6FPiByM6y6LABiK0sGMrBuul2IFt84AdL2ty5lAE5Ex0YUUiuPfcNZzNPVQImlGnARpFRWofCU6z1Wbvv6Tt5CriLcslpTcxDUB7tSFxAwujXRCw2X1heOngLa/TeDLOaUThITPX/lXWLOyUSnUdFy62it9XqEWE0MTkY7WbN+mNYy9b/GrBHnOb56U1mz6hhrr5hYHRjhQiqAVvR5348X7Nw4txv/+Yhz0UJVLfKKqocP7JBCh+bC/pPjQ6PC2e4O1siaG9FKLdqotEGs2ITbBU1nHR8H646kmKUomf0OakEm7/Pz+RundVmOR19g9gA3KKvkqlQ== Authentication-Results: linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL1PR12MB5270.namprd12.prod.outlook.com (2603:10b6:208:31e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22; Mon, 7 Jun 2021 12:50:13 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::3d51:a3b9:8611:684e]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::3d51:a3b9:8611:684e%6]) with mapi id 15.20.4195.030; Mon, 7 Jun 2021 12:50:13 +0000 Date: Mon, 7 Jun 2021 09:50:12 -0300 From: Jason Gunthorpe To: Greg KH Cc: Leon Romanovsky , Doug Ledford , Kees Cook , Nathan Chancellor , Adit Ranadive , Ariel Elior , Christian Benvenuti , clang-built-linux@googlegroups.com, Dennis Dalessandro , Devesh Sharma , Gal Pressman , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Michal Kalderon , Mike Marciniszyn , Mustafa Ismail , Naresh Kumar PBS , Nelson Escobar , Nick Desaulniers , Potnuri Bharat Teja , Selvin Xavier , Shiraz Saleem , VMware PV-Drivers , Yishai Hadas , Zhu Yanjun Subject: Re: [PATCH rdma-next v1 10/15] RDMA/cm: Use an attribute_group on the ib_port_attribute intead of kobj's Message-ID: <20210607125012.GE1002214@nvidia.com> References: <00e578937f557954d240bc0856f45b3f752d6cba.1623053078.git.leonro@nvidia.com> <20210607121411.GC1002214@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Originating-IP: [47.55.113.94] X-ClientProxiedBy: BL1PR13CA0072.namprd13.prod.outlook.com (2603:10b6:208:2b8::17) To BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (47.55.113.94) by BL1PR13CA0072.namprd13.prod.outlook.com (2603:10b6:208:2b8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.9 via Frontend Transport; Mon, 7 Jun 2021 12:50:13 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lqEho-003Gzl-Cd; Mon, 07 Jun 2021 09:50:12 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c989740-9276-45ed-d109-08d929b2cabc X-MS-TrafficTypeDiagnostic: BL1PR12MB5270: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nXG/IKRqqB1+ziLvjZD1TXvelnv6NpEmaKj6zoYA/i+V74GcjvUA+i0AtsP0tMAqjUsCMXjQQ5UyChOpRRj0+aD5HKP3NQqpeC3W8Ay3r8QTPh1L/WiloYLt8K0FHklcaV5sE6PuxABF13Tzwx+p4cuUqsODmtyUqpPvJZUtlk8ZpMbgvYw8zJiJf1wEo9JJ6/sx20iWwjQkdvJN4dp9j7G078ZaqgIJUnNO7dA/i4/AyEme7saVjBi5A1EM6OPgjh3mxcwOXM1/sWYq3M7Z0mGh3QBEetRGoj0jKbcAB7IifvK8/9TvUmcLKfnbkwufVKlzOViBfKkaAskqf4c1bMt26477QHuR/aCdQbJGWiSS+e6XqIsAqQj6szzAY191MMo3XXMXNeS+7w49ep3HpoqfNEIOPalH8FCDHp8AWqXE6nNbhfBi+mgam0OPXWlG0mtcb5nYMhh6aBNcsoIzIJESr5IYZF8iEbPWNHiJdXSRWofuuqjeWFfbhKDEC6J61tVGhg4UNIF9K9dRSevbox3jjvA+vQLk7TfbIV1IKjKxRWEkXkh8bOhO8qwd1rfGGpFxuIKjbO5gt4avtvUlhAQMN3nRK40fcE5zKwBp2XE= 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)(376002)(136003)(346002)(396003)(39860400002)(366004)(478600001)(2616005)(36756003)(26005)(426003)(9746002)(4326008)(7416002)(9786002)(5660300002)(33656002)(86362001)(54906003)(316002)(66476007)(66946007)(83380400001)(8936002)(66556008)(186003)(6916009)(38100700002)(8676002)(2906002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?liVsfgCwHtF380dNal3j/MYTv4uwFYL+y9fqXIwJ+zg7ZL3PyDvljYL1QGag?= =?us-ascii?Q?v4YTv4/P/HOoRv8RC/iE/UrSUViSbxJ5FLgOvfqiNvmE3MRrZ16qn6VUM6CJ?= =?us-ascii?Q?0ql+srvifwha5AgGwLBQWAAOkzEzr0rfUOf1ckVO9fwpcwlCJTD/Kg0MKwTF?= =?us-ascii?Q?Yr4Up/vU6cpti+Jsw2zPCl97s8gLTrU2fUr2yAyyOrfVHih65Lb2RRd3kZGR?= =?us-ascii?Q?ZQd6liUtExs6nToFHCauxIhmlzstthxUx1LvNQmGOJWfWrtNmMhrRVIxo77q?= =?us-ascii?Q?D2O9vlJao9yMNxkJhXLRnJYFWy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ii?Q?PcFW/QtVKvA1JnLDuF0rr2eIVmuDAIuidZxFnVAJD4YygwK4KABrmhcDCNsy?= =?us-ascii?Q?OybNPpiL3RMc9rt/HF7L+sVfyljTRYdT4GwalM6c7fKHDNwYb4HLQgDowHNc?= =?us-ascii?Q?8ZWDFz3RzP9mVWplPY50RaCr?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c989740-9276-45ed-d109-08d929b2cabc X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2021 12:50:13.4513 (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: kxt9jfuJlYnuJus336vcM4EOIcswxKXJhi1q9gTEYe2/0zoZbv5OfXaAsQVB+1Hb X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5270 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 07, 2021 at 02:39:45PM +0200, Greg KH wrote: > On Mon, Jun 07, 2021 at 09:14:11AM -0300, Jason Gunthorpe wrote: > > On Mon, Jun 07, 2021 at 12:25:03PM +0200, Greg KH wrote: > > > On Mon, Jun 07, 2021 at 11:17:35AM +0300, Leon Romanovsky wrote: > > > > From: Jason Gunthorpe > > > > > > > > This code is trying to attach a list of counters grouped into 4 groups to > > > > the ib_port sysfs. Instead of creating a bunch of kobjects simply express > > > > everything naturally as an ib_port_attribute and add a single > > > > attribute_groups list. > > > > > > > > Remove all the naked kobject manipulations. > > > > > > Much nicer. > > > > > > But why do you need your counters to be atomic in the first place? What > > > are they counting that requires this? > > > > The write side of the counter is being updated from concurrent kernel > > threads without locking, so this is an atomic because the write side > > needs atomic_add(). > > So the atomic write forces a lock :( Of course, but a single atomic is cheaper than the double atomic in a full spinlock. > > Making them a naked u64 will cause significant corruption on the write > > side, and packet counters that are not accurate after quiescence are > > not very useful things. > > How "accurate" do these have to be? They have to be accurate. They are networking packet counters. What is the point of burning CPU cycles keeping track of inaccurate data? > And have you all tried them? I've used them over the years. This stuff is something like 15 years old now. > I'm pushing back here as I see a lot of atomics used for debugging > statistics for no good reason all over the place. Especially when > userspace just does not care. If userspace doesn't care then just delete the counter entirely. Reporting a wrong/misleading debugging counter data sounds just horrible to me. What good is any debug result you get from the counter if it has to be questioned because the counter is allowed to be wrong? ""The sender says it sent 7 packets, but the receivers debug counter reports only 6! I guess my bug is a lost packet in the network."" Jason