Skip to content
Snippets Groups Projects
Select Git revision
  • 7e1544ae4dda3222538b08eb2da3cf82e0ca90dc
  • 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

amdgpu_fb.c

Blame
    • Rex Zhu's avatar
      7e1544ae
      drm/amdgpu: fix null point error when rmmod amdgpu. · 7e1544ae
      Rex Zhu authored
      
      this bug happened when amdgpu load failed.
      
      [   75.740951] BUG: unable to handle kernel paging request at 00000000000031c0
      [   75.748167] IP: [<ffffffffa064a0e0>] amdgpu_fbdev_restore_mode+0x20/0x60 [amdgpu]
      [   75.755774] PGD 0
      
      [   75.759185] Oops: 0000 [#1] SMP
      [   75.762408] Modules linked in: amdgpu(OE-) ttm(OE) drm_kms_helper(OE) drm(OE) i2c_algo_bit(E) fb_sys_fops(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) rpcsec_gss_krb5(E) nfsv4(E) nfs(E) fscache(E) eeepc_wmi(E) asus_wmi(E) sparse_keymap(E) intel_rapl(E) snd_hda_codec_hdmi(E) snd_hda_codec_realtek(E) snd_hda_codec_generic(E) snd_hda_intel(E) snd_hda_codec(E) snd_hda_core(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) snd_hwdep(E) snd_pcm(E) snd_seq_midi(E) coretemp(E) kvm_intel(E) snd_seq_midi_event(E) snd_rawmidi(E) kvm(E) snd_seq(E) joydev(E) snd_seq_device(E) snd_timer(E) irqbypass(E) crct10dif_pclmul(E) crc32_pclmul(E) mei_me(E) ghash_clmulni_intel(E) snd(E) aesni_intel(E) mei(E) soundcore(E) aes_x86_64(E) shpchp(E) serio_raw(E) lrw(E) acpi_pad(E) gf128mul(E) glue_helper(E) ablk_helper(E) mac_hid(E)
      [   75.835574]  cryptd(E) parport_pc(E) ppdev(E) lp(E) nfsd(E) parport(E) auth_rpcgss(E) nfs_acl(E) lockd(E) grace(E) sunrpc(E) autofs4(E) hid_generic(E) usbhid(E) mxm_wmi(E) psmouse(E) e1000e(E) ptp(E) pps_core(E) ahci(E) libahci(E) wmi(E) video(E) i2c_hid(E) hid(E)
      [   75.858489] CPU: 5 PID: 1603 Comm: rmmod Tainted: G           OE   4.9.0-custom #2
      [   75.866183] Hardware name: System manufacturer System Product Name/Z170-A, BIOS 0901 08/31/2015
      [   75.875050] task: ffff88045d1bbb80 task.stack: ffffc90002de4000
      [   75.881094] RIP: 0010:[<ffffffffa064a0e0>]  [<ffffffffa064a0e0>] amdgpu_fbdev_restore_mode+0x20/0x60 [amdgpu]
      [   75.891238] RSP: 0018:ffffc90002de7d48  EFLAGS: 00010286
      [   75.896648] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000001
      [   75.903933] RDX: 0000000000000000 RSI: ffff88045d1bbb80 RDI: 0000000000000286
      [   75.911183] RBP: ffffc90002de7d50 R08: 0000000000000502 R09: 0000000000000004
      [   75.918449] R10: 0000000000000000 R11: 0000000000000001 R12: ffff880464bf0000
      [   75.925675] R13: ffffffffa0853000 R14: 0000000000000000 R15: 0000564e44f88210
      [   75.932980] FS:  00007f13d5400700(0000) GS:ffff880476540000(0000) knlGS:0000000000000000
      [   75.941238] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   75.947088] CR2: 00000000000031c0 CR3: 000000045fd0b000 CR4: 00000000003406e0
      [   75.954332] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   75.961566] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [   75.968834] Stack:
      [   75.970881]  ffff880464bf0000 ffffc90002de7d60 ffffffffa0636592 ffffc90002de7d80
      [   75.978454]  ffffffffa059015f ffff880464bf0000 ffff880464bf0000 ffffc90002de7da8
      [   75.986076]  ffffffffa0595216 ffff880464bf0000 ffff880460f4d000 ffffffffa0853000
      [   75.993692] Call Trace:
      [   75.996177]  [<ffffffffa0636592>] amdgpu_driver_lastclose_kms+0x12/0x20 [amdgpu]
      [   76.003700]  [<ffffffffa059015f>] drm_lastclose+0x2f/0xd0 [drm]
      [   76.009777]  [<ffffffffa0595216>] drm_dev_unregister+0x16/0xd0 [drm]
      [   76.016255]  [<ffffffffa0595944>] drm_put_dev+0x34/0x70 [drm]
      [   76.022139]  [<ffffffffa062f365>] amdgpu_pci_remove+0x15/0x20 [amdgpu]
      [   76.028800]  [<ffffffff81416499>] pci_device_remove+0x39/0xc0
      [   76.034661]  [<ffffffff81531caa>] __device_release_driver+0x9a/0x140
      [   76.041121]  [<ffffffff81531e58>] driver_detach+0xb8/0xc0
      [   76.046575]  [<ffffffff81530c95>] bus_remove_driver+0x55/0xd0
      [   76.052401]  [<ffffffff815325fc>] driver_unregister+0x2c/0x50
      [   76.058244]  [<ffffffff81416289>] pci_unregister_driver+0x29/0x90
      [   76.064466]  [<ffffffffa0596c5e>] drm_pci_exit+0x9e/0xb0 [drm]
      [   76.070507]  [<ffffffffa0796d71>] amdgpu_exit+0x1c/0x32 [amdgpu]
      [   76.076609]  [<ffffffff81104810>] SyS_delete_module+0x1a0/0x200
      [   76.082627]  [<ffffffff810e2b1a>] ? rcu_eqs_enter.isra.36+0x4a/0x50
      [   76.089001]  [<ffffffff8100392e>] do_syscall_64+0x6e/0x180
      [   76.094583]  [<ffffffff817e1d2f>] entry_SYSCALL64_slow_path+0x25/0x25
      [   76.101114] Code: 94 c0 c3 31 c0 5d c3 0f 1f 40 00 0f 1f 44 00 00 55 31 c0 48 89 e5 53 48 89 fb 48 c7 c7 1d 21 84 a0 e8 ab 77 b3 e0 e8 fc 8b d7 e0 <48> 8b bb c0 31 00 00 48 85 ff 74 09 e8 ff eb fc ff 85 c0 75 03
      [   76.121432] RIP  [<ffffffffa064a0e0>] amdgpu_fbdev_restore_mode+0x20/0x60 [amdgpu]
      
      Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      7e1544ae
      History
      drm/amdgpu: fix null point error when rmmod amdgpu.
      Rex Zhu authored
      
      this bug happened when amdgpu load failed.
      
      [   75.740951] BUG: unable to handle kernel paging request at 00000000000031c0
      [   75.748167] IP: [<ffffffffa064a0e0>] amdgpu_fbdev_restore_mode+0x20/0x60 [amdgpu]
      [   75.755774] PGD 0
      
      [   75.759185] Oops: 0000 [#1] SMP
      [   75.762408] Modules linked in: amdgpu(OE-) ttm(OE) drm_kms_helper(OE) drm(OE) i2c_algo_bit(E) fb_sys_fops(E) syscopyarea(E) sysfillrect(E) sysimgblt(E) rpcsec_gss_krb5(E) nfsv4(E) nfs(E) fscache(E) eeepc_wmi(E) asus_wmi(E) sparse_keymap(E) intel_rapl(E) snd_hda_codec_hdmi(E) snd_hda_codec_realtek(E) snd_hda_codec_generic(E) snd_hda_intel(E) snd_hda_codec(E) snd_hda_core(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) snd_hwdep(E) snd_pcm(E) snd_seq_midi(E) coretemp(E) kvm_intel(E) snd_seq_midi_event(E) snd_rawmidi(E) kvm(E) snd_seq(E) joydev(E) snd_seq_device(E) snd_timer(E) irqbypass(E) crct10dif_pclmul(E) crc32_pclmul(E) mei_me(E) ghash_clmulni_intel(E) snd(E) aesni_intel(E) mei(E) soundcore(E) aes_x86_64(E) shpchp(E) serio_raw(E) lrw(E) acpi_pad(E) gf128mul(E) glue_helper(E) ablk_helper(E) mac_hid(E)
      [   75.835574]  cryptd(E) parport_pc(E) ppdev(E) lp(E) nfsd(E) parport(E) auth_rpcgss(E) nfs_acl(E) lockd(E) grace(E) sunrpc(E) autofs4(E) hid_generic(E) usbhid(E) mxm_wmi(E) psmouse(E) e1000e(E) ptp(E) pps_core(E) ahci(E) libahci(E) wmi(E) video(E) i2c_hid(E) hid(E)
      [   75.858489] CPU: 5 PID: 1603 Comm: rmmod Tainted: G           OE   4.9.0-custom #2
      [   75.866183] Hardware name: System manufacturer System Product Name/Z170-A, BIOS 0901 08/31/2015
      [   75.875050] task: ffff88045d1bbb80 task.stack: ffffc90002de4000
      [   75.881094] RIP: 0010:[<ffffffffa064a0e0>]  [<ffffffffa064a0e0>] amdgpu_fbdev_restore_mode+0x20/0x60 [amdgpu]
      [   75.891238] RSP: 0018:ffffc90002de7d48  EFLAGS: 00010286
      [   75.896648] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000001
      [   75.903933] RDX: 0000000000000000 RSI: ffff88045d1bbb80 RDI: 0000000000000286
      [   75.911183] RBP: ffffc90002de7d50 R08: 0000000000000502 R09: 0000000000000004
      [   75.918449] R10: 0000000000000000 R11: 0000000000000001 R12: ffff880464bf0000
      [   75.925675] R13: ffffffffa0853000 R14: 0000000000000000 R15: 0000564e44f88210
      [   75.932980] FS:  00007f13d5400700(0000) GS:ffff880476540000(0000) knlGS:0000000000000000
      [   75.941238] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   75.947088] CR2: 00000000000031c0 CR3: 000000045fd0b000 CR4: 00000000003406e0
      [   75.954332] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   75.961566] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [   75.968834] Stack:
      [   75.970881]  ffff880464bf0000 ffffc90002de7d60 ffffffffa0636592 ffffc90002de7d80
      [   75.978454]  ffffffffa059015f ffff880464bf0000 ffff880464bf0000 ffffc90002de7da8
      [   75.986076]  ffffffffa0595216 ffff880464bf0000 ffff880460f4d000 ffffffffa0853000
      [   75.993692] Call Trace:
      [   75.996177]  [<ffffffffa0636592>] amdgpu_driver_lastclose_kms+0x12/0x20 [amdgpu]
      [   76.003700]  [<ffffffffa059015f>] drm_lastclose+0x2f/0xd0 [drm]
      [   76.009777]  [<ffffffffa0595216>] drm_dev_unregister+0x16/0xd0 [drm]
      [   76.016255]  [<ffffffffa0595944>] drm_put_dev+0x34/0x70 [drm]
      [   76.022139]  [<ffffffffa062f365>] amdgpu_pci_remove+0x15/0x20 [amdgpu]
      [   76.028800]  [<ffffffff81416499>] pci_device_remove+0x39/0xc0
      [   76.034661]  [<ffffffff81531caa>] __device_release_driver+0x9a/0x140
      [   76.041121]  [<ffffffff81531e58>] driver_detach+0xb8/0xc0
      [   76.046575]  [<ffffffff81530c95>] bus_remove_driver+0x55/0xd0
      [   76.052401]  [<ffffffff815325fc>] driver_unregister+0x2c/0x50
      [   76.058244]  [<ffffffff81416289>] pci_unregister_driver+0x29/0x90
      [   76.064466]  [<ffffffffa0596c5e>] drm_pci_exit+0x9e/0xb0 [drm]
      [   76.070507]  [<ffffffffa0796d71>] amdgpu_exit+0x1c/0x32 [amdgpu]
      [   76.076609]  [<ffffffff81104810>] SyS_delete_module+0x1a0/0x200
      [   76.082627]  [<ffffffff810e2b1a>] ? rcu_eqs_enter.isra.36+0x4a/0x50
      [   76.089001]  [<ffffffff8100392e>] do_syscall_64+0x6e/0x180
      [   76.094583]  [<ffffffff817e1d2f>] entry_SYSCALL64_slow_path+0x25/0x25
      [   76.101114] Code: 94 c0 c3 31 c0 5d c3 0f 1f 40 00 0f 1f 44 00 00 55 31 c0 48 89 e5 53 48 89 fb 48 c7 c7 1d 21 84 a0 e8 ab 77 b3 e0 e8 fc 8b d7 e0 <48> 8b bb c0 31 00 00 48 85 ff 74 09 e8 ff eb fc ff 85 c0 75 03
      [   76.121432] RIP  [<ffffffffa064a0e0>] amdgpu_fbdev_restore_mode+0x20/0x60 [amdgpu]
      
      Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    trace_stack.c 7.33 KiB
    /*
     * Copyright (C) 2008 Steven Rostedt <srostedt@redhat.com>
     *
     */
    #include <linux/stacktrace.h>
    #include <linux/kallsyms.h>
    #include <linux/seq_file.h>
    #include <linux/spinlock.h>
    #include <linux/uaccess.h>
    #include <linux/debugfs.h>
    #include <linux/ftrace.h>
    #include <linux/module.h>
    #include <linux/sysctl.h>
    #include <linux/init.h>
    #include <linux/fs.h>
    #include "trace.h"
    
    #define STACK_TRACE_ENTRIES 500
    
    static unsigned long stack_dump_trace[STACK_TRACE_ENTRIES+1] =
    	 { [0 ... (STACK_TRACE_ENTRIES)] = ULONG_MAX };
    static unsigned stack_dump_index[STACK_TRACE_ENTRIES];
    
    static struct stack_trace max_stack_trace = {
    	.max_entries		= STACK_TRACE_ENTRIES,
    	.entries		= stack_dump_trace,
    };
    
    static unsigned long max_stack_size;
    static raw_spinlock_t max_stack_lock =
    	(raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
    
    static int stack_trace_disabled __read_mostly;
    static DEFINE_PER_CPU(int, trace_active);
    static DEFINE_MUTEX(stack_sysctl_mutex);
    
    int stack_tracer_enabled;
    static int last_stack_tracer_enabled;
    
    static inline void check_stack(void)
    {
    	unsigned long this_size, flags;
    	unsigned long *p, *top, *start;
    	int i;
    
    	this_size = ((unsigned long)&this_size) & (THREAD_SIZE-1);
    	this_size = THREAD_SIZE - this_size;
    
    	if (this_size <= max_stack_size)
    		return;
    
    	/* we do not handle interrupt stacks yet */
    	if (!object_is_on_stack(&this_size))
    		return;
    
    	local_irq_save(flags);
    	__raw_spin_lock(&max_stack_lock);
    
    	/* a race could have already updated it */
    	if (this_size <= max_stack_size)
    		goto out;
    
    	max_stack_size = this_size;
    
    	max_stack_trace.nr_entries	= 0;
    	max_stack_trace.skip		= 3;
    
    	save_stack_trace(&max_stack_trace);
    
    	/*
    	 * Now find where in the stack these are.
    	 */
    	i = 0;
    	start = &this_size;
    	top = (unsigned long *)
    		(((unsigned long)start & ~(THREAD_SIZE-1)) + THREAD_SIZE);
    
    	/*
    	 * Loop through all the entries. One of the entries may
    	 * for some reason be missed on the stack, so we may
    	 * have to account for them. If they are all there, this
    	 * loop will only happen once. This code only takes place
    	 * on a new max, so it is far from a fast path.
    	 */
    	while (i < max_stack_trace.nr_entries) {
    		int found = 0;
    
    		stack_dump_index[i] = this_size;
    		p = start;
    
    		for (; p < top && i < max_stack_trace.nr_entries; p++) {
    			if (*p == stack_dump_trace[i]) {
    				this_size = stack_dump_index[i++] =
    					(top - p) * sizeof(unsigned long);
    				found = 1;
    				/* Start the search from here */
    				start = p + 1;
    			}
    		}
    
    		if (!found)
    			i++;
    	}
    
     out:
    	__raw_spin_unlock(&max_stack_lock);
    	local_irq_restore(flags);
    }
    
    static void
    stack_trace_call(unsigned long ip, unsigned long parent_ip)
    {
    	int cpu, resched;
    
    	if (unlikely(!ftrace_enabled || stack_trace_disabled))
    		return;
    
    	resched = ftrace_preempt_disable();
    
    	cpu = raw_smp_processor_id();
    	/* no atomic needed, we only modify this variable by this cpu */
    	if (per_cpu(trace_active, cpu)++ != 0)
    		goto out;
    
    	check_stack();
    
     out:
    	per_cpu(trace_active, cpu)--;
    	/* prevent recursion in schedule */
    	ftrace_preempt_enable(resched);
    }
    
    static struct ftrace_ops trace_ops __read_mostly =
    {
    	.func = stack_trace_call,
    };
    
    static ssize_t
    stack_max_size_read(struct file *filp, char __user *ubuf,
    		    size_t count, loff_t *ppos)
    {
    	unsigned long *ptr = filp->private_data;
    	char buf[64];
    	int r;
    
    	r = snprintf(buf, sizeof(buf), "%ld\n", *ptr);
    	if (r > sizeof(buf))
    		r = sizeof(buf);
    	return simple_read_from_buffer(ubuf, count, ppos, buf, r);
    }
    
    static ssize_t
    stack_max_size_write(struct file *filp, const char __user *ubuf,
    		     size_t count, loff_t *ppos)
    {
    	long *ptr = filp->private_data;
    	unsigned long val, flags;
    	char buf[64];
    	int ret;
    
    	if (count >= sizeof(buf))
    		return -EINVAL;
    
    	if (copy_from_user(&buf, ubuf, count))
    		return -EFAULT;
    
    	buf[count] = 0;
    
    	ret = strict_strtoul(buf, 10, &val);
    	if (ret < 0)
    		return ret;
    
    	local_irq_save(flags);
    	__raw_spin_lock(&max_stack_lock);
    	*ptr = val;
    	__raw_spin_unlock(&max_stack_lock);
    	local_irq_restore(flags);
    
    	return count;
    }
    
    static const struct file_operations stack_max_size_fops = {
    	.open		= tracing_open_generic,
    	.read		= stack_max_size_read,
    	.write		= stack_max_size_write,
    };
    
    static void *
    __next(struct seq_file *m, loff_t *pos)
    {
    	long n = *pos - 1;
    
    	if (n >= max_stack_trace.nr_entries || stack_dump_trace[n] == ULONG_MAX)
    		return NULL;
    
    	m->private = (void *)n;
    	return &m->private;
    }
    
    static void *
    t_next(struct seq_file *m, void *v, loff_t *pos)
    {
    	(*pos)++;
    	return __next(m, pos);
    }
    
    static void *t_start(struct seq_file *m, loff_t *pos)
    {
    	local_irq_disable();
    	__raw_spin_lock(&max_stack_lock);
    
    	if (*pos == 0)
    		return SEQ_START_TOKEN;
    
    	return __next(m, pos);
    }
    
    static void t_stop(struct seq_file *m, void *p)
    {
    	__raw_spin_unlock(&max_stack_lock);
    	local_irq_enable();
    }
    
    static int trace_lookup_stack(struct seq_file *m, long i)
    {
    	unsigned long addr = stack_dump_trace[i];
    
    	return seq_printf(m, "%pF\n", (void *)addr);
    }
    
    static void print_disabled(struct seq_file *m)
    {
    	seq_puts(m, "#\n"
    		 "#  Stack tracer disabled\n"
    		 "#\n"
    		 "# To enable the stack tracer, either add 'stacktrace' to the\n"
    		 "# kernel command line\n"
    		 "# or 'echo 1 > /proc/sys/kernel/stack_tracer_enabled'\n"
    		 "#\n");
    }
    
    static int t_show(struct seq_file *m, void *v)
    {
    	long i;
    	int size;
    
    	if (v == SEQ_START_TOKEN) {
    		seq_printf(m, "        Depth    Size   Location"
    			   "    (%d entries)\n"
    			   "        -----    ----   --------\n",
    			   max_stack_trace.nr_entries - 1);
    
    		if (!stack_tracer_enabled && !max_stack_size)
    			print_disabled(m);
    
    		return 0;
    	}
    
    	i = *(long *)v;
    
    	if (i >= max_stack_trace.nr_entries ||
    	    stack_dump_trace[i] == ULONG_MAX)
    		return 0;
    
    	if (i+1 == max_stack_trace.nr_entries ||
    	    stack_dump_trace[i+1] == ULONG_MAX)
    		size = stack_dump_index[i];
    	else
    		size = stack_dump_index[i] - stack_dump_index[i+1];
    
    	seq_printf(m, "%3ld) %8d   %5d   ", i, stack_dump_index[i], size);
    
    	trace_lookup_stack(m, i);
    
    	return 0;
    }
    
    static const struct seq_operations stack_trace_seq_ops = {
    	.start		= t_start,
    	.next		= t_next,
    	.stop		= t_stop,
    	.show		= t_show,
    };
    
    static int stack_trace_open(struct inode *inode, struct file *file)
    {
    	return seq_open(file, &stack_trace_seq_ops);
    }
    
    static const struct file_operations stack_trace_fops = {
    	.open		= stack_trace_open,
    	.read		= seq_read,
    	.llseek		= seq_lseek,
    	.release	= seq_release,
    };
    
    int
    stack_trace_sysctl(struct ctl_table *table, int write,
    		   struct file *file, void __user *buffer, size_t *lenp,
    		   loff_t *ppos)
    {
    	int ret;
    
    	mutex_lock(&stack_sysctl_mutex);
    
    	ret = proc_dointvec(table, write, file, buffer, lenp, ppos);
    
    	if (ret || !write ||
    	    (last_stack_tracer_enabled == !!stack_tracer_enabled))
    		goto out;
    
    	last_stack_tracer_enabled = !!stack_tracer_enabled;
    
    	if (stack_tracer_enabled)
    		register_ftrace_function(&trace_ops);
    	else
    		unregister_ftrace_function(&trace_ops);
    
     out:
    	mutex_unlock(&stack_sysctl_mutex);
    	return ret;
    }
    
    static __init int enable_stacktrace(char *str)
    {
    	stack_tracer_enabled = 1;
    	last_stack_tracer_enabled = 1;
    	return 1;
    }
    __setup("stacktrace", enable_stacktrace);
    
    static __init int stack_trace_init(void)
    {
    	struct dentry *d_tracer;
    
    	d_tracer = tracing_init_dentry();
    
    	trace_create_file("stack_max_size", 0644, d_tracer,
    			&max_stack_size, &stack_max_size_fops);
    
    	trace_create_file("stack_trace", 0444, d_tracer,
    			NULL, &stack_trace_fops);
    
    	if (stack_tracer_enabled)
    		register_ftrace_function(&trace_ops);
    
    	return 0;
    }
    
    device_initcall(stack_trace_init);