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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FCECC4332F for ; Tue, 10 May 2022 12:17:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241702AbiEJMVQ (ORCPT ); Tue, 10 May 2022 08:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241629AbiEJMU4 (ORCPT ); Tue, 10 May 2022 08:20:56 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57BF8F6891; Tue, 10 May 2022 05:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1652185019; x=1683721019; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=JJaaWuWc8sV2e51bEleyOQg6zUB2DlPf9YjM1Nke9to=; b=OA1GhaYqHFPwcNkqHyp/vz55cymG5OaITuzPr2HsYsyltsGb0GBZyM1l AfLl4fWe3SiHd6CBBN6SPJ/8i2aiO5a/Em9TBHV8woGHflsstrj5B8+fO AlaTTli7lp4zVAgvicLGXa6UA113DL2RhNQwvi/eIv+p08JPncawsL7dE g=; Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-01.qualcomm.com with ESMTP; 10 May 2022 05:16:59 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg05-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 05:16:58 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 10 May 2022 05:16:58 -0700 Received: from [10.216.42.221] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 10 May 2022 05:16:54 -0700 Message-ID: Date: Tue, 10 May 2022 17:46:50 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] dmabuf: ensure unique directory name for dmabuf stats Content-Language: en-US To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Greg KH CC: , , , , , , References: <1652178212-22383-1-git-send-email-quic_charante@quicinc.com> <039e1acc-8688-2e06-1b2a-1acbe813b91e@amd.com> From: Charan Teja Kalla In-Reply-To: <039e1acc-8688-2e06-1b2a-1acbe813b91e@amd.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks Christian for the inputs!! On 5/10/2022 5:05 PM, Christian König wrote: > >> And what's to keep the seconds field from also being the same? > > Well exporting two DMA-bufs with the same ino in the same nanosecond > should be basically impossible, but I would rather opt for using a 64bit > atomic in that function. > > This should be 100% UAPI compatible and even if we manage to create one > buffer ever ns we need ~500years to wrap around. I see that the inode->i_ctime->tv_sec is already defined as 64bit(time64_t tv_sec), hence used it. This way we don't need extra static atomic_t variable just to get a unique name. Just pasting excerpt from the reply posted to Greg about why this secs will always be a unique: with secs field added, to get the same inode-secs string, the uint should overflow in the same second which is impossible. Let me know If you still opt for atomic variable only.