From patchwork Wed May 7 00:10:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "T.J. Mercier" X-Patchwork-Id: 888431 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A3BCBA2D for ; Wed, 7 May 2025 00:10:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746576647; cv=none; b=S3bfCjSF/CHHshsN/NfRLW0O1WBhGItnAoZYsOyPMLGZQzbWBV1gDchsMcqmRdkpKYm9iqw2EnpWHycDcgcPndf+cLsQMkvISELvGqg3ZQYFy4q/sH+TRJ+6m0XaK/PnvDLO5DnZZ+CeUkmDiu/f0uQcFm8CEqE7BCL8gY0CvfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746576647; c=relaxed/simple; bh=ENt9bNqDrtAazaMY+B4/iaikxMlx71ALLPLjwDEqI+c=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JAw8FjMC9woYVqsQoF7lXVv+A1mck/2AZx3tGTNwf/ubU6OxQY+5BT4xntm+2bqBYROwguzUwumdgXKziVXd7vJeM6x6BWcrkuIBRZlZPeqKCsCRfBoRQnGX8itGsTU2SWqnQqEf2MnEcdtIZBjJFXb5Ure/5IaXEymTZNqRw8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--tjmercier.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=sAmHL/F/; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--tjmercier.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sAmHL/F/" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2ff6aaa18e8so4886974a91.1 for ; Tue, 06 May 2025 17:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1746576645; x=1747181445; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=3AT/BLkjp9kSyaWDX07QeDnXSY64MOvBoRMn6GL7z2E=; b=sAmHL/F/3ckILytdC4hjDMZHP14weZK2Dz9p8Wd4lUx+uvPhzJCMGV/BCtzukuYO3D hosfkplEQSEdYt5kVrFzKhNhKB3h6jJgHb+DFl4RP/jULDWPJW9oNWSJ7u0I7xCsdW7r dOI74COjC/BCdH/KD3MWSrnHnakhiB9+m6ydJKJdTRteJ20TtO1XH/8QPCtoIgo6dKfQ qAPz8n6KZQjLgGKnkCkfkwm7fVmCigVr+TrAirlefTtcKBqGL/g2pN9xmnyoLrIE9qyQ 2Ug/AUbsohR/Wy3HTfER5XMVF5OJRcVm+M0dVoeflN27bKJcHCHYHsIVW+SDQowHcY8v Y+vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746576645; x=1747181445; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=3AT/BLkjp9kSyaWDX07QeDnXSY64MOvBoRMn6GL7z2E=; b=c8UDqLYnVm8rVq98c0JnjuYEYDmn5Zud8lZBlyH/Vp8u8fyf5lVS6u4xnZ/pkh6bmu viB6nGLSMkVatIyomIQ3O07iQoi/rJYwJotFERSMl+G2dAsoMxZfA98p9hcGKRacrgdU b2ok6lCiyf6AuZG3RAkYKnPNfRWUiptpQlDqpQvUajFhTqE3eE75R97p+DQy9C+9jRdQ +dCOcksjf5ZNRg3lnHIlQ+KnETEz0Xflg/m2O8F/PTPUXagSaOdGzLN4dE1r6sXFzLt+ /O6sWRB8n+8xMtpNsQVeRyNDh48lpvbBqD+qu3iHud7wdbuB7A369dF6+PatTfhI3WNR AIOQ== X-Forwarded-Encrypted: i=1; AJvYcCV1ZIkXDiEWVZfqcHRfIT3YRHoQ17qvP4VlqvengK8Eepk6g/SjoJXSOlglaepQRIx3RKt66lzp581jYg==@vger.kernel.org X-Gm-Message-State: AOJu0YxjLl36ki7aO3trbr860XeultEQNzgFwJjadvKbEfcuuRtcB1Hg /kjQvclWt9Xfae3SlFr5uZaE/t05xuASQ3euF8bRArxaV3Pcu37aNlCOk/R/SJu5+a0PvlFFi1z dChw6i98koCJ1Ow== X-Google-Smtp-Source: AGHT+IGjv/c2fzF3ZsIcOt5Mn1/YxqtlksyqIqxhrRJxhS2Uqg6AkhPc6dULFKkD5F2xqt9stbeixjUXT9WMVA0= X-Received: from pji12.prod.google.com ([2002:a17:90b:3fcc:b0:2fc:c98:ea47]) (user=tjmercier job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:e7d1:b0:2fc:3264:3666 with SMTP id 98e67ed59e1d1-30aac29bfd7mr1774601a91.30.1746576645059; Tue, 06 May 2025 17:10:45 -0700 (PDT) Date: Wed, 7 May 2025 00:10:32 +0000 In-Reply-To: <20250507001036.2278781-1-tjmercier@google.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250507001036.2278781-1-tjmercier@google.com> X-Mailer: git-send-email 2.49.0.1045.g170613ef41-goog Message-ID: <20250507001036.2278781-2-tjmercier@google.com> Subject: [PATCH bpf-next v3 1/5] dma-buf: Rename debugfs symbols From: "T.J. Mercier" To: sumit.semwal@linaro.org, christian.koenig@amd.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, skhan@linuxfoundation.org, alexei.starovoitov@gmail.com, song@kernel.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, android-mm@google.com, simona@ffwll.ch, eddyz87@gmail.com, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, jolsa@kernel.org, mykolal@fb.com, "T.J. Mercier" Rename the debugfs list and mutex so it's clear they are now usable without the need for CONFIG_DEBUG_FS. The list will always be populated to support the creation of a BPF iterator for dmabufs. Signed-off-by: T.J. Mercier Reviewed-by: Christian König --- drivers/dma-buf/dma-buf.c | 40 +++++++++++++++------------------------ include/linux/dma-buf.h | 2 -- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 5baa83b85515..8d151784e302 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -35,35 +35,25 @@ static inline int is_dma_buf_file(struct file *); -#if IS_ENABLED(CONFIG_DEBUG_FS) -static DEFINE_MUTEX(debugfs_list_mutex); -static LIST_HEAD(debugfs_list); +static DEFINE_MUTEX(dmabuf_list_mutex); +static LIST_HEAD(dmabuf_list); -static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf) +static void __dma_buf_list_add(struct dma_buf *dmabuf) { - mutex_lock(&debugfs_list_mutex); - list_add(&dmabuf->list_node, &debugfs_list); - mutex_unlock(&debugfs_list_mutex); + mutex_lock(&dmabuf_list_mutex); + list_add(&dmabuf->list_node, &dmabuf_list); + mutex_unlock(&dmabuf_list_mutex); } -static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf) +static void __dma_buf_list_del(struct dma_buf *dmabuf) { if (!dmabuf) return; - mutex_lock(&debugfs_list_mutex); + mutex_lock(&dmabuf_list_mutex); list_del(&dmabuf->list_node); - mutex_unlock(&debugfs_list_mutex); + mutex_unlock(&dmabuf_list_mutex); } -#else -static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf) -{ -} - -static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf) -{ -} -#endif static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen) { @@ -115,7 +105,7 @@ static int dma_buf_file_release(struct inode *inode, struct file *file) if (!is_dma_buf_file(file)) return -EINVAL; - __dma_buf_debugfs_list_del(file->private_data); + __dma_buf_list_del(file->private_data); return 0; } @@ -689,7 +679,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) file->f_path.dentry->d_fsdata = dmabuf; dmabuf->file = file; - __dma_buf_debugfs_list_add(dmabuf); + __dma_buf_list_add(dmabuf); return dmabuf; @@ -1630,7 +1620,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused) size_t size = 0; int ret; - ret = mutex_lock_interruptible(&debugfs_list_mutex); + ret = mutex_lock_interruptible(&dmabuf_list_mutex); if (ret) return ret; @@ -1639,7 +1629,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused) seq_printf(s, "%-8s\t%-8s\t%-8s\t%-8s\texp_name\t%-8s\tname\n", "size", "flags", "mode", "count", "ino"); - list_for_each_entry(buf_obj, &debugfs_list, list_node) { + list_for_each_entry(buf_obj, &dmabuf_list, list_node) { ret = dma_resv_lock_interruptible(buf_obj->resv, NULL); if (ret) @@ -1676,11 +1666,11 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused) seq_printf(s, "\nTotal %d objects, %zu bytes\n", count, size); - mutex_unlock(&debugfs_list_mutex); + mutex_unlock(&dmabuf_list_mutex); return 0; error_unlock: - mutex_unlock(&debugfs_list_mutex); + mutex_unlock(&dmabuf_list_mutex); return ret; } diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 36216d28d8bd..8ff4add71f88 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -370,10 +370,8 @@ struct dma_buf { */ struct module *owner; -#if IS_ENABLED(CONFIG_DEBUG_FS) /** @list_node: node for dma_buf accounting and debugging. */ struct list_head list_node; -#endif /** @priv: exporter specific private data for this buffer object. */ void *priv;