diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-02 21:08:07 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-02 21:08:07 -0400 |
| commit | d52bd54db8be8999df6df5a776f38c4f8b5e9cea (patch) | |
| tree | 0d8f436e959bb975c002ddf12ea1bdc9adadd04f /kernel | |
| parent | 8cbdd85bda499d028b8f128191f392d701e8e41d (diff) | |
| parent | 3bd080e4d8f2351ee3e143f0ec9307cc95ae6639 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge yet more updates from Andrew Morton:
- the rest of ocfs2
- various hotfixes, mainly MM
- quite a bit of misc stuff - drivers, fork, exec, signals, etc.
- printk updates
- firmware
- checkpatch
- nilfs2
- more kexec stuff than usual
- rapidio updates
- w1 things
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (111 commits)
ipc: delete "nr_ipc_ns"
kcov: allow more fine-grained coverage instrumentation
init/Kconfig: add clarification for out-of-tree modules
config: add android config fragments
init/Kconfig: ban CONFIG_LOCALVERSION_AUTO with allmodconfig
relay: add global mode support for buffer-only channels
init: allow blacklisting of module_init functions
w1:omap_hdq: fix regression
w1: add helper macro module_w1_family
w1: remove need for ida and use PLATFORM_DEVID_AUTO
rapidio/switches: add driver for IDT gen3 switches
powerpc/fsl_rio: apply changes for RIO spec rev 3
rapidio: modify for rev.3 specification changes
rapidio: change inbound window size type to u64
rapidio/idt_gen2: fix locking warning
rapidio: fix error handling in mbox request/release functions
rapidio/tsi721_dma: advance queue processing from transfer submit call
rapidio/tsi721: add messaging mbox selector parameter
rapidio/tsi721: add PCIe MRRS override parameter
rapidio/tsi721_dma: add channel mask and queue size parameters
...
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/configs/android-base.config | 152 | ||||
| -rw-r--r-- | kernel/configs/android-recommended.config | 121 | ||||
| -rw-r--r-- | kernel/exit.c | 2 | ||||
| -rw-r--r-- | kernel/kexec.c | 3 | ||||
| -rw-r--r-- | kernel/kexec_core.c | 69 | ||||
| -rw-r--r-- | kernel/ksysfs.c | 6 | ||||
| -rw-r--r-- | kernel/module.c | 1 | ||||
| -rw-r--r-- | kernel/panic.c | 13 | ||||
| -rw-r--r-- | kernel/printk/internal.h | 16 | ||||
| -rw-r--r-- | kernel/printk/nmi.c | 13 | ||||
| -rw-r--r-- | kernel/printk/printk.c | 197 | ||||
| -rw-r--r-- | kernel/relay.c | 34 | ||||
| -rw-r--r-- | kernel/sysctl.c | 7 | ||||
| -rw-r--r-- | kernel/task_work.c | 10 |
14 files changed, 573 insertions, 71 deletions
diff --git a/kernel/configs/android-base.config b/kernel/configs/android-base.config new file mode 100644 index 000000000000..9f748ed7bea8 --- /dev/null +++ b/kernel/configs/android-base.config | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | # KEEP ALPHABETICALLY SORTED | ||
| 2 | # CONFIG_DEVKMEM is not set | ||
| 3 | # CONFIG_DEVMEM is not set | ||
| 4 | # CONFIG_INET_LRO is not set | ||
| 5 | # CONFIG_MODULES is not set | ||
| 6 | # CONFIG_OABI_COMPAT is not set | ||
| 7 | # CONFIG_SYSVIPC is not set | ||
| 8 | CONFIG_ANDROID=y | ||
| 9 | CONFIG_ANDROID_BINDER_IPC=y | ||
| 10 | CONFIG_ANDROID_LOW_MEMORY_KILLER=y | ||
| 11 | CONFIG_ARMV8_DEPRECATED=y | ||
| 12 | CONFIG_ASHMEM=y | ||
| 13 | CONFIG_AUDIT=y | ||
| 14 | CONFIG_BLK_DEV_DM=y | ||
| 15 | CONFIG_BLK_DEV_INITRD=y | ||
| 16 | CONFIG_CGROUPS=y | ||
| 17 | CONFIG_CGROUP_CPUACCT=y | ||
| 18 | CONFIG_CGROUP_DEBUG=y | ||
| 19 | CONFIG_CGROUP_FREEZER=y | ||
| 20 | CONFIG_CGROUP_SCHED=y | ||
| 21 | CONFIG_CP15_BARRIER_EMULATION=y | ||
| 22 | CONFIG_DM_CRYPT=y | ||
| 23 | CONFIG_DM_VERITY=y | ||
| 24 | CONFIG_DM_VERITY_FEC=y | ||
| 25 | CONFIG_EMBEDDED=y | ||
| 26 | CONFIG_FB=y | ||
| 27 | CONFIG_HIGH_RES_TIMERS=y | ||
| 28 | CONFIG_INET6_AH=y | ||
| 29 | CONFIG_INET6_ESP=y | ||
| 30 | CONFIG_INET6_IPCOMP=y | ||
| 31 | CONFIG_INET=y | ||
| 32 | CONFIG_INET_DIAG_DESTROY=y | ||
| 33 | CONFIG_INET_ESP=y | ||
| 34 | CONFIG_INET_XFRM_MODE_TUNNEL=y | ||
| 35 | CONFIG_IP6_NF_FILTER=y | ||
| 36 | CONFIG_IP6_NF_IPTABLES=y | ||
| 37 | CONFIG_IP6_NF_MANGLE=y | ||
| 38 | CONFIG_IP6_NF_RAW=y | ||
| 39 | CONFIG_IP6_NF_TARGET_REJECT=y | ||
| 40 | CONFIG_IPV6=y | ||
| 41 | CONFIG_IPV6_MIP6=y | ||
| 42 | CONFIG_IPV6_MULTIPLE_TABLES=y | ||
| 43 | CONFIG_IPV6_OPTIMISTIC_DAD=y | ||
| 44 | CONFIG_IPV6_PRIVACY=y | ||
| 45 | CONFIG_IPV6_ROUTER_PREF=y | ||
| 46 | CONFIG_IPV6_ROUTE_INFO=y | ||
| 47 | CONFIG_IP_ADVANCED_ROUTER=y | ||
| 48 | CONFIG_IP_MULTICAST=y | ||
| 49 | CONFIG_IP_MULTIPLE_TABLES=y | ||
| 50 | CONFIG_IP_NF_ARPFILTER=y | ||
| 51 | CONFIG_IP_NF_ARPTABLES=y | ||
| 52 | CONFIG_IP_NF_ARP_MANGLE=y | ||
| 53 | CONFIG_IP_NF_FILTER=y | ||
| 54 | CONFIG_IP_NF_IPTABLES=y | ||
| 55 | CONFIG_IP_NF_MANGLE=y | ||
| 56 | CONFIG_IP_NF_MATCH_AH=y | ||
| 57 | CONFIG_IP_NF_MATCH_ECN=y | ||
| 58 | CONFIG_IP_NF_MATCH_TTL=y | ||
| 59 | CONFIG_IP_NF_NAT=y | ||
| 60 | CONFIG_IP_NF_RAW=y | ||
| 61 | CONFIG_IP_NF_SECURITY=y | ||
| 62 | CONFIG_IP_NF_TARGET_MASQUERADE=y | ||
| 63 | CONFIG_IP_NF_TARGET_NETMAP=y | ||
| 64 | CONFIG_IP_NF_TARGET_REDIRECT=y | ||
| 65 | CONFIG_IP_NF_TARGET_REJECT=y | ||
| 66 | CONFIG_NET=y | ||
| 67 | CONFIG_NETDEVICES=y | ||
| 68 | CONFIG_NETFILTER=y | ||
| 69 | CONFIG_NETFILTER_TPROXY=y | ||
| 70 | CONFIG_NETFILTER_XT_MATCH_COMMENT=y | ||
| 71 | CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y | ||
| 72 | CONFIG_NETFILTER_XT_MATCH_CONNMARK=y | ||
| 73 | CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y | ||
| 74 | CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y | ||
| 75 | CONFIG_NETFILTER_XT_MATCH_HELPER=y | ||
| 76 | CONFIG_NETFILTER_XT_MATCH_IPRANGE=y | ||
| 77 | CONFIG_NETFILTER_XT_MATCH_LENGTH=y | ||
| 78 | CONFIG_NETFILTER_XT_MATCH_LIMIT=y | ||
| 79 | CONFIG_NETFILTER_XT_MATCH_MAC=y | ||
| 80 | CONFIG_NETFILTER_XT_MATCH_MARK=y | ||
| 81 | CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y | ||
| 82 | CONFIG_NETFILTER_XT_MATCH_POLICY=y | ||
| 83 | CONFIG_NETFILTER_XT_MATCH_QUOTA=y | ||
| 84 | CONFIG_NETFILTER_XT_MATCH_SOCKET=y | ||
| 85 | CONFIG_NETFILTER_XT_MATCH_STATE=y | ||
| 86 | CONFIG_NETFILTER_XT_MATCH_STATISTIC=y | ||
| 87 | CONFIG_NETFILTER_XT_MATCH_STRING=y | ||
| 88 | CONFIG_NETFILTER_XT_MATCH_TIME=y | ||
| 89 | CONFIG_NETFILTER_XT_MATCH_U32=y | ||
| 90 | CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y | ||
| 91 | CONFIG_NETFILTER_XT_TARGET_CONNMARK=y | ||
| 92 | CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=y | ||
| 93 | CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y | ||
| 94 | CONFIG_NETFILTER_XT_TARGET_MARK=y | ||
| 95 | CONFIG_NETFILTER_XT_TARGET_NFLOG=y | ||
| 96 | CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y | ||
| 97 | CONFIG_NETFILTER_XT_TARGET_SECMARK=y | ||
| 98 | CONFIG_NETFILTER_XT_TARGET_TCPMSS=y | ||
| 99 | CONFIG_NETFILTER_XT_TARGET_TPROXY=y | ||
| 100 | CONFIG_NETFILTER_XT_TARGET_TRACE=y | ||
| 101 | CONFIG_NET_CLS_ACT=y | ||
| 102 | CONFIG_NET_CLS_U32=y | ||
| 103 | CONFIG_NET_EMATCH=y | ||
| 104 | CONFIG_NET_EMATCH_U32=y | ||
| 105 | CONFIG_NET_KEY=y | ||
| 106 | CONFIG_NET_SCHED=y | ||
| 107 | CONFIG_NET_SCH_HTB=y | ||
| 108 | CONFIG_NF_CONNTRACK=y | ||
| 109 | CONFIG_NF_CONNTRACK_AMANDA=y | ||
| 110 | CONFIG_NF_CONNTRACK_EVENTS=y | ||
| 111 | CONFIG_NF_CONNTRACK_FTP=y | ||
| 112 | CONFIG_NF_CONNTRACK_H323=y | ||
| 113 | CONFIG_NF_CONNTRACK_IPV4=y | ||
| 114 | CONFIG_NF_CONNTRACK_IPV6=y | ||
| 115 | CONFIG_NF_CONNTRACK_IRC=y | ||
| 116 | CONFIG_NF_CONNTRACK_NETBIOS_NS=y | ||
| 117 | CONFIG_NF_CONNTRACK_PPTP=y | ||
| 118 | CONFIG_NF_CONNTRACK_SANE=y | ||
| 119 | CONFIG_NF_CONNTRACK_SECMARK=y | ||
| 120 | CONFIG_NF_CONNTRACK_TFTP=y | ||
| 121 | CONFIG_NF_CT_NETLINK=y | ||
| 122 | CONFIG_NF_CT_PROTO_DCCP=y | ||
| 123 | CONFIG_NF_CT_PROTO_SCTP=y | ||
| 124 | CONFIG_NF_CT_PROTO_UDPLITE=y | ||
| 125 | CONFIG_NF_NAT=y | ||
| 126 | CONFIG_NO_HZ=y | ||
| 127 | CONFIG_PACKET=y | ||
| 128 | CONFIG_PM_AUTOSLEEP=y | ||
| 129 | CONFIG_PM_WAKELOCKS=y | ||
| 130 | CONFIG_PPP=y | ||
| 131 | CONFIG_PPP_BSDCOMP=y | ||
| 132 | CONFIG_PPP_DEFLATE=y | ||
| 133 | CONFIG_PPP_MPPE=y | ||
| 134 | CONFIG_PREEMPT=y | ||
| 135 | CONFIG_QUOTA=y | ||
| 136 | CONFIG_RTC_CLASS=y | ||
| 137 | CONFIG_RT_GROUP_SCHED=y | ||
| 138 | CONFIG_SECURITY=y | ||
| 139 | CONFIG_SECURITY_NETWORK=y | ||
| 140 | CONFIG_SECURITY_SELINUX=y | ||
| 141 | CONFIG_SETEND_EMULATION=y | ||
| 142 | CONFIG_STAGING=y | ||
| 143 | CONFIG_SWP_EMULATION=y | ||
| 144 | CONFIG_SYNC=y | ||
| 145 | CONFIG_TUN=y | ||
| 146 | CONFIG_UNIX=y | ||
| 147 | CONFIG_USB_GADGET=y | ||
| 148 | CONFIG_USB_CONFIGFS=y | ||
| 149 | CONFIG_USB_CONFIGFS_F_FS=y | ||
| 150 | CONFIG_USB_CONFIGFS_F_MIDI=y | ||
| 151 | CONFIG_USB_OTG_WAKELOCK=y | ||
| 152 | CONFIG_XFRM_USER=y | ||
diff --git a/kernel/configs/android-recommended.config b/kernel/configs/android-recommended.config new file mode 100644 index 000000000000..e3b953e966d2 --- /dev/null +++ b/kernel/configs/android-recommended.config | |||
| @@ -0,0 +1,121 @@ | |||
| 1 | # KEEP ALPHABETICALLY SORTED | ||
| 2 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
| 3 | # CONFIG_INPUT_MOUSE is not set | ||
| 4 | # CONFIG_LEGACY_PTYS is not set | ||
| 5 | # CONFIG_NF_CONNTRACK_SIP is not set | ||
| 6 | # CONFIG_PM_WAKELOCKS_GC is not set | ||
| 7 | # CONFIG_VT is not set | ||
| 8 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | ||
| 9 | CONFIG_BLK_DEV_LOOP=y | ||
| 10 | CONFIG_BLK_DEV_RAM=y | ||
| 11 | CONFIG_BLK_DEV_RAM_SIZE=8192 | ||
| 12 | CONFIG_COMPACTION=y | ||
| 13 | CONFIG_DEBUG_RODATA=y | ||
| 14 | CONFIG_DM_UEVENT=y | ||
| 15 | CONFIG_DRAGONRISE_FF=y | ||
| 16 | CONFIG_ENABLE_DEFAULT_TRACERS=y | ||
| 17 | CONFIG_EXT4_FS=y | ||
| 18 | CONFIG_EXT4_FS_SECURITY=y | ||
| 19 | CONFIG_FUSE_FS=y | ||
| 20 | CONFIG_GREENASIA_FF=y | ||
| 21 | CONFIG_HIDRAW=y | ||
| 22 | CONFIG_HID_A4TECH=y | ||
| 23 | CONFIG_HID_ACRUX=y | ||
| 24 | CONFIG_HID_ACRUX_FF=y | ||
| 25 | CONFIG_HID_APPLE=y | ||
| 26 | CONFIG_HID_BELKIN=y | ||
| 27 | CONFIG_HID_CHERRY=y | ||
| 28 | CONFIG_HID_CHICONY=y | ||
| 29 | CONFIG_HID_CYPRESS=y | ||
| 30 | CONFIG_HID_DRAGONRISE=y | ||
| 31 | CONFIG_HID_ELECOM=y | ||
| 32 | CONFIG_HID_EMS_FF=y | ||
| 33 | CONFIG_HID_EZKEY=y | ||
| 34 | CONFIG_HID_GREENASIA=y | ||
| 35 | CONFIG_HID_GYRATION=y | ||
| 36 | CONFIG_HID_HOLTEK=y | ||
| 37 | CONFIG_HID_KENSINGTON=y | ||
| 38 | CONFIG_HID_KEYTOUCH=y | ||
| 39 | CONFIG_HID_KYE=y | ||
| 40 | CONFIG_HID_LCPOWER=y | ||
| 41 | CONFIG_HID_LOGITECH=y | ||
| 42 | CONFIG_HID_LOGITECH_DJ=y | ||
| 43 | CONFIG_HID_MAGICMOUSE=y | ||
| 44 | CONFIG_HID_MICROSOFT=y | ||
| 45 | CONFIG_HID_MONTEREY=y | ||
| 46 | CONFIG_HID_MULTITOUCH=y | ||
| 47 | CONFIG_HID_NTRIG=y | ||
| 48 | CONFIG_HID_ORTEK=y | ||
| 49 | CONFIG_HID_PANTHERLORD=y | ||
| 50 | CONFIG_HID_PETALYNX=y | ||
| 51 | CONFIG_HID_PICOLCD=y | ||
| 52 | CONFIG_HID_PRIMAX=y | ||
| 53 | CONFIG_HID_PRODIKEYS=y | ||
| 54 | CONFIG_HID_ROCCAT=y | ||
| 55 | CONFIG_HID_SAITEK=y | ||
| 56 | CONFIG_HID_SAMSUNG=y | ||
| 57 | CONFIG_HID_SMARTJOYPLUS=y | ||
| 58 | CONFIG_HID_SONY=y | ||
| 59 | CONFIG_HID_SPEEDLINK=y | ||
| 60 | CONFIG_HID_SUNPLUS=y | ||
| 61 | CONFIG_HID_THRUSTMASTER=y | ||
| 62 | CONFIG_HID_TIVO=y | ||
| 63 | CONFIG_HID_TOPSEED=y | ||
| 64 | CONFIG_HID_TWINHAN=y | ||
| 65 | CONFIG_HID_UCLOGIC=y | ||
| 66 | CONFIG_HID_WACOM=y | ||
| 67 | CONFIG_HID_WALTOP=y | ||
| 68 | CONFIG_HID_WIIMOTE=y | ||
| 69 | CONFIG_HID_ZEROPLUS=y | ||
| 70 | CONFIG_HID_ZYDACRON=y | ||
| 71 | CONFIG_INPUT_EVDEV=y | ||
| 72 | CONFIG_INPUT_GPIO=y | ||
| 73 | CONFIG_INPUT_JOYSTICK=y | ||
| 74 | CONFIG_INPUT_MISC=y | ||
| 75 | CONFIG_INPUT_TABLET=y | ||
| 76 | CONFIG_INPUT_UINPUT=y | ||
| 77 | CONFIG_ION=y | ||
| 78 | CONFIG_JOYSTICK_XPAD=y | ||
| 79 | CONFIG_JOYSTICK_XPAD_FF=y | ||
| 80 | CONFIG_JOYSTICK_XPAD_LEDS=y | ||
| 81 | CONFIG_KALLSYMS_ALL=y | ||
| 82 | CONFIG_KSM=y | ||
| 83 | CONFIG_LOGIG940_FF=y | ||
| 84 | CONFIG_LOGIRUMBLEPAD2_FF=y | ||
| 85 | CONFIG_LOGITECH_FF=y | ||
| 86 | CONFIG_MD=y | ||
| 87 | CONFIG_MEDIA_SUPPORT=y | ||
| 88 | CONFIG_MSDOS_FS=y | ||
| 89 | CONFIG_PANIC_TIMEOUT=5 | ||
| 90 | CONFIG_PANTHERLORD_FF=y | ||
| 91 | CONFIG_PERF_EVENTS=y | ||
| 92 | CONFIG_PM_DEBUG=y | ||
| 93 | CONFIG_PM_RUNTIME=y | ||
| 94 | CONFIG_PM_WAKELOCKS_LIMIT=0 | ||
| 95 | CONFIG_POWER_SUPPLY=y | ||
| 96 | CONFIG_PSTORE=y | ||
| 97 | CONFIG_PSTORE_CONSOLE=y | ||
| 98 | CONFIG_PSTORE_RAM=y | ||
| 99 | CONFIG_SCHEDSTATS=y | ||
| 100 | CONFIG_SMARTJOYPLUS_FF=y | ||
| 101 | CONFIG_SND=y | ||
| 102 | CONFIG_SOUND=y | ||
| 103 | CONFIG_SUSPEND_TIME=y | ||
| 104 | CONFIG_TABLET_USB_ACECAD=y | ||
| 105 | CONFIG_TABLET_USB_AIPTEK=y | ||
| 106 | CONFIG_TABLET_USB_GTCO=y | ||
| 107 | CONFIG_TABLET_USB_HANWANG=y | ||
| 108 | CONFIG_TABLET_USB_KBTAB=y | ||
| 109 | CONFIG_TASKSTATS=y | ||
| 110 | CONFIG_TASK_DELAY_ACCT=y | ||
| 111 | CONFIG_TASK_IO_ACCOUNTING=y | ||
| 112 | CONFIG_TASK_XACCT=y | ||
| 113 | CONFIG_TIMER_STATS=y | ||
| 114 | CONFIG_TMPFS=y | ||
| 115 | CONFIG_TMPFS_POSIX_ACL=y | ||
| 116 | CONFIG_UHID=y | ||
| 117 | CONFIG_USB_ANNOUNCE_NEW_DEVICES=y | ||
| 118 | CONFIG_USB_EHCI_HCD=y | ||
| 119 | CONFIG_USB_HIDDEV=y | ||
| 120 | CONFIG_USB_USBNET=y | ||
| 121 | CONFIG_VFAT_FS=y | ||
diff --git a/kernel/exit.c b/kernel/exit.c index 84ae830234f8..2f974ae042a6 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
| @@ -715,7 +715,7 @@ static void check_stack_usage(void) | |||
| 715 | 715 | ||
| 716 | spin_lock(&low_water_lock); | 716 | spin_lock(&low_water_lock); |
| 717 | if (free < lowest_to_date) { | 717 | if (free < lowest_to_date) { |
| 718 | pr_warn("%s (%d) used greatest stack depth: %lu bytes left\n", | 718 | pr_info("%s (%d) used greatest stack depth: %lu bytes left\n", |
| 719 | current->comm, task_pid_nr(current), free); | 719 | current->comm, task_pid_nr(current), free); |
| 720 | lowest_to_date = free; | 720 | lowest_to_date = free; |
| 721 | } | 721 | } |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 4384672d3245..980936a90ee6 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
| @@ -48,7 +48,8 @@ static int kimage_alloc_init(struct kimage **rimage, unsigned long entry, | |||
| 48 | 48 | ||
| 49 | if (kexec_on_panic) { | 49 | if (kexec_on_panic) { |
| 50 | /* Verify we have a valid entry point */ | 50 | /* Verify we have a valid entry point */ |
| 51 | if ((entry < crashk_res.start) || (entry > crashk_res.end)) | 51 | if ((entry < phys_to_boot_phys(crashk_res.start)) || |
| 52 | (entry > phys_to_boot_phys(crashk_res.end))) | ||
| 52 | return -EADDRNOTAVAIL; | 53 | return -EADDRNOTAVAIL; |
| 53 | } | 54 | } |
| 54 | 55 | ||
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index 56b3ed0927b0..561675589511 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c | |||
| @@ -95,6 +95,12 @@ int kexec_should_crash(struct task_struct *p) | |||
| 95 | return 0; | 95 | return 0; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | int kexec_crash_loaded(void) | ||
| 99 | { | ||
| 100 | return !!kexec_crash_image; | ||
| 101 | } | ||
| 102 | EXPORT_SYMBOL_GPL(kexec_crash_loaded); | ||
| 103 | |||
| 98 | /* | 104 | /* |
| 99 | * When kexec transitions to the new kernel there is a one-to-one | 105 | * When kexec transitions to the new kernel there is a one-to-one |
| 100 | * mapping between physical and virtual addresses. On processors | 106 | * mapping between physical and virtual addresses. On processors |
| @@ -140,6 +146,7 @@ int kexec_should_crash(struct task_struct *p) | |||
| 140 | * allocating pages whose destination address we do not care about. | 146 | * allocating pages whose destination address we do not care about. |
| 141 | */ | 147 | */ |
| 142 | #define KIMAGE_NO_DEST (-1UL) | 148 | #define KIMAGE_NO_DEST (-1UL) |
| 149 | #define PAGE_COUNT(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT) | ||
| 143 | 150 | ||
| 144 | static struct page *kimage_alloc_page(struct kimage *image, | 151 | static struct page *kimage_alloc_page(struct kimage *image, |
| 145 | gfp_t gfp_mask, | 152 | gfp_t gfp_mask, |
| @@ -147,8 +154,9 @@ static struct page *kimage_alloc_page(struct kimage *image, | |||
| 147 | 154 | ||
| 148 | int sanity_check_segment_list(struct kimage *image) | 155 | int sanity_check_segment_list(struct kimage *image) |
| 149 | { | 156 | { |
| 150 | int result, i; | 157 | int i; |
| 151 | unsigned long nr_segments = image->nr_segments; | 158 | unsigned long nr_segments = image->nr_segments; |
| 159 | unsigned long total_pages = 0; | ||
| 152 | 160 | ||
| 153 | /* | 161 | /* |
| 154 | * Verify we have good destination addresses. The caller is | 162 | * Verify we have good destination addresses. The caller is |
| @@ -163,16 +171,17 @@ int sanity_check_segment_list(struct kimage *image) | |||
| 163 | * simply because addresses are changed to page size | 171 | * simply because addresses are changed to page size |
| 164 | * granularity. | 172 | * granularity. |
| 165 | */ | 173 | */ |
| 166 | result = -EADDRNOTAVAIL; | ||
| 167 | for (i = 0; i < nr_segments; i++) { | 174 | for (i = 0; i < nr_segments; i++) { |
| 168 | unsigned long mstart, mend; | 175 | unsigned long mstart, mend; |
| 169 | 176 | ||
| 170 | mstart = image->segment[i].mem; | 177 | mstart = image->segment[i].mem; |
| 171 | mend = mstart + image->segment[i].memsz; | 178 | mend = mstart + image->segment[i].memsz; |
| 179 | if (mstart > mend) | ||
| 180 | return -EADDRNOTAVAIL; | ||
| 172 | if ((mstart & ~PAGE_MASK) || (mend & ~PAGE_MASK)) | 181 | if ((mstart & ~PAGE_MASK) || (mend & ~PAGE_MASK)) |
| 173 | return result; | 182 | return -EADDRNOTAVAIL; |
| 174 | if (mend >= KEXEC_DESTINATION_MEMORY_LIMIT) | 183 | if (mend >= KEXEC_DESTINATION_MEMORY_LIMIT) |
| 175 | return result; | 184 | return -EADDRNOTAVAIL; |
| 176 | } | 185 | } |
| 177 | 186 | ||
| 178 | /* Verify our destination addresses do not overlap. | 187 | /* Verify our destination addresses do not overlap. |
| @@ -180,7 +189,6 @@ int sanity_check_segment_list(struct kimage *image) | |||
| 180 | * through very weird things can happen with no | 189 | * through very weird things can happen with no |
| 181 | * easy explanation as one segment stops on another. | 190 | * easy explanation as one segment stops on another. |
| 182 | */ | 191 | */ |
| 183 | result = -EINVAL; | ||
| 184 | for (i = 0; i < nr_segments; i++) { | 192 | for (i = 0; i < nr_segments; i++) { |
| 185 | unsigned long mstart, mend; | 193 | unsigned long mstart, mend; |
| 186 | unsigned long j; | 194 | unsigned long j; |
| @@ -194,7 +202,7 @@ int sanity_check_segment_list(struct kimage *image) | |||
| 194 | pend = pstart + image->segment[j].memsz; | 202 | pend = pstart + image->segment[j].memsz; |
| 195 | /* Do the segments overlap ? */ | 203 | /* Do the segments overlap ? */ |
| 196 | if ((mend > pstart) && (mstart < pend)) | 204 | if ((mend > pstart) && (mstart < pend)) |
| 197 | return result; | 205 | return -EINVAL; |
| 198 | } | 206 | } |
| 199 | } | 207 | } |
| 200 | 208 | ||
| @@ -203,12 +211,26 @@ int sanity_check_segment_list(struct kimage *image) | |||
| 203 | * and it is easier to check up front than to be surprised | 211 | * and it is easier to check up front than to be surprised |
| 204 | * later on. | 212 | * later on. |
| 205 | */ | 213 | */ |
| 206 | result = -EINVAL; | ||
| 207 | for (i = 0; i < nr_segments; i++) { | 214 | for (i = 0; i < nr_segments; i++) { |
| 208 | if (image->segment[i].bufsz > image->segment[i].memsz) | 215 | if (image->segment[i].bufsz > image->segment[i].memsz) |
| 209 | return result; | 216 | return -EINVAL; |
| 217 | } | ||
| 218 | |||
| 219 | /* | ||
| 220 | * Verify that no more than half of memory will be consumed. If the | ||
| 221 | * request from userspace is too large, a large amount of time will be | ||
| 222 | * wasted allocating pages, which can cause a soft lockup. | ||
| 223 | */ | ||
| 224 | for (i = 0; i < nr_segments; i++) { | ||
| 225 | if (PAGE_COUNT(image->segment[i].memsz) > totalram_pages / 2) | ||
| 226 | return -EINVAL; | ||
| 227 | |||
| 228 | total_pages += PAGE_COUNT(image->segment[i].memsz); | ||
| 210 | } | 229 | } |
| 211 | 230 | ||
| 231 | if (total_pages > totalram_pages / 2) | ||
| 232 | return -EINVAL; | ||
| 233 | |||
| 212 | /* | 234 | /* |
| 213 | * Verify we have good destination addresses. Normally | 235 | * Verify we have good destination addresses. Normally |
| 214 | * the caller is responsible for making certain we don't | 236 | * the caller is responsible for making certain we don't |
| @@ -220,16 +242,15 @@ int sanity_check_segment_list(struct kimage *image) | |||
| 220 | */ | 242 | */ |
| 221 | 243 | ||
| 222 | if (image->type == KEXEC_TYPE_CRASH) { | 244 | if (image->type == KEXEC_TYPE_CRASH) { |
| 223 | result = -EADDRNOTAVAIL; | ||
| 224 | for (i = 0; i < nr_segments; i++) { | 245 | for (i = 0; i < nr_segments; i++) { |
| 225 | unsigned long mstart, mend; | 246 | unsigned long mstart, mend; |
| 226 | 247 | ||
| 227 | mstart = image->segment[i].mem; | 248 | mstart = image->segment[i].mem; |
| 228 | mend = mstart + image->segment[i].memsz - 1; | 249 | mend = mstart + image->segment[i].memsz - 1; |
| 229 | /* Ensure we are within the crash kernel limits */ | 250 | /* Ensure we are within the crash kernel limits */ |
| 230 | if ((mstart < crashk_res.start) || | 251 | if ((mstart < phys_to_boot_phys(crashk_res.start)) || |
| 231 | (mend > crashk_res.end)) | 252 | (mend > phys_to_boot_phys(crashk_res.end))) |
| 232 | return result; | 253 | return -EADDRNOTAVAIL; |
| 233 | } | 254 | } |
| 234 | } | 255 | } |
| 235 | 256 | ||
| @@ -352,7 +373,7 @@ static struct page *kimage_alloc_normal_control_pages(struct kimage *image, | |||
| 352 | pages = kimage_alloc_pages(KEXEC_CONTROL_MEMORY_GFP, order); | 373 | pages = kimage_alloc_pages(KEXEC_CONTROL_MEMORY_GFP, order); |
| 353 | if (!pages) | 374 | if (!pages) |
| 354 | break; | 375 | break; |
| 355 | pfn = page_to_pfn(pages); | 376 | pfn = page_to_boot_pfn(pages); |
| 356 | epfn = pfn + count; | 377 | epfn = pfn + count; |
| 357 | addr = pfn << PAGE_SHIFT; | 378 | addr = pfn << PAGE_SHIFT; |
| 358 | eaddr = epfn << PAGE_SHIFT; | 379 | eaddr = epfn << PAGE_SHIFT; |
| @@ -478,7 +499,7 @@ static int kimage_add_entry(struct kimage *image, kimage_entry_t entry) | |||
| 478 | return -ENOMEM; | 499 | return -ENOMEM; |
| 479 | 500 | ||
| 480 | ind_page = page_address(page); | 501 | ind_page = page_address(page); |
| 481 | *image->entry = virt_to_phys(ind_page) | IND_INDIRECTION; | 502 | *image->entry = virt_to_boot_phys(ind_page) | IND_INDIRECTION; |
| 482 | image->entry = ind_page; | 503 | image->entry = ind_page; |
| 483 | image->last_entry = ind_page + | 504 | image->last_entry = ind_page + |
| 484 | ((PAGE_SIZE/sizeof(kimage_entry_t)) - 1); | 505 | ((PAGE_SIZE/sizeof(kimage_entry_t)) - 1); |
| @@ -533,13 +554,13 @@ void kimage_terminate(struct kimage *image) | |||
| 533 | #define for_each_kimage_entry(image, ptr, entry) \ | 554 | #define for_each_kimage_entry(image, ptr, entry) \ |
| 534 | for (ptr = &image->head; (entry = *ptr) && !(entry & IND_DONE); \ | 555 | for (ptr = &image->head; (entry = *ptr) && !(entry & IND_DONE); \ |
| 535 | ptr = (entry & IND_INDIRECTION) ? \ | 556 | ptr = (entry & IND_INDIRECTION) ? \ |
| 536 | phys_to_virt((entry & PAGE_MASK)) : ptr + 1) | 557 | boot_phys_to_virt((entry & PAGE_MASK)) : ptr + 1) |
| 537 | 558 | ||
| 538 | static void kimage_free_entry(kimage_entry_t entry) | 559 | static void kimage_free_entry(kimage_entry_t entry) |
| 539 | { | 560 | { |
| 540 | struct page *page; | 561 | struct page *page; |
| 541 | 562 | ||
| 542 | page = pfn_to_page(entry >> PAGE_SHIFT); | 563 | page = boot_pfn_to_page(entry >> PAGE_SHIFT); |
| 543 | kimage_free_pages(page); | 564 | kimage_free_pages(page); |
| 544 | } | 565 | } |
| 545 | 566 | ||
| @@ -633,7 +654,7 @@ static struct page *kimage_alloc_page(struct kimage *image, | |||
| 633 | * have a match. | 654 | * have a match. |
| 634 | */ | 655 | */ |
| 635 | list_for_each_entry(page, &image->dest_pages, lru) { | 656 | list_for_each_entry(page, &image->dest_pages, lru) { |
| 636 | addr = page_to_pfn(page) << PAGE_SHIFT; | 657 | addr = page_to_boot_pfn(page) << PAGE_SHIFT; |
| 637 | if (addr == destination) { | 658 | if (addr == destination) { |
| 638 | list_del(&page->lru); | 659 | list_del(&page->lru); |
| 639 | return page; | 660 | return page; |
| @@ -648,12 +669,12 @@ static struct page *kimage_alloc_page(struct kimage *image, | |||
| 648 | if (!page) | 669 | if (!page) |
| 649 | return NULL; | 670 | return NULL; |
| 650 | /* If the page cannot be used file it away */ | 671 | /* If the page cannot be used file it away */ |
| 651 | if (page_to_pfn(page) > | 672 | if (page_to_boot_pfn(page) > |
| 652 | (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) { | 673 | (KEXEC_SOURCE_MEMORY_LIMIT >> PAGE_SHIFT)) { |
| 653 | list_add(&page->lru, &image->unusable_pages); | 674 | list_add(&page->lru, &image->unusable_pages); |
| 654 | continue; | 675 | continue; |
| 655 | } | 676 | } |
| 656 | addr = page_to_pfn(page) << PAGE_SHIFT; | 677 | addr = page_to_boot_pfn(page) << PAGE_SHIFT; |
| 657 | 678 | ||
| 658 | /* If it is the destination page we want use it */ | 679 | /* If it is the destination page we want use it */ |
| 659 | if (addr == destination) | 680 | if (addr == destination) |
| @@ -676,7 +697,7 @@ static struct page *kimage_alloc_page(struct kimage *image, | |||
| 676 | struct page *old_page; | 697 | struct page *old_page; |
| 677 | 698 | ||
| 678 | old_addr = *old & PAGE_MASK; | 699 | old_addr = *old & PAGE_MASK; |
| 679 | old_page = pfn_to_page(old_addr >> PAGE_SHIFT); | 700 | old_page = boot_pfn_to_page(old_addr >> PAGE_SHIFT); |
| 680 | copy_highpage(page, old_page); | 701 | copy_highpage(page, old_page); |
| 681 | *old = addr | (*old & ~PAGE_MASK); | 702 | *old = addr | (*old & ~PAGE_MASK); |
| 682 | 703 | ||
| @@ -732,7 +753,7 @@ static int kimage_load_normal_segment(struct kimage *image, | |||
| 732 | result = -ENOMEM; | 753 | result = -ENOMEM; |
| 733 | goto out; | 754 | goto out; |
| 734 | } | 755 | } |
| 735 | result = kimage_add_page(image, page_to_pfn(page) | 756 | result = kimage_add_page(image, page_to_boot_pfn(page) |
| 736 | << PAGE_SHIFT); | 757 | << PAGE_SHIFT); |
| 737 | if (result < 0) | 758 | if (result < 0) |
| 738 | goto out; | 759 | goto out; |
| @@ -793,7 +814,7 @@ static int kimage_load_crash_segment(struct kimage *image, | |||
| 793 | char *ptr; | 814 | char *ptr; |
| 794 | size_t uchunk, mchunk; | 815 | size_t uchunk, mchunk; |
| 795 | 816 | ||
| 796 | page = pfn_to_page(maddr >> PAGE_SHIFT); | 817 | page = boot_pfn_to_page(maddr >> PAGE_SHIFT); |
| 797 | if (!page) { | 818 | if (!page) { |
| 798 | result = -ENOMEM; | 819 | result = -ENOMEM; |
| 799 | goto out; | 820 | goto out; |
| @@ -921,7 +942,7 @@ void __weak crash_free_reserved_phys_range(unsigned long begin, | |||
| 921 | unsigned long addr; | 942 | unsigned long addr; |
| 922 | 943 | ||
| 923 | for (addr = begin; addr < end; addr += PAGE_SIZE) | 944 | for (addr = begin; addr < end; addr += PAGE_SIZE) |
| 924 | free_reserved_page(pfn_to_page(addr >> PAGE_SHIFT)); | 945 | free_reserved_page(boot_pfn_to_page(addr >> PAGE_SHIFT)); |
| 925 | } | 946 | } |
| 926 | 947 | ||
| 927 | int crash_shrink_memory(unsigned long new_size) | 948 | int crash_shrink_memory(unsigned long new_size) |
| @@ -1374,7 +1395,7 @@ void vmcoreinfo_append_str(const char *fmt, ...) | |||
| 1374 | void __weak arch_crash_save_vmcoreinfo(void) | 1395 | void __weak arch_crash_save_vmcoreinfo(void) |
| 1375 | {} | 1396 | {} |
| 1376 | 1397 | ||
| 1377 | unsigned long __weak paddr_vmcoreinfo_note(void) | 1398 | phys_addr_t __weak paddr_vmcoreinfo_note(void) |
| 1378 | { | 1399 | { |
| 1379 | return __pa((unsigned long)(char *)&vmcoreinfo_note); | 1400 | return __pa((unsigned long)(char *)&vmcoreinfo_note); |
| 1380 | } | 1401 | } |
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 152da4a48867..ee1bc1bb8feb 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
| @@ -101,7 +101,7 @@ KERNEL_ATTR_RO(kexec_loaded); | |||
| 101 | static ssize_t kexec_crash_loaded_show(struct kobject *kobj, | 101 | static ssize_t kexec_crash_loaded_show(struct kobject *kobj, |
| 102 | struct kobj_attribute *attr, char *buf) | 102 | struct kobj_attribute *attr, char *buf) |
| 103 | { | 103 | { |
| 104 | return sprintf(buf, "%d\n", !!kexec_crash_image); | 104 | return sprintf(buf, "%d\n", kexec_crash_loaded()); |
| 105 | } | 105 | } |
| 106 | KERNEL_ATTR_RO(kexec_crash_loaded); | 106 | KERNEL_ATTR_RO(kexec_crash_loaded); |
| 107 | 107 | ||
| @@ -128,8 +128,8 @@ KERNEL_ATTR_RW(kexec_crash_size); | |||
| 128 | static ssize_t vmcoreinfo_show(struct kobject *kobj, | 128 | static ssize_t vmcoreinfo_show(struct kobject *kobj, |
| 129 | struct kobj_attribute *attr, char *buf) | 129 | struct kobj_attribute *attr, char *buf) |
| 130 | { | 130 | { |
| 131 | return sprintf(buf, "%lx %x\n", | 131 | phys_addr_t vmcore_base = paddr_vmcoreinfo_note(); |
| 132 | paddr_vmcoreinfo_note(), | 132 | return sprintf(buf, "%pa %x\n", &vmcore_base, |
| 133 | (unsigned int)sizeof(vmcoreinfo_note)); | 133 | (unsigned int)sizeof(vmcoreinfo_note)); |
| 134 | } | 134 | } |
| 135 | KERNEL_ATTR_RO(vmcoreinfo); | 135 | KERNEL_ATTR_RO(vmcoreinfo); |
diff --git a/kernel/module.c b/kernel/module.c index 5f71aa63ed2a..a0f48b8b00da 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -60,6 +60,7 @@ | |||
| 60 | #include <linux/jump_label.h> | 60 | #include <linux/jump_label.h> |
| 61 | #include <linux/pfn.h> | 61 | #include <linux/pfn.h> |
| 62 | #include <linux/bsearch.h> | 62 | #include <linux/bsearch.h> |
| 63 | #include <linux/dynamic_debug.h> | ||
| 63 | #include <uapi/linux/module.h> | 64 | #include <uapi/linux/module.h> |
| 64 | #include "module-internal.h" | 65 | #include "module-internal.h" |
| 65 | 66 | ||
diff --git a/kernel/panic.c b/kernel/panic.c index 8aa74497cc5a..ca8cea1ef673 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
| @@ -108,6 +108,7 @@ void panic(const char *fmt, ...) | |||
| 108 | long i, i_next = 0; | 108 | long i, i_next = 0; |
| 109 | int state = 0; | 109 | int state = 0; |
| 110 | int old_cpu, this_cpu; | 110 | int old_cpu, this_cpu; |
| 111 | bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers; | ||
| 111 | 112 | ||
| 112 | /* | 113 | /* |
| 113 | * Disable local interrupts. This will prevent panic_smp_self_stop | 114 | * Disable local interrupts. This will prevent panic_smp_self_stop |
| @@ -160,7 +161,7 @@ void panic(const char *fmt, ...) | |||
| 160 | * | 161 | * |
| 161 | * Bypass the panic_cpu check and call __crash_kexec directly. | 162 | * Bypass the panic_cpu check and call __crash_kexec directly. |
| 162 | */ | 163 | */ |
| 163 | if (!crash_kexec_post_notifiers) { | 164 | if (!_crash_kexec_post_notifiers) { |
| 164 | printk_nmi_flush_on_panic(); | 165 | printk_nmi_flush_on_panic(); |
| 165 | __crash_kexec(NULL); | 166 | __crash_kexec(NULL); |
| 166 | } | 167 | } |
| @@ -191,7 +192,7 @@ void panic(const char *fmt, ...) | |||
| 191 | * | 192 | * |
| 192 | * Bypass the panic_cpu check and call __crash_kexec directly. | 193 | * Bypass the panic_cpu check and call __crash_kexec directly. |
| 193 | */ | 194 | */ |
| 194 | if (crash_kexec_post_notifiers) | 195 | if (_crash_kexec_post_notifiers) |
| 195 | __crash_kexec(NULL); | 196 | __crash_kexec(NULL); |
| 196 | 197 | ||
| 197 | bust_spinlocks(0); | 198 | bust_spinlocks(0); |
| @@ -571,13 +572,7 @@ EXPORT_SYMBOL(__stack_chk_fail); | |||
| 571 | core_param(panic, panic_timeout, int, 0644); | 572 | core_param(panic, panic_timeout, int, 0644); |
| 572 | core_param(pause_on_oops, pause_on_oops, int, 0644); | 573 | core_param(pause_on_oops, pause_on_oops, int, 0644); |
| 573 | core_param(panic_on_warn, panic_on_warn, int, 0644); | 574 | core_param(panic_on_warn, panic_on_warn, int, 0644); |
| 574 | 575 | core_param(crash_kexec_post_notifiers, crash_kexec_post_notifiers, bool, 0644); | |
| 575 | static int __init setup_crash_kexec_post_notifiers(char *s) | ||
| 576 | { | ||
| 577 | crash_kexec_post_notifiers = true; | ||
| 578 | return 0; | ||
| 579 | } | ||
| 580 | early_param("crash_kexec_post_notifiers", setup_crash_kexec_post_notifiers); | ||
| 581 | 576 | ||
| 582 | static int __init oops_setup(char *s) | 577 | static int __init oops_setup(char *s) |
| 583 | { | 578 | { |
diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h index 7fd2838fa417..5d4505f30083 100644 --- a/kernel/printk/internal.h +++ b/kernel/printk/internal.h | |||
| @@ -16,9 +16,11 @@ | |||
| 16 | */ | 16 | */ |
| 17 | #include <linux/percpu.h> | 17 | #include <linux/percpu.h> |
| 18 | 18 | ||
| 19 | typedef __printf(1, 0) int (*printk_func_t)(const char *fmt, va_list args); | 19 | typedef __printf(2, 0) int (*printk_func_t)(int level, const char *fmt, |
| 20 | va_list args); | ||
| 20 | 21 | ||
| 21 | int __printf(1, 0) vprintk_default(const char *fmt, va_list args); | 22 | __printf(2, 0) |
| 23 | int vprintk_default(int level, const char *fmt, va_list args); | ||
| 22 | 24 | ||
| 23 | #ifdef CONFIG_PRINTK_NMI | 25 | #ifdef CONFIG_PRINTK_NMI |
| 24 | 26 | ||
| @@ -31,9 +33,10 @@ extern raw_spinlock_t logbuf_lock; | |||
| 31 | * via per-CPU variable. | 33 | * via per-CPU variable. |
| 32 | */ | 34 | */ |
| 33 | DECLARE_PER_CPU(printk_func_t, printk_func); | 35 | DECLARE_PER_CPU(printk_func_t, printk_func); |
| 34 | static inline __printf(1, 0) int vprintk_func(const char *fmt, va_list args) | 36 | __printf(2, 0) |
| 37 | static inline int vprintk_func(int level, const char *fmt, va_list args) | ||
| 35 | { | 38 | { |
| 36 | return this_cpu_read(printk_func)(fmt, args); | 39 | return this_cpu_read(printk_func)(level, fmt, args); |
| 37 | } | 40 | } |
| 38 | 41 | ||
| 39 | extern atomic_t nmi_message_lost; | 42 | extern atomic_t nmi_message_lost; |
| @@ -44,9 +47,10 @@ static inline int get_nmi_message_lost(void) | |||
| 44 | 47 | ||
| 45 | #else /* CONFIG_PRINTK_NMI */ | 48 | #else /* CONFIG_PRINTK_NMI */ |
| 46 | 49 | ||
| 47 | static inline __printf(1, 0) int vprintk_func(const char *fmt, va_list args) | 50 | __printf(2, 0) |
| 51 | static inline int vprintk_func(int level, const char *fmt, va_list args) | ||
| 48 | { | 52 | { |
| 49 | return vprintk_default(fmt, args); | 53 | return vprintk_default(level, fmt, args); |
| 50 | } | 54 | } |
| 51 | 55 | ||
| 52 | static inline int get_nmi_message_lost(void) | 56 | static inline int get_nmi_message_lost(void) |
diff --git a/kernel/printk/nmi.c b/kernel/printk/nmi.c index b69eb8a2876f..bc3eeb1ae6da 100644 --- a/kernel/printk/nmi.c +++ b/kernel/printk/nmi.c | |||
| @@ -58,7 +58,7 @@ static DEFINE_PER_CPU(struct nmi_seq_buf, nmi_print_seq); | |||
| 58 | * one writer running. But the buffer might get flushed from another | 58 | * one writer running. But the buffer might get flushed from another |
| 59 | * CPU, so we need to be careful. | 59 | * CPU, so we need to be careful. |
| 60 | */ | 60 | */ |
| 61 | static int vprintk_nmi(const char *fmt, va_list args) | 61 | static int vprintk_nmi(int level, const char *fmt, va_list args) |
| 62 | { | 62 | { |
| 63 | struct nmi_seq_buf *s = this_cpu_ptr(&nmi_print_seq); | 63 | struct nmi_seq_buf *s = this_cpu_ptr(&nmi_print_seq); |
| 64 | int add = 0; | 64 | int add = 0; |
| @@ -79,7 +79,16 @@ again: | |||
| 79 | if (!len) | 79 | if (!len) |
| 80 | smp_rmb(); | 80 | smp_rmb(); |
| 81 | 81 | ||
| 82 | add = vsnprintf(s->buffer + len, sizeof(s->buffer) - len, fmt, args); | 82 | if (level != LOGLEVEL_DEFAULT) { |
| 83 | add = snprintf(s->buffer + len, sizeof(s->buffer) - len, | ||
| 84 | KERN_SOH "%c", '0' + level); | ||
| 85 | add += vsnprintf(s->buffer + len + add, | ||
| 86 | sizeof(s->buffer) - len - add, | ||
| 87 | fmt, args); | ||
| 88 | } else { | ||
| 89 | add = vsnprintf(s->buffer + len, sizeof(s->buffer) - len, | ||
| 90 | fmt, args); | ||
| 91 | } | ||
| 83 | 92 | ||
| 84 | /* | 93 | /* |
| 85 | * Do it once again if the buffer has been flushed in the meantime. | 94 | * Do it once again if the buffer has been flushed in the meantime. |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index d4de33934dac..a5ef95ca18c9 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/nmi.h> | 26 | #include <linux/nmi.h> |
| 27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
| 29 | #include <linux/interrupt.h> /* For in_interrupt() */ | ||
| 30 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
| 31 | #include <linux/smp.h> | 30 | #include <linux/smp.h> |
| 32 | #include <linux/security.h> | 31 | #include <linux/security.h> |
| @@ -48,7 +47,7 @@ | |||
| 48 | #include <linux/uio.h> | 47 | #include <linux/uio.h> |
| 49 | 48 | ||
| 50 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
| 51 | #include <asm-generic/sections.h> | 50 | #include <asm/sections.h> |
| 52 | 51 | ||
| 53 | #define CREATE_TRACE_POINTS | 52 | #define CREATE_TRACE_POINTS |
| 54 | #include <trace/events/printk.h> | 53 | #include <trace/events/printk.h> |
| @@ -86,6 +85,111 @@ static struct lockdep_map console_lock_dep_map = { | |||
| 86 | }; | 85 | }; |
| 87 | #endif | 86 | #endif |
| 88 | 87 | ||
| 88 | enum devkmsg_log_bits { | ||
| 89 | __DEVKMSG_LOG_BIT_ON = 0, | ||
| 90 | __DEVKMSG_LOG_BIT_OFF, | ||
| 91 | __DEVKMSG_LOG_BIT_LOCK, | ||
| 92 | }; | ||
| 93 | |||
| 94 | enum devkmsg_log_masks { | ||
| 95 | DEVKMSG_LOG_MASK_ON = BIT(__DEVKMSG_LOG_BIT_ON), | ||
| 96 | DEVKMSG_LOG_MASK_OFF = BIT(__DEVKMSG_LOG_BIT_OFF), | ||
| 97 | DEVKMSG_LOG_MASK_LOCK = BIT(__DEVKMSG_LOG_BIT_LOCK), | ||
| 98 | }; | ||
| 99 | |||
| 100 | /* Keep both the 'on' and 'off' bits clear, i.e. ratelimit by default: */ | ||
| 101 | #define DEVKMSG_LOG_MASK_DEFAULT 0 | ||
| 102 | |||
| 103 | static unsigned int __read_mostly devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT; | ||
| 104 | |||
| 105 | static int __control_devkmsg(char *str) | ||
| 106 | { | ||
| 107 | if (!str) | ||
| 108 | return -EINVAL; | ||
| 109 | |||
| 110 | if (!strncmp(str, "on", 2)) { | ||
| 111 | devkmsg_log = DEVKMSG_LOG_MASK_ON; | ||
| 112 | return 2; | ||
| 113 | } else if (!strncmp(str, "off", 3)) { | ||
| 114 | devkmsg_log = DEVKMSG_LOG_MASK_OFF; | ||
| 115 | return 3; | ||
| 116 | } else if (!strncmp(str, "ratelimit", 9)) { | ||
| 117 | devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT; | ||
| 118 | return 9; | ||
| 119 | } | ||
| 120 | return -EINVAL; | ||
| 121 | } | ||
| 122 | |||
| 123 | static int __init control_devkmsg(char *str) | ||
| 124 | { | ||
| 125 | if (__control_devkmsg(str) < 0) | ||
| 126 | return 1; | ||
| 127 | |||
| 128 | /* | ||
| 129 | * Set sysctl string accordingly: | ||
| 130 | */ | ||
| 131 | if (devkmsg_log == DEVKMSG_LOG_MASK_ON) { | ||
| 132 | memset(devkmsg_log_str, 0, DEVKMSG_STR_MAX_SIZE); | ||
| 133 | strncpy(devkmsg_log_str, "on", 2); | ||
| 134 | } else if (devkmsg_log == DEVKMSG_LOG_MASK_OFF) { | ||
| 135 | memset(devkmsg_log_str, 0, DEVKMSG_STR_MAX_SIZE); | ||
| 136 | strncpy(devkmsg_log_str, "off", 3); | ||
| 137 | } | ||
| 138 | /* else "ratelimit" which is set by default. */ | ||
| 139 | |||
| 140 | /* | ||
| 141 | * Sysctl cannot change it anymore. The kernel command line setting of | ||
| 142 | * this parameter is to force the setting to be permanent throughout the | ||
| 143 | * runtime of the system. This is a precation measure against userspace | ||
| 144 | * trying to be a smarta** and attempting to change it up on us. | ||
| 145 | */ | ||
| 146 | devkmsg_log |= DEVKMSG_LOG_MASK_LOCK; | ||
| 147 | |||
| 148 | return 0; | ||
| 149 | } | ||
| 150 | __setup("printk.devkmsg=", control_devkmsg); | ||
| 151 | |||
| 152 | char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit"; | ||
| 153 | |||
| 154 | int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, | ||
| 155 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
| 156 | { | ||
| 157 | char old_str[DEVKMSG_STR_MAX_SIZE]; | ||
| 158 | unsigned int old; | ||
| 159 | int err; | ||
| 160 | |||
| 161 | if (write) { | ||
| 162 | if (devkmsg_log & DEVKMSG_LOG_MASK_LOCK) | ||
| 163 | return -EINVAL; | ||
| 164 | |||
| 165 | old = devkmsg_log; | ||
| 166 | strncpy(old_str, devkmsg_log_str, DEVKMSG_STR_MAX_SIZE); | ||
| 167 | } | ||
| 168 | |||
| 169 | err = proc_dostring(table, write, buffer, lenp, ppos); | ||
| 170 | if (err) | ||
| 171 | return err; | ||
| 172 | |||
| 173 | if (write) { | ||
| 174 | err = __control_devkmsg(devkmsg_log_str); | ||
| 175 | |||
| 176 | /* | ||
| 177 | * Do not accept an unknown string OR a known string with | ||
| 178 | * trailing crap... | ||
| 179 | */ | ||
| 180 | if (err < 0 || (err + 1 != *lenp)) { | ||
| 181 | |||
| 182 | /* ... and restore old setting. */ | ||
| 183 | devkmsg_log = old; | ||
| 184 | strncpy(devkmsg_log_str, old_str, DEVKMSG_STR_MAX_SIZE); | ||
| 185 | |||
| 186 | return -EINVAL; | ||
| 187 | } | ||
| 188 | } | ||
| 189 | |||
| 190 | return 0; | ||
| 191 | } | ||
| 192 | |||
| 89 | /* | 193 | /* |
| 90 | * Number of registered extended console drivers. | 194 | * Number of registered extended console drivers. |
| 91 | * | 195 | * |
| @@ -614,6 +718,7 @@ struct devkmsg_user { | |||
| 614 | u64 seq; | 718 | u64 seq; |
| 615 | u32 idx; | 719 | u32 idx; |
| 616 | enum log_flags prev; | 720 | enum log_flags prev; |
| 721 | struct ratelimit_state rs; | ||
| 617 | struct mutex lock; | 722 | struct mutex lock; |
| 618 | char buf[CONSOLE_EXT_LOG_MAX]; | 723 | char buf[CONSOLE_EXT_LOG_MAX]; |
| 619 | }; | 724 | }; |
| @@ -623,11 +728,24 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from) | |||
| 623 | char *buf, *line; | 728 | char *buf, *line; |
| 624 | int level = default_message_loglevel; | 729 | int level = default_message_loglevel; |
| 625 | int facility = 1; /* LOG_USER */ | 730 | int facility = 1; /* LOG_USER */ |
| 731 | struct file *file = iocb->ki_filp; | ||
| 732 | struct devkmsg_user *user = file->private_data; | ||
| 626 | size_t len = iov_iter_count(from); | 733 | size_t len = iov_iter_count(from); |
| 627 | ssize_t ret = len; | 734 | ssize_t ret = len; |
| 628 | 735 | ||
| 629 | if (len > LOG_LINE_MAX) | 736 | if (!user || len > LOG_LINE_MAX) |
| 630 | return -EINVAL; | 737 | return -EINVAL; |
| 738 | |||
| 739 | /* Ignore when user logging is disabled. */ | ||
| 740 | if (devkmsg_log & DEVKMSG_LOG_MASK_OFF) | ||
| 741 | return len; | ||
| 742 | |||
| 743 | /* Ratelimit when not explicitly enabled. */ | ||
| 744 | if (!(devkmsg_log & DEVKMSG_LOG_MASK_ON)) { | ||
| 745 | if (!___ratelimit(&user->rs, current->comm)) | ||
| 746 | return ret; | ||
| 747 | } | ||
| 748 | |||
| 631 | buf = kmalloc(len+1, GFP_KERNEL); | 749 | buf = kmalloc(len+1, GFP_KERNEL); |
| 632 | if (buf == NULL) | 750 | if (buf == NULL) |
| 633 | return -ENOMEM; | 751 | return -ENOMEM; |
| @@ -800,19 +918,24 @@ static int devkmsg_open(struct inode *inode, struct file *file) | |||
| 800 | struct devkmsg_user *user; | 918 | struct devkmsg_user *user; |
| 801 | int err; | 919 | int err; |
| 802 | 920 | ||
| 803 | /* write-only does not need any file context */ | 921 | if (devkmsg_log & DEVKMSG_LOG_MASK_OFF) |
| 804 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) | 922 | return -EPERM; |
| 805 | return 0; | ||
| 806 | 923 | ||
| 807 | err = check_syslog_permissions(SYSLOG_ACTION_READ_ALL, | 924 | /* write-only does not need any file context */ |
| 808 | SYSLOG_FROM_READER); | 925 | if ((file->f_flags & O_ACCMODE) != O_WRONLY) { |
| 809 | if (err) | 926 | err = check_syslog_permissions(SYSLOG_ACTION_READ_ALL, |
| 810 | return err; | 927 | SYSLOG_FROM_READER); |
| 928 | if (err) | ||
| 929 | return err; | ||
| 930 | } | ||
| 811 | 931 | ||
| 812 | user = kmalloc(sizeof(struct devkmsg_user), GFP_KERNEL); | 932 | user = kmalloc(sizeof(struct devkmsg_user), GFP_KERNEL); |
| 813 | if (!user) | 933 | if (!user) |
| 814 | return -ENOMEM; | 934 | return -ENOMEM; |
| 815 | 935 | ||
| 936 | ratelimit_default_init(&user->rs); | ||
| 937 | ratelimit_set_flags(&user->rs, RATELIMIT_MSG_ON_RELEASE); | ||
| 938 | |||
| 816 | mutex_init(&user->lock); | 939 | mutex_init(&user->lock); |
| 817 | 940 | ||
| 818 | raw_spin_lock_irq(&logbuf_lock); | 941 | raw_spin_lock_irq(&logbuf_lock); |
| @@ -831,6 +954,8 @@ static int devkmsg_release(struct inode *inode, struct file *file) | |||
| 831 | if (!user) | 954 | if (!user) |
| 832 | return 0; | 955 | return 0; |
| 833 | 956 | ||
| 957 | ratelimit_state_exit(&user->rs); | ||
| 958 | |||
| 834 | mutex_destroy(&user->lock); | 959 | mutex_destroy(&user->lock); |
| 835 | kfree(user); | 960 | kfree(user); |
| 836 | return 0; | 961 | return 0; |
| @@ -986,6 +1111,11 @@ module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR); | |||
| 986 | MODULE_PARM_DESC(ignore_loglevel, | 1111 | MODULE_PARM_DESC(ignore_loglevel, |
| 987 | "ignore loglevel setting (prints all kernel messages to the console)"); | 1112 | "ignore loglevel setting (prints all kernel messages to the console)"); |
| 988 | 1113 | ||
| 1114 | static bool suppress_message_printing(int level) | ||
| 1115 | { | ||
| 1116 | return (level >= console_loglevel && !ignore_loglevel); | ||
| 1117 | } | ||
| 1118 | |||
| 989 | #ifdef CONFIG_BOOT_PRINTK_DELAY | 1119 | #ifdef CONFIG_BOOT_PRINTK_DELAY |
| 990 | 1120 | ||
| 991 | static int boot_delay; /* msecs delay after each printk during bootup */ | 1121 | static int boot_delay; /* msecs delay after each printk during bootup */ |
| @@ -1015,7 +1145,7 @@ static void boot_delay_msec(int level) | |||
| 1015 | unsigned long timeout; | 1145 | unsigned long timeout; |
| 1016 | 1146 | ||
| 1017 | if ((boot_delay == 0 || system_state != SYSTEM_BOOTING) | 1147 | if ((boot_delay == 0 || system_state != SYSTEM_BOOTING) |
| 1018 | || (level >= console_loglevel && !ignore_loglevel)) { | 1148 | || suppress_message_printing(level)) { |
| 1019 | return; | 1149 | return; |
| 1020 | } | 1150 | } |
| 1021 | 1151 | ||
| @@ -1439,8 +1569,6 @@ static void call_console_drivers(int level, | |||
| 1439 | 1569 | ||
| 1440 | trace_console(text, len); | 1570 | trace_console(text, len); |
| 1441 | 1571 | ||
| 1442 | if (level >= console_loglevel && !ignore_loglevel) | ||
| 1443 | return; | ||
| 1444 | if (!console_drivers) | 1572 | if (!console_drivers) |
| 1445 | return; | 1573 | return; |
| 1446 | 1574 | ||
| @@ -1802,7 +1930,28 @@ asmlinkage int printk_emit(int facility, int level, | |||
| 1802 | } | 1930 | } |
| 1803 | EXPORT_SYMBOL(printk_emit); | 1931 | EXPORT_SYMBOL(printk_emit); |
| 1804 | 1932 | ||
| 1805 | int vprintk_default(const char *fmt, va_list args) | 1933 | #ifdef CONFIG_PRINTK |
| 1934 | #define define_pr_level(func, loglevel) \ | ||
| 1935 | asmlinkage __visible void func(const char *fmt, ...) \ | ||
| 1936 | { \ | ||
| 1937 | va_list args; \ | ||
| 1938 | \ | ||
| 1939 | va_start(args, fmt); \ | ||
| 1940 | vprintk_default(loglevel, fmt, args); \ | ||
| 1941 | va_end(args); \ | ||
| 1942 | } \ | ||
| 1943 | EXPORT_SYMBOL(func) | ||
| 1944 | |||
| 1945 | define_pr_level(__pr_emerg, LOGLEVEL_EMERG); | ||
| 1946 | define_pr_level(__pr_alert, LOGLEVEL_ALERT); | ||
| 1947 | define_pr_level(__pr_crit, LOGLEVEL_CRIT); | ||
| 1948 | define_pr_level(__pr_err, LOGLEVEL_ERR); | ||
| 1949 | define_pr_level(__pr_warn, LOGLEVEL_WARNING); | ||
| 1950 | define_pr_level(__pr_notice, LOGLEVEL_NOTICE); | ||
| 1951 | define_pr_level(__pr_info, LOGLEVEL_INFO); | ||
| 1952 | #endif | ||
| 1953 | |||
| 1954 | int vprintk_default(int level, const char *fmt, va_list args) | ||
| 1806 | { | 1955 | { |
| 1807 | int r; | 1956 | int r; |
| 1808 | 1957 | ||
| @@ -1812,7 +1961,7 @@ int vprintk_default(const char *fmt, va_list args) | |||
| 1812 | return r; | 1961 | return r; |
| 1813 | } | 1962 | } |
| 1814 | #endif | 1963 | #endif |
| 1815 | r = vprintk_emit(0, LOGLEVEL_DEFAULT, NULL, 0, fmt, args); | 1964 | r = vprintk_emit(0, level, NULL, 0, fmt, args); |
| 1816 | 1965 | ||
| 1817 | return r; | 1966 | return r; |
| 1818 | } | 1967 | } |
| @@ -1845,7 +1994,7 @@ asmlinkage __visible int printk(const char *fmt, ...) | |||
| 1845 | int r; | 1994 | int r; |
| 1846 | 1995 | ||
| 1847 | va_start(args, fmt); | 1996 | va_start(args, fmt); |
| 1848 | r = vprintk_func(fmt, args); | 1997 | r = vprintk_func(LOGLEVEL_DEFAULT, fmt, args); |
| 1849 | va_end(args); | 1998 | va_end(args); |
| 1850 | 1999 | ||
| 1851 | return r; | 2000 | return r; |
| @@ -1888,6 +2037,7 @@ static void call_console_drivers(int level, | |||
| 1888 | static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, | 2037 | static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, |
| 1889 | bool syslog, char *buf, size_t size) { return 0; } | 2038 | bool syslog, char *buf, size_t size) { return 0; } |
| 1890 | static size_t cont_print_text(char *text, size_t size) { return 0; } | 2039 | static size_t cont_print_text(char *text, size_t size) { return 0; } |
| 2040 | static bool suppress_message_printing(int level) { return false; } | ||
| 1891 | 2041 | ||
| 1892 | /* Still needs to be defined for users */ | 2042 | /* Still needs to be defined for users */ |
| 1893 | DEFINE_PER_CPU(printk_func_t, printk_func); | 2043 | DEFINE_PER_CPU(printk_func_t, printk_func); |
| @@ -2167,6 +2317,13 @@ static void console_cont_flush(char *text, size_t size) | |||
| 2167 | if (!cont.len) | 2317 | if (!cont.len) |
| 2168 | goto out; | 2318 | goto out; |
| 2169 | 2319 | ||
| 2320 | if (suppress_message_printing(cont.level)) { | ||
| 2321 | cont.cons = cont.len; | ||
| 2322 | if (cont.flushed) | ||
| 2323 | cont.len = 0; | ||
| 2324 | goto out; | ||
| 2325 | } | ||
| 2326 | |||
| 2170 | /* | 2327 | /* |
| 2171 | * We still queue earlier records, likely because the console was | 2328 | * We still queue earlier records, likely because the console was |
| 2172 | * busy. The earlier ones need to be printed before this one, we | 2329 | * busy. The earlier ones need to be printed before this one, we |
| @@ -2270,10 +2427,13 @@ skip: | |||
| 2270 | break; | 2427 | break; |
| 2271 | 2428 | ||
| 2272 | msg = log_from_idx(console_idx); | 2429 | msg = log_from_idx(console_idx); |
| 2273 | if (msg->flags & LOG_NOCONS) { | 2430 | level = msg->level; |
| 2431 | if ((msg->flags & LOG_NOCONS) || | ||
| 2432 | suppress_message_printing(level)) { | ||
| 2274 | /* | 2433 | /* |
| 2275 | * Skip record we have buffered and already printed | 2434 | * Skip record we have buffered and already printed |
| 2276 | * directly to the console when we received it. | 2435 | * directly to the console when we received it, and |
| 2436 | * record that has level above the console loglevel. | ||
| 2277 | */ | 2437 | */ |
| 2278 | console_idx = log_next(console_idx); | 2438 | console_idx = log_next(console_idx); |
| 2279 | console_seq++; | 2439 | console_seq++; |
| @@ -2287,7 +2447,6 @@ skip: | |||
| 2287 | goto skip; | 2447 | goto skip; |
| 2288 | } | 2448 | } |
| 2289 | 2449 | ||
| 2290 | level = msg->level; | ||
| 2291 | len += msg_print_text(msg, console_prev, false, | 2450 | len += msg_print_text(msg, console_prev, false, |
| 2292 | text + len, sizeof(text) - len); | 2451 | text + len, sizeof(text) - len); |
| 2293 | if (nr_ext_console_drivers) { | 2452 | if (nr_ext_console_drivers) { |
diff --git a/kernel/relay.c b/kernel/relay.c index 04d7cf3ef8cf..d797502140b9 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
| @@ -451,6 +451,13 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu) | |||
| 451 | if (!dentry) | 451 | if (!dentry) |
| 452 | goto free_buf; | 452 | goto free_buf; |
| 453 | relay_set_buf_dentry(buf, dentry); | 453 | relay_set_buf_dentry(buf, dentry); |
| 454 | } else { | ||
| 455 | /* Only retrieve global info, nothing more, nothing less */ | ||
| 456 | dentry = chan->cb->create_buf_file(NULL, NULL, | ||
| 457 | S_IRUSR, buf, | ||
| 458 | &chan->is_global); | ||
| 459 | if (WARN_ON(dentry)) | ||
| 460 | goto free_buf; | ||
| 454 | } | 461 | } |
| 455 | 462 | ||
| 456 | buf->cpu = cpu; | 463 | buf->cpu = cpu; |
| @@ -562,6 +569,10 @@ static int relay_hotcpu_callback(struct notifier_block *nb, | |||
| 562 | * attributes specified. The created channel buffer files | 569 | * attributes specified. The created channel buffer files |
| 563 | * will be named base_filename0...base_filenameN-1. File | 570 | * will be named base_filename0...base_filenameN-1. File |
| 564 | * permissions will be %S_IRUSR. | 571 | * permissions will be %S_IRUSR. |
| 572 | * | ||
| 573 | * If opening a buffer (@parent = NULL) that you later wish to register | ||
| 574 | * in a filesystem, call relay_late_setup_files() once the @parent dentry | ||
| 575 | * is available. | ||
| 565 | */ | 576 | */ |
| 566 | struct rchan *relay_open(const char *base_filename, | 577 | struct rchan *relay_open(const char *base_filename, |
| 567 | struct dentry *parent, | 578 | struct dentry *parent, |
| @@ -640,8 +651,12 @@ static void __relay_set_buf_dentry(void *info) | |||
| 640 | * | 651 | * |
| 641 | * Returns 0 if successful, non-zero otherwise. | 652 | * Returns 0 if successful, non-zero otherwise. |
| 642 | * | 653 | * |
| 643 | * Use to setup files for a previously buffer-only channel. | 654 | * Use to setup files for a previously buffer-only channel created |
| 644 | * Useful to do early tracing in kernel, before VFS is up, for example. | 655 | * by relay_open() with a NULL parent dentry. |
| 656 | * | ||
| 657 | * For example, this is useful for perfomring early tracing in kernel, | ||
| 658 | * before VFS is up and then exposing the early results once the dentry | ||
| 659 | * is available. | ||
| 645 | */ | 660 | */ |
| 646 | int relay_late_setup_files(struct rchan *chan, | 661 | int relay_late_setup_files(struct rchan *chan, |
| 647 | const char *base_filename, | 662 | const char *base_filename, |
| @@ -666,6 +681,20 @@ int relay_late_setup_files(struct rchan *chan, | |||
| 666 | } | 681 | } |
| 667 | chan->has_base_filename = 1; | 682 | chan->has_base_filename = 1; |
| 668 | chan->parent = parent; | 683 | chan->parent = parent; |
| 684 | |||
| 685 | if (chan->is_global) { | ||
| 686 | err = -EINVAL; | ||
| 687 | if (!WARN_ON_ONCE(!chan->buf[0])) { | ||
| 688 | dentry = relay_create_buf_file(chan, chan->buf[0], 0); | ||
| 689 | if (dentry && !WARN_ON_ONCE(!chan->is_global)) { | ||
| 690 | relay_set_buf_dentry(chan->buf[0], dentry); | ||
| 691 | err = 0; | ||
| 692 | } | ||
| 693 | } | ||
| 694 | mutex_unlock(&relay_channels_mutex); | ||
| 695 | return err; | ||
| 696 | } | ||
| 697 | |||
| 669 | curr_cpu = get_cpu(); | 698 | curr_cpu = get_cpu(); |
| 670 | /* | 699 | /* |
| 671 | * The CPU hotplug notifier ran before us and created buffers with | 700 | * The CPU hotplug notifier ran before us and created buffers with |
| @@ -706,6 +735,7 @@ int relay_late_setup_files(struct rchan *chan, | |||
| 706 | 735 | ||
| 707 | return err; | 736 | return err; |
| 708 | } | 737 | } |
| 738 | EXPORT_SYMBOL_GPL(relay_late_setup_files); | ||
| 709 | 739 | ||
| 710 | /** | 740 | /** |
| 711 | * relay_switch_subbuf - switch to a new sub-buffer | 741 | * relay_switch_subbuf - switch to a new sub-buffer |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 53954631a4e1..b43d0b27c1fe 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -814,6 +814,13 @@ static struct ctl_table kern_table[] = { | |||
| 814 | .extra2 = &ten_thousand, | 814 | .extra2 = &ten_thousand, |
| 815 | }, | 815 | }, |
| 816 | { | 816 | { |
| 817 | .procname = "printk_devkmsg", | ||
| 818 | .data = devkmsg_log_str, | ||
| 819 | .maxlen = DEVKMSG_STR_MAX_SIZE, | ||
| 820 | .mode = 0644, | ||
| 821 | .proc_handler = devkmsg_sysctl_set_loglvl, | ||
| 822 | }, | ||
| 823 | { | ||
| 817 | .procname = "dmesg_restrict", | 824 | .procname = "dmesg_restrict", |
| 818 | .data = &dmesg_restrict, | 825 | .data = &dmesg_restrict, |
| 819 | .maxlen = sizeof(int), | 826 | .maxlen = sizeof(int), |
diff --git a/kernel/task_work.c b/kernel/task_work.c index 6ab4842b00e8..d513051fcca2 100644 --- a/kernel/task_work.c +++ b/kernel/task_work.c | |||
| @@ -29,7 +29,7 @@ task_work_add(struct task_struct *task, struct callback_head *work, bool notify) | |||
| 29 | struct callback_head *head; | 29 | struct callback_head *head; |
| 30 | 30 | ||
| 31 | do { | 31 | do { |
| 32 | head = ACCESS_ONCE(task->task_works); | 32 | head = READ_ONCE(task->task_works); |
| 33 | if (unlikely(head == &work_exited)) | 33 | if (unlikely(head == &work_exited)) |
| 34 | return -ESRCH; | 34 | return -ESRCH; |
| 35 | work->next = head; | 35 | work->next = head; |
| @@ -57,6 +57,9 @@ task_work_cancel(struct task_struct *task, task_work_func_t func) | |||
| 57 | struct callback_head **pprev = &task->task_works; | 57 | struct callback_head **pprev = &task->task_works; |
| 58 | struct callback_head *work; | 58 | struct callback_head *work; |
| 59 | unsigned long flags; | 59 | unsigned long flags; |
| 60 | |||
| 61 | if (likely(!task->task_works)) | ||
| 62 | return NULL; | ||
| 60 | /* | 63 | /* |
| 61 | * If cmpxchg() fails we continue without updating pprev. | 64 | * If cmpxchg() fails we continue without updating pprev. |
| 62 | * Either we raced with task_work_add() which added the | 65 | * Either we raced with task_work_add() which added the |
| @@ -64,8 +67,7 @@ task_work_cancel(struct task_struct *task, task_work_func_t func) | |||
| 64 | * we raced with task_work_run(), *pprev == NULL/exited. | 67 | * we raced with task_work_run(), *pprev == NULL/exited. |
| 65 | */ | 68 | */ |
| 66 | raw_spin_lock_irqsave(&task->pi_lock, flags); | 69 | raw_spin_lock_irqsave(&task->pi_lock, flags); |
| 67 | while ((work = ACCESS_ONCE(*pprev))) { | 70 | while ((work = lockless_dereference(*pprev))) { |
| 68 | smp_read_barrier_depends(); | ||
| 69 | if (work->func != func) | 71 | if (work->func != func) |
| 70 | pprev = &work->next; | 72 | pprev = &work->next; |
| 71 | else if (cmpxchg(pprev, work, work->next) == work) | 73 | else if (cmpxchg(pprev, work, work->next) == work) |
| @@ -95,7 +97,7 @@ void task_work_run(void) | |||
| 95 | * work_exited unless the list is empty. | 97 | * work_exited unless the list is empty. |
| 96 | */ | 98 | */ |
| 97 | do { | 99 | do { |
| 98 | work = ACCESS_ONCE(task->task_works); | 100 | work = READ_ONCE(task->task_works); |
| 99 | head = !work && (task->flags & PF_EXITING) ? | 101 | head = !work && (task->flags & PF_EXITING) ? |
| 100 | &work_exited : NULL; | 102 | &work_exited : NULL; |
| 101 | } while (cmpxchg(&task->task_works, work, head) != work); | 103 | } while (cmpxchg(&task->task_works, work, head) != work); |
