Skip to content
Snippets Groups Projects
Select Git revision
  • e7a8e78bd4ad931660743bd2dbabd9170a715294
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

debugobjects.c

Blame
  • debugobjects.c 26.13 KiB
    /*
     * Generic infrastructure for lifetime debugging of objects.
     *
     * Started by Thomas Gleixner
     *
     * Copyright (C) 2008, Thomas Gleixner <tglx@linutronix.de>
     *
     * For licencing details see kernel-base/COPYING
     */
    
    #define pr_fmt(fmt) "ODEBUG: " fmt
    
    #include <linux/debugobjects.h>
    #include <linux/interrupt.h>
    #include <linux/sched.h>
    #include <linux/seq_file.h>
    #include <linux/debugfs.h>
    #include <linux/slab.h>
    #include <linux/hash.h>
    
    #define ODEBUG_HASH_BITS	14
    #define ODEBUG_HASH_SIZE	(1 << ODEBUG_HASH_BITS)
    
    #define ODEBUG_POOL_SIZE	1024
    #define ODEBUG_POOL_MIN_LEVEL	256
    
    #define ODEBUG_CHUNK_SHIFT	PAGE_SHIFT
    #define ODEBUG_CHUNK_SIZE	(1 << ODEBUG_CHUNK_SHIFT)
    #define ODEBUG_CHUNK_MASK	(~(ODEBUG_CHUNK_SIZE - 1))
    
    struct debug_bucket {
    	struct hlist_head	list;
    	raw_spinlock_t		lock;
    };
    
    static struct debug_bucket	obj_hash[ODEBUG_HASH_SIZE];
    
    static struct debug_obj		obj_static_pool[ODEBUG_POOL_SIZE] __initdata;
    
    static DEFINE_RAW_SPINLOCK(pool_lock);
    
    static HLIST_HEAD(obj_pool);
    
    static int			obj_pool_min_free = ODEBUG_POOL_SIZE;
    static int			obj_pool_free = ODEBUG_POOL_SIZE;
    static int			obj_pool_used;
    static int			obj_pool_max_used;
    static struct kmem_cache	*obj_cache;
    
    static int			debug_objects_maxchain __read_mostly;
    static int			debug_objects_fixups __read_mostly;
    static int			debug_objects_warnings __read_mostly;
    static int			debug_objects_enabled __read_mostly
    				= CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT;
    
    static struct debug_obj_descr	*descr_test  __read_mostly;
    
    static void free_obj_work(struct work_struct *work);
    static DECLARE_WORK(debug_obj_work, free_obj_work);
    
    static int __init enable_object_debug(char *str)
    {
    	debug_objects_enabled = 1;
    	return 0;
    }
    
    static int __init disable_object_debug(char *str)
    {
    	debug_objects_enabled = 0;
    	return 0;