Skip to contentSkip to conversation

sync_file: get rid of internal reference count.

PATCH In review Dave Airlie 3 participants 3 messages Apr 11, 2017 – Apr 12, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sync_file: get rid of internal reference count.

From: Dave Airlie <[email protected]>

sync_file uses the reference count of the file, the internal kref was never getting moved past 1.

We can reintroduce this if we decide we need it later.

---
 drivers/dma-buf/sync_file.c | 13 ++-----------
 include/linux/sync_file.h   |  1 -
 2 files changed, 2 insertions(+), 12 deletions(-)
drivers/dma-buf/sync_file.c +2 -11
index 2321035..dc89b1d 100644
@@ -41,8 +41,6 @@ static struct sync_file *sync_file_alloc(void)
 	if (IS_ERR(sync_file->file))
 		goto err;
 
-	kref_init(&sync_file->kref);
-
 	init_waitqueue_head(&sync_file->wq);
 
 	INIT_LIST_HEAD(&sync_file->cb.node);
@@ -277,22 +275,15 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
 
 }
 
-static void sync_file_free(struct kref *kref)
+static int sync_file_release(struct inode *inode, struct file *file)
 {
-	struct sync_file *sync_file = container_of(kref, struct sync_file,
-						     kref);
+	struct sync_file *sync_file = file->private_data;
 
 	if (test_bit(POLL_ENABLED, &sync_file->fence->flags))
 		dma_fence_remove_callback(sync_file->fence, &sync_file->cb);
 	dma_fence_put(sync_file->fence);
 	kfree(sync_file);
-}
-
-static int sync_file_release(struct inode *inode, struct file *file)
-{
-	struct sync_file *sync_file = file->private_data;
 
-	kref_put(&sync_file->kref, sync_file_free);
 	return 0;
 }
 
include/linux/sync_file.h +0 -1
index 3e3ab84..4fa06c1 100644
@@ -33,7 +33,6 @@
  */
 struct sync_file {
 	struct file		*file;
-	struct kref		kref;
 	char			name[32];
 #ifdef CONFIG_DEBUG_FS
 	struct list_head	sync_file_list;
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Dave Airlie

From: Dave Airlie <[email protected]>

sync_file uses the reference count of the file, the internal kref was never getting moved past 1.

We can reintroduce this if we decide we need it later.

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
In reply to Dave Airlie
url: https://github.com/0day-ci/linux/commits/Dave-Airlie/sync_file-get-rid-of-internal-reference-count/20170412-102049 reproduce: make htmldocs

Hi Dave,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.11-rc6 next-20170411]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Dave-Airlie/sync_file-get-rid-of-internal-reference-count/20170412-102049
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

include/linux/init.h:1: warning: no structured comments found
kernel/sched/core.c:2085: warning: No description found for parameter 'rf' kernel/sched/core.c:2085: warning: Excess function parameter 'cookie' description in 'try_to_wake_up_local' include/linux/kthread.h:26: warning: Excess function parameter '...' description in 'kthread_create' kernel/sys.c:1: warning: no structured comments found
include/linux/device.h:969: warning: No description found for parameter 'dma_ops' drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found

>> include/linux/sync_file.h:46: warning: Excess struct/union/enum/typedef member 'kref' description in 'sync_file'

include/linux/iio/iio.h:597: warning: No description found for parameter 'trig_readonly' include/linux/iio/trigger.h:151: warning: No description found for parameter 'indio_dev' include/linux/iio/trigger.h:151: warning: No description found for parameter 'trig' include/linux/device.h:970: warning: No description found for parameter 'dma_ops' drivers/regulator/core.c:1467: warning: Excess function parameter 'ret' description in 'regulator_dev_lookup' include/drm/drm_drv.h:438: warning: No description found for parameter 'open' include/drm/drm_drv.h:438: warning: No description found for parameter 'preclose' include/drm/drm_drv.h:438: warning: No description found for parameter 'postclose' include/drm/drm_drv.h:438: warning: No description found for parameter 'lastclose' include/drm/drm_drv.h:438: warning: No description found for parameter 'set_busid' include/drm/drm_drv.h:438: warning: No description found for parameter 'irq_handler' include/drm/drm_drv.h:438: warning: No description found for parameter 'irq_preinstall' include/drm/drm_drv.h:438: warning: No description found for parameter 'irq_postinstall' include/drm/drm_drv.h:438: warning: No description found for parameter 'irq_uninstall' include/drm/drm_drv.h:438: warning: No description found for parameter 'debugfs_init' include/drm/drm_drv.h:438: warning: No description found for parameter 'debugfs_cleanup' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_open_object' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_close_object' include/drm/drm_drv.h:438: warning: No description found for parameter 'prime_handle_to_fd' include/drm/drm_drv.h:438: warning: No description found for parameter 'prime_fd_to_handle' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_prime_export' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_prime_import' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_prime_pin' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_prime_unpin' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_prime_res_obj' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_prime_get_sg_table' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_prime_import_sg_table' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_prime_vmap' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_prime_vunmap' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_prime_mmap' include/drm/drm_drv.h:438: warning: No description found for parameter 'gem_vm_ops' include/drm/drm_drv.h:438: warning: No description found for parameter 'major' include/drm/drm_drv.h:438: warning: No description found for parameter 'minor' include/drm/drm_drv.h:438: warning: No description found for parameter 'patchlevel' include/drm/drm_drv.h:438: warning: No description found for parameter 'name' include/drm/drm_drv.h:438: warning: No description found for parameter 'desc' include/drm/drm_drv.h:438: warning: No description found for parameter 'date' include/drm/drm_drv.h:438: warning: No description found for parameter 'driver_features' include/drm/drm_drv.h:438: warning: No description found for parameter 'ioctls' include/drm/drm_drv.h:438: warning: No description found for parameter 'num_ioctls' include/drm/drm_drv.h:438: warning: No description found for parameter 'fops' include/drm/drm_color_mgmt.h:1: warning: no structured comments found drivers/gpu/drm/drm_fb_cma_helper.c:557: warning: Excess function parameter 'num_crtc' description in 'drm_fbdev_cma_init' drivers/gpu/drm/drm_fb_cma_helper.c:558: warning: Excess function parameter 'num_crtc' description in 'drm_fbdev_cma_init' drivers/gpu/drm/i915/intel_lpe_audio.c:342: warning: No description found for parameter 'pipe' drivers/gpu/drm/i915/intel_lpe_audio.c:342: warning: No description found for parameter 'dp_output' drivers/gpu/drm/i915/intel_lpe_audio.c:342: warning: No description found for parameter 'link_rate' drivers/gpu/drm/i915/intel_lpe_audio.c:343: warning: No description found for parameter 'pipe' drivers/gpu/drm/i915/intel_lpe_audio.c:343: warning: No description found for parameter 'dp_output' drivers/gpu/drm/i915/intel_lpe_audio.c:343: warning: No description found for parameter 'link_rate' drivers/media/dvb-core/dvb_frontend.h:677: warning: No description found for parameter 'refcount' Documentation/core-api/assoc_array.rst:13: WARNING: Enumerated list ends without a blank line; unexpected unindent. Documentation/doc-guide/sphinx.rst:110: ERROR: Unknown target name: "sphinx c domain". kernel/sched/fair.c:7616: WARNING: Inline emphasis start-string without end-string. kernel/time/timer.c:1200: ERROR: Unexpected indentation.
kernel/time/timer.c:1202: ERROR: Unexpected indentation.
kernel/time/timer.c:1203: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:122: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:125: ERROR: Unexpected indentation.
include/linux/wait.h:127: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/time/hrtimer.c:990: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/signal.c:322: WARNING: Inline literal start-string without end-string. include/linux/iio/iio.h:219: ERROR: Unexpected indentation.
include/linux/iio/iio.h:220: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/iio/iio.h:226: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/iio/industrialio-core.c:638: ERROR: Unknown target name: "iio_val". drivers/iio/industrialio-core.c:645: ERROR: Unknown target name: "iio_val". drivers/message/fusion/mptbase.c:5051: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/tty/serial/serial_core.c:1898: WARNING: Definition list ends without a blank line; unexpected unindent. include/linux/regulator/driver.h:271: ERROR: Unknown target name: "regulator_regmap_x_voltage". include/linux/spi/spi.h:369: ERROR: Unexpected indentation.
drivers/usb/core/message.c:478: ERROR: Unexpected indentation.
drivers/usb/core/message.c:479: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_type". Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_dir". Documentation/driver-api/usb.rst:623: ERROR: Unknown target name: "usb_recip". Documentation/driver-api/usb.rst:689: ERROR: Unknown target name: "usbdevfs_urb_type". sound/soc/soc-core.c:2670: ERROR: Unknown target name: "snd_soc_daifmt".
sound/core/jack.c:312: ERROR: Unknown target name: "snd_jack_btn".
WARNING: dvipng command 'dvipng' cannot be run (needed for math display), check the imgmath_dvipng setting

vim +46 include/linux/sync_file.h

d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  30   * @wq:			wait queue for fence signaling
a02b9dc90 include/linux/sync_file.h           Gustavo Padovan 2016-08-05  31   * @fence:		fence with the fences in the sync_file
a02b9dc90 include/linux/sync_file.h           Gustavo Padovan 2016-08-05  32   * @cb:			fence callback information
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  33   */
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  34  struct sync_file {
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  35  	struct file		*file;
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  36  	char			name[32];
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  37  #ifdef CONFIG_DEBUG_FS
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  38  	struct list_head	sync_file_list;
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  39  #endif
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  40  
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  41  	wait_queue_head_t	wq;
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  42  
f54d18670 include/linux/sync_file.h           Chris Wilson    2016-10-25  43  	struct dma_fence	*fence;
f54d18670 include/linux/sync_file.h           Chris Wilson    2016-10-25  44  	struct dma_fence_cb cb;
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  45  };
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28 @46  
f54d18670 include/linux/sync_file.h           Chris Wilson    2016-10-25  47  #define POLL_ENABLED DMA_FENCE_FLAG_USER_BITS
e24165537 include/linux/sync_file.h           Gustavo Padovan 2016-08-05  48  
f54d18670 include/linux/sync_file.h           Chris Wilson    2016-10-25  49  struct sync_file *sync_file_create(struct dma_fence *fence);
f54d18670 include/linux/sync_file.h           Chris Wilson    2016-10-25  50  struct dma_fence *sync_file_get_fence(int fd);
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  51  
d4cab38e1 drivers/staging/android/sync_file.h Gustavo Padovan 2016-04-28  52  #endif /* _LINUX_SYNC_H */

:::::: The code at line 46 was first introduced by commit
:::::: d4cab38e153d62ecd502645390c0289c1b8337df staging/android: prepare sync_file for de-staging

:::::: TO: Gustavo Padovan <[email protected]> :::::: CC: Greg Kroah-Hartman <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel