From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41E8CC47082 for ; Mon, 7 Jun 2021 12:08:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22F4C61249 for ; Mon, 7 Jun 2021 12:08:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230209AbhFGMKi (ORCPT ); Mon, 7 Jun 2021 08:10:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:40416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230227AbhFGMKh (ORCPT ); Mon, 7 Jun 2021 08:10:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CC51661249; Mon, 7 Jun 2021 12:08:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623067710; bh=paaH3iQ+5TS/ajt9upTenr9LFIEQSXfHeNWCORxZ058=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=smkIfRggyd0GC9wNAjW0pusmX4byoVwFg1plBd3NAdLvn8vU8EbKRVxllwnEY+1Lf DiWl8N9gGAqKfO9TzKVERfe8JHA0ZcA3WOOoweR0mr0jrQZ0ky45gHSPNquvW6kb+j Lg1vdB8Iz+vLEwpbWs9YmCKqsLdy6CrXge1GA45U= Date: Mon, 7 Jun 2021 14:08:27 +0200 From: Greg KH To: Leon Romanovsky Cc: Doug Ledford , Jason Gunthorpe , 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Mon, Jun 07, 2021 at 02:37:16PM +0300, Leon Romanovsky wrote: > On Mon, Jun 07, 2021 at 01:22:26PM +0200, Greg KH wrote: > > On Mon, Jun 07, 2021 at 01:51:36PM +0300, Leon Romanovsky 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? Given that they are just a > > > > statistic for userspace, making them be a u64 should work just the same, > > > > right? > > > > > > The statistic counters are per-port, while the cm.c flows run in > > > asynchronically in parallel for every CM connection. > > > > > > We need atomic variable to ensure that "write to u64" is not > > > interrupted. > > > > On what system is "write to u64" interruptable? > > On 32 bits, and yes, we have a customer who still uses such system. So you will see what, a "tear"? Or a stale value? > > As these are per-port, do multiple threads try to increment these at > > the same time? > > Yes, CM connection can be seen as thread. Bottom line everything in parallel. > > > And even if they do, what happens if one is 'dropped' somehow because of this? > > Probably nothing, we increment the statistics only. So you are hitting cache lines for no good reason, probably not a good idea, you are wasting cpu cycles for nothing :( thanks, greg k-h