Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3185700pxj; Mon, 7 Jun 2021 04:40:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiQtdrjGLMBjo4t0RHNNe++1oHiwkoKpW3hV8lTOoWpdQOJBKD4SPy4tAoYdfxA5PL3Es9 X-Received: by 2002:a05:6402:1911:: with SMTP id e17mr11643586edz.62.1623066004148; Mon, 07 Jun 2021 04:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623066004; cv=none; d=google.com; s=arc-20160816; b=WzcHkw7IuDyM4nKP2IjM64MiOPkDd8r0PLDGa7/Rb6jKu0Gp28q/VePSP7HiKYRgXw Zmf1TYOpE70snLisMuy4i5dyaKXrDCZIbKPUModhz9tzKgmINu606sFX1x4Lf3AkP8kE lhAY022kr8hX+FpLgs1ykbpa5Ew4i61XYH2G4t/j4isSJqfbadu+OMV6VTEnX5PbeujM xy1zwmuMWYb54UKq/pg+68nSyCU5OI40YtMIw6ZjGKd504zQ61A0EMlncyZenK6KXfg6 TzQ86YskrvftzMsDqzBq2tiAue8HnRBiOR8sp5NGj6CYKkUmpNmy74zuNY9+n8/RkCur ZHaA== 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=EUIaGV+GTU2Y6/oCirD600fG4HCd6yjM52CuEeahcx4=; b=WmfBBjFNyKOzmx2r8tobpThKRqagRDqJpDHkekE0DOBbVMIpuSb2r9o+iUntBdlhx4 86CuTR+bvND9FsB8HpBGhY6iN4toRLVvucRrUsRkS4v2rWfWHpR0Ah+SH7g2aHNQ6HrU Enhm7Ir+28WLDqJnVqrLTZliRk5wHCALD/ZXeWbTKewf1vS0QwF7SnGPEHvGZhIbkXP7 cwUGcnywfSlQTKWtVatRDBlKOFPTY2yKkInjUJ9K2oTUaqUp/Cg3DPwbyUt+hd4Q55iJ 0YDPcE5Qja25G/1IUWbBddEiMXpOn4y1miZVzziVps2N1TNZ+zKUS46765hTjyonHY4e JKTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gdkj+Vvh; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si13809132ejh.110.2021.06.07.04.39.41; Mon, 07 Jun 2021 04:40:04 -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=@kernel.org header.s=k20201202 header.b=Gdkj+Vvh; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231569AbhFGLjP (ORCPT + 99 others); Mon, 7 Jun 2021 07:39:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:50930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231497AbhFGLjM (ORCPT ); Mon, 7 Jun 2021 07:39:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 54B7661130; Mon, 7 Jun 2021 11:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623065841; bh=4Fjpri+KDpM8VFQjB0uGSbfPCZvhFsguE5r75Vv3ong=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Gdkj+VvhIGp6KXf13LwzmqUnHyVMCR5w7v63D1B50WPH5SEVF+DFWMCLg1lz6Va1K 5nIlG0rxIIwCDdoCaIM8n3uKjZBLWGRotEiXEgn5K8dOTrugGFJT3AejRVVrqW+a3o Kl3rpU/81Mr/Azzj/pmwJYt2eNwt0u+ZMl7r9g5a/p3aKEP9q8TJuwxzoJHZOLH4M8 itp3yCRW7fATq44rE42BXWTtLpAzk9x/YXqDX5QY6GDdZfW/6/jshBHCr3VFjK/qkh y14Ae5Eon42AXv9f/0pqCyEK05oTsNInAoiEofqrQxJppQJibrYv3n9hGpa1HwuvpR Dq17HJ1YRqyHg== Date: Mon, 7 Jun 2021 14:37:16 +0300 From: Leon Romanovsky To: Greg KH 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-kernel@vger.kernel.org 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. > 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. > It's just a userspace statistic counter, what relies on this being > exact? In kernel nothing, but I have no idea what userspace does with these counters. > > thanks, > > greg k-h