]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blob - rt-patches/0197-sysfs-Add-sys-kernel-realtime-entry.patch
rt_patches: required rebase due to printk change
[hercules2020/nv-tegra/linux-4.4.git] / rt-patches / 0197-sysfs-Add-sys-kernel-realtime-entry.patch
1 From deccf9bb375893744a85aa5a49817c1e5b8dbce8 Mon Sep 17 00:00:00 2001
2 From: Clark Williams <williams@redhat.com>
3 Date: Sat, 30 Jul 2011 21:55:53 -0500
4 Subject: [PATCH 197/366] sysfs: Add /sys/kernel/realtime entry
5
6 Add a /sys/kernel entry to indicate that the kernel is a
7 realtime kernel.
8
9 Clark says that he needs this for udev rules, udev needs to evaluate
10 if its a PREEMPT_RT kernel a few thousand times and parsing uname
11 output is too slow or so.
12
13 Are there better solutions? Should it exist and return 0 on !-rt?
14
15 Signed-off-by: Clark Williams <williams@redhat.com>
16 Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
17 ---
18  kernel/ksysfs.c | 12 ++++++++++++
19  1 file changed, 12 insertions(+)
20
21 diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
22 index e83b264..c0e08d1 100644
23 --- a/kernel/ksysfs.c
24 +++ b/kernel/ksysfs.c
25 @@ -136,6 +136,15 @@ KERNEL_ATTR_RO(vmcoreinfo);
26  
27  #endif /* CONFIG_KEXEC_CORE */
28  
29 +#if defined(CONFIG_PREEMPT_RT_FULL)
30 +static ssize_t  realtime_show(struct kobject *kobj,
31 +                             struct kobj_attribute *attr, char *buf)
32 +{
33 +       return sprintf(buf, "%d\n", 1);
34 +}
35 +KERNEL_ATTR_RO(realtime);
36 +#endif
37 +
38  /* whether file capabilities are enabled */
39  static ssize_t fscaps_show(struct kobject *kobj,
40                                   struct kobj_attribute *attr, char *buf)
41 @@ -203,6 +212,9 @@ static struct attribute * kernel_attrs[] = {
42         &vmcoreinfo_attr.attr,
43  #endif
44         &rcu_expedited_attr.attr,
45 +#ifdef CONFIG_PREEMPT_RT_FULL
46 +       &realtime_attr.attr,
47 +#endif
48         NULL
49  };
50  
51 -- 
52 1.9.1
53