Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp415701pxb; Thu, 21 Jan 2021 10:03:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5JmkNpOMbKPw995efay32vLyeEvDrxzx3aN3e9UU2LUO2NsxYBA9pM2cFiX7iSoqn5M4Q X-Received: by 2002:a50:e008:: with SMTP id e8mr243563edl.339.1611252187146; Thu, 21 Jan 2021 10:03:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611252187; cv=none; d=google.com; s=arc-20160816; b=BHU+8jsTALSb7cKB0/6gbHClnk3KaCjJ+ezyyt5eF9V51bBOon/o2f8yawIji5VE+e p4yJ2r2QG5pea55yuF2t+17IAPTK7Uf9+aKhwytCudcDBMU4XH1l0xPxvPc+dpMuS6QW BHale0DkW9KUGBJsePrHQQavYN4iefj9Gs4p25XNofAXXiKf3JLtWWJSnY0qMaLijGkb Ps1OhmFa+UKAnmrSwT10835/htab9U0u/MztN5pJyxuY1NE9Nm8GlOooTI8SEZ1bKZYW eNzRFLb4ByfR5ILEWkvSoVwgM2I6qFPpQyxvVzUfCFXjlwiqrP6b2mFi9jzgW7yxkke6 fRuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=j4qyNKroZf0PR1hUuEzsx/1WQ9PqO3whBh/bYKsXNk4=; b=vTDvMpsIOYh6Isva+T279vN3eheUpY2a8RdoCOn1IlVLBXukqCEUI7R5J216ELLjgM UYd7v7ZZXiiFsl/ZBv81XZhXQqPVVDvIGXlYvNRB8IYp8mM39KDL6Y1jRk1MRMU+VuDL 3Ohg04wr+lBkIY1EzzhQBCfgzWN03F2GcUikBBsuqQXheeSIo3tCm2J2/b/x4WMenWlZ ILmwcnmWU1NjYlLE9jP2S0BOYUDMRmVzbMY2G2rhAHWSam1fgQ+ogdxLJDkKZ4UmCcXy xOAYBiLT235lHBQtRIyV+HXLhQrf3c4WNeeEdzCIcVRLYaZWe0AJROlrQCe91jJz8jT/ Hy2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=NwrMlXcO; 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 gb19si2160855ejc.338.2021.01.21.10.02.39; Thu, 21 Jan 2021 10:03:07 -0800 (PST) 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=google header.b=NwrMlXcO; 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 S2389482AbhAUSCE (ORCPT + 99 others); Thu, 21 Jan 2021 13:02:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389473AbhAUSBw (ORCPT ); Thu, 21 Jan 2021 13:01:52 -0500 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12655C0613D6 for ; Thu, 21 Jan 2021 10:01:12 -0800 (PST) Received: by mail-io1-xd2b.google.com with SMTP id e22so5814821iom.5 for ; Thu, 21 Jan 2021 10:01:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=j4qyNKroZf0PR1hUuEzsx/1WQ9PqO3whBh/bYKsXNk4=; b=NwrMlXcOlysV4djOofPixbwvOb/eBpqs+bb7+bWOAoZNWmZReC52iZGxNDK9o01pX8 /qLR8LIa+yMXpxbfxe8xVuck43q5hxfGQ32mw0u9aNYHiQMhWh7cqAcCHltql3kPsNho 5ZYHbyKB6Vfoo1syuKP5tlH0NP7+iz4Y/xXjs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=j4qyNKroZf0PR1hUuEzsx/1WQ9PqO3whBh/bYKsXNk4=; b=R/uOWlfHH9H7gplGzYKb2juvn01wt0rc2SbF5naRaHHVHgc9EBS40iZmowU8tPn6zv VmeNupVQTb6Iw11JpkEBIdqMIridFjtYZ2BhpnvvPVL11Qthhmk40yyx1O7OnpfWJBuz LIlvqweJDkIpeu5S04CN4kCi1hmtfT1LI1P2naTqhLDAIPAVWrpeGZkyCKYs4Qndz8HX EkiifsaW+nxJWDNEyNBQJsZwFlRDZF7g3qpXJAcUSmoVGCkJTgqZAQpPlz1pO9bg0vtE ux9HqYJyI6fa1VCnqpVSwzZsY835275OZ2Oia9JiQB4wyw6J/s0R5Kph6czzNz1NKeVe mS0g== X-Gm-Message-State: AOAM532x0c9Ot0FAg0McWz7KTsbZLckR0tQ/brVPDfW+1majDzKW9i8s yRDwsMRaW0yeqfgxjW+WRzZ/6w== X-Received: by 2002:a92:cb47:: with SMTP id f7mr778660ilq.169.1611252071329; Thu, 21 Jan 2021 10:01:11 -0800 (PST) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id s10sm2888397iob.4.2021.01.21.10.01.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Jan 2021 10:01:10 -0800 (PST) Subject: Re: rpc_xprt_debugfs_register() - atomic_inc_return() usage To: Trond Myklebust , "Anna.Schumaker@netapp.com" Cc: "bfields@fieldses.org" , "linux-nfs@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "davem@davemloft.net" , "kuba@kernel.org" , "chuck.lever@oracle.com" , "netdev@vger.kernel.org" , Shuah Khan References: <06c8f6ff-f821-e909-d40c-9de98657729f@linuxfoundation.org> <020aee05c808b3725db5679967406a918840f86f.camel@hammerspace.com> From: Shuah Khan Message-ID: <5952caee-edb4-e9ec-6621-fb50cfe3384f@linuxfoundation.org> Date: Thu, 21 Jan 2021 11:01:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <020aee05c808b3725db5679967406a918840f86f.camel@hammerspace.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/21/21 10:56 AM, Trond Myklebust wrote: > On Wed, 2021-01-20 at 16:52 -0700, Shuah Khan wrote: >> Hi Anna and Trond, >> >> I came across the following while reviewing atomic_inc_return() >> usages >> that cast return value to unsigned >> >> rpc_xprt_debugfs_register()'s atomic_inc_return() usage looks a bit >> odd. >> >> - cur_id isn't initialized >> - id = (unsigned int)atomic_inc_return(&cur_id); >> >> Please note that id is int. Is it expected that cur_id could >> overflow? >> Is there a maximum limit for this value? >> > > Yes, we do expect cur_id to eventually overflow (once you have created > 2 billion RPC client instances), however the atomic increment > operations are expected to handle this correctly according to the > maintainers (I already asked them in a different context). Furthermore, > the code itself doesn't care about strict sequentiality. All it wants > from the counter is uniqueness, with that uniqueness condition actually > being enforced by the subsequent debugfs_create_file() call. > > IOW: I don't think this is a real problem. > Great. Thank you for a detailed explanation. -- Shuah