Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3225924pxj; Mon, 7 Jun 2021 05:41:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBnQnUr0U191barkkxDjFzzzQGmLmgh2skSnqfFBv/HZnxMgAyTLtwe6jm78G6UaoVpqlS X-Received: by 2002:a17:906:6712:: with SMTP id a18mr15302294ejp.334.1623069669600; Mon, 07 Jun 2021 05:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623069669; cv=none; d=google.com; s=arc-20160816; b=si6rgmQupCtETtSFksERRBaDqGOYrj/X3F2SQycNon+SgwA0EfgKm1FpJJsjHw69s0 nQyaKPocEqKMoTYiuZ1SMp5fzKoQO7We6YaLSQrM8mEiz5vpOauB0dIEAbTnXYNkvkAs jDp16aPif0nKInLHCWk3muSOil4moMsnJZfRyBBCN+QTRpr59XAmWlv4ukA9oeRCyy4p j9AnfX1oW+MKiQLO6TktdIAjUWMVawQcGQuBS7VN+yPxPG7nAHCWrJlo151LAqv6C9C5 154YUSOGypFI+9NIK9u0iG8WOaTQTrfuxrhmAgTmCcdPG3BN9nlu03N6QDPSeQLynNZT PfpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MLXBEkrHHTUP8huh+hMH/0K8COmKfBbYzFzmywMTH5Q=; b=mjQHJxTcfreI/lep1QW8UDXxkA7wEMIaX4+ZgBrQk2W5UId3kPlBTV54gp6lVdADDF 2V8DZ0Be8YLy2RP3Zi8e+PO3Eh3+yPB7O7VD3DbfBjdJX7rMEUbiamiOcUAdeQCWHHXG 2YoXTbA5KYkcOfRhwx80SGJ5d4lNMHlsPrO/2vmYV6qvGL7B9S09xpJqOxjLOajNQiQ7 vpUbUQQ0zpY1D7WJkNb7cVXp8CH5lvUDRc2uxdSFFL4VoyVLWSHTc/eJzakuP0kcghN8 mOET8EcWgrsKw/3T7FiQfiOhpEzu7J6DwdMWR3mA8vNqjCgbIa7Kb1O3f9MlWwTDbCv+ hTOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FdktRMOh; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id be14si12364106edb.452.2021.06.07.05.40.46; Mon, 07 Jun 2021 05:41:09 -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=@linuxfoundation.org header.s=korg header.b=FdktRMOh; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbhFGMlk (ORCPT + 99 others); Mon, 7 Jun 2021 08:41:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:57664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbhFGMlj (ORCPT ); Mon, 7 Jun 2021 08:41:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9E4EB611C0; Mon, 7 Jun 2021 12:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623069588; bh=Zjlt55KMswnh9QqGbwu3mbMkjV9KlBZv59wVoY8s6lo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FdktRMOhRdqo8mujxRH7TjuCV5c13oGNlAG8M+c43vJUQwVFxmhDvlaltSIq2PdsU x4bExb/WGg371tivgQcy3STYNmtaUq2RKKIvRjV5g/qyrQhWwFoHRNHJYbZR/o1zEy vox2wktMQMExdVNmV5EVzN2lc8zOLzJRdFyghS/A= Date: Mon, 7 Jun 2021 14:39:45 +0200 From: Greg KH To: Jason Gunthorpe 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: References: <00e578937f557954d240bc0856f45b3f752d6cba.1623053078.git.leonro@nvidia.com> <20210607121411.GC1002214@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210607121411.GC1002214@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 :( > 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? And have you all tried them? 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. thanks, greg k-h