diff options
Diffstat (limited to 'arch/ia64/kernel')
-rw-r--r-- | arch/ia64/kernel/machine_kexec.c | 3 | ||||
-rw-r--r-- | arch/ia64/kernel/mca_drv.c | 3 | ||||
-rw-r--r-- | arch/ia64/kernel/perfmon.c | 52 | ||||
-rw-r--r-- | arch/ia64/kernel/process.c | 7 | ||||
-rw-r--r-- | arch/ia64/kernel/signal.c | 4 | ||||
-rw-r--r-- | arch/ia64/kernel/time.c | 66 |
6 files changed, 69 insertions, 66 deletions
diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c index 070e8effa175..5151a649c96b 100644 --- a/arch/ia64/kernel/machine_kexec.c +++ b/arch/ia64/kernel/machine_kexec.c | |||
@@ -85,12 +85,13 @@ static void ia64_machine_kexec(struct unw_frame_info *info, void *arg) | |||
85 | struct kimage *image = arg; | 85 | struct kimage *image = arg; |
86 | relocate_new_kernel_t rnk; | 86 | relocate_new_kernel_t rnk; |
87 | void *pal_addr = efi_get_pal_addr(); | 87 | void *pal_addr = efi_get_pal_addr(); |
88 | unsigned long code_addr = (unsigned long)page_address(image->control_code_page); | 88 | unsigned long code_addr; |
89 | int ii; | 89 | int ii; |
90 | u64 fp, gp; | 90 | u64 fp, gp; |
91 | ia64_fptr_t *init_handler = (ia64_fptr_t *)ia64_os_init_on_kdump; | 91 | ia64_fptr_t *init_handler = (ia64_fptr_t *)ia64_os_init_on_kdump; |
92 | 92 | ||
93 | BUG_ON(!image); | 93 | BUG_ON(!image); |
94 | code_addr = (unsigned long)page_address(image->control_code_page); | ||
94 | if (image->type == KEXEC_TYPE_CRASH) { | 95 | if (image->type == KEXEC_TYPE_CRASH) { |
95 | crash_save_this_cpu(); | 96 | crash_save_this_cpu(); |
96 | current->thread.ksp = (__u64)info->sw - 16; | 97 | current->thread.ksp = (__u64)info->sw - 16; |
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c index 1c2e89406721..9392e021c93b 100644 --- a/arch/ia64/kernel/mca_drv.c +++ b/arch/ia64/kernel/mca_drv.c | |||
@@ -158,7 +158,8 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr) | |||
158 | ia64_mlogbuf_dump(); | 158 | ia64_mlogbuf_dump(); |
159 | printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, " | 159 | printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, " |
160 | "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", | 160 | "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", |
161 | raw_smp_processor_id(), current->pid, current_uid(), | 161 | raw_smp_processor_id(), current->pid, |
162 | from_kuid(&init_user_ns, current_uid()), | ||
162 | iip, ipsr, paddr, current->comm); | 163 | iip, ipsr, paddr, current->comm); |
163 | 164 | ||
164 | spin_lock(&mca_bh_lock); | 165 | spin_lock(&mca_bh_lock); |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 3fa4bc536953..ea39eba61ef5 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -2306,8 +2306,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t | |||
2306 | * partially initialize the vma for the sampling buffer | 2306 | * partially initialize the vma for the sampling buffer |
2307 | */ | 2307 | */ |
2308 | vma->vm_mm = mm; | 2308 | vma->vm_mm = mm; |
2309 | vma->vm_file = filp; | 2309 | vma->vm_file = get_file(filp); |
2310 | vma->vm_flags = VM_READ| VM_MAYREAD |VM_RESERVED; | 2310 | vma->vm_flags = VM_READ|VM_MAYREAD|VM_DONTEXPAND|VM_DONTDUMP; |
2311 | vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */ | 2311 | vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */ |
2312 | 2312 | ||
2313 | /* | 2313 | /* |
@@ -2345,8 +2345,6 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t | |||
2345 | goto error; | 2345 | goto error; |
2346 | } | 2346 | } |
2347 | 2347 | ||
2348 | get_file(filp); | ||
2349 | |||
2350 | /* | 2348 | /* |
2351 | * now insert the vma in the vm list for the process, must be | 2349 | * now insert the vma in the vm list for the process, must be |
2352 | * done with mmap lock held | 2350 | * done with mmap lock held |
@@ -2380,8 +2378,8 @@ static int | |||
2380 | pfm_bad_permissions(struct task_struct *task) | 2378 | pfm_bad_permissions(struct task_struct *task) |
2381 | { | 2379 | { |
2382 | const struct cred *tcred; | 2380 | const struct cred *tcred; |
2383 | uid_t uid = current_uid(); | 2381 | kuid_t uid = current_uid(); |
2384 | gid_t gid = current_gid(); | 2382 | kgid_t gid = current_gid(); |
2385 | int ret; | 2383 | int ret; |
2386 | 2384 | ||
2387 | rcu_read_lock(); | 2385 | rcu_read_lock(); |
@@ -2389,20 +2387,20 @@ pfm_bad_permissions(struct task_struct *task) | |||
2389 | 2387 | ||
2390 | /* inspired by ptrace_attach() */ | 2388 | /* inspired by ptrace_attach() */ |
2391 | DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n", | 2389 | DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n", |
2392 | uid, | 2390 | from_kuid(&init_user_ns, uid), |
2393 | gid, | 2391 | from_kgid(&init_user_ns, gid), |
2394 | tcred->euid, | 2392 | from_kuid(&init_user_ns, tcred->euid), |
2395 | tcred->suid, | 2393 | from_kuid(&init_user_ns, tcred->suid), |
2396 | tcred->uid, | 2394 | from_kuid(&init_user_ns, tcred->uid), |
2397 | tcred->egid, | 2395 | from_kgid(&init_user_ns, tcred->egid), |
2398 | tcred->sgid)); | 2396 | from_kgid(&init_user_ns, tcred->sgid))); |
2399 | 2397 | ||
2400 | ret = ((uid != tcred->euid) | 2398 | ret = ((!uid_eq(uid, tcred->euid)) |
2401 | || (uid != tcred->suid) | 2399 | || (!uid_eq(uid, tcred->suid)) |
2402 | || (uid != tcred->uid) | 2400 | || (!uid_eq(uid, tcred->uid)) |
2403 | || (gid != tcred->egid) | 2401 | || (!gid_eq(gid, tcred->egid)) |
2404 | || (gid != tcred->sgid) | 2402 | || (!gid_eq(gid, tcred->sgid)) |
2405 | || (gid != tcred->gid)) && !capable(CAP_SYS_PTRACE); | 2403 | || (!gid_eq(gid, tcred->gid))) && !capable(CAP_SYS_PTRACE); |
2406 | 2404 | ||
2407 | rcu_read_unlock(); | 2405 | rcu_read_unlock(); |
2408 | return ret; | 2406 | return ret; |
@@ -4782,7 +4780,7 @@ recheck: | |||
4782 | asmlinkage long | 4780 | asmlinkage long |
4783 | sys_perfmonctl (int fd, int cmd, void __user *arg, int count) | 4781 | sys_perfmonctl (int fd, int cmd, void __user *arg, int count) |
4784 | { | 4782 | { |
4785 | struct file *file = NULL; | 4783 | struct fd f = {NULL, 0}; |
4786 | pfm_context_t *ctx = NULL; | 4784 | pfm_context_t *ctx = NULL; |
4787 | unsigned long flags = 0UL; | 4785 | unsigned long flags = 0UL; |
4788 | void *args_k = NULL; | 4786 | void *args_k = NULL; |
@@ -4879,17 +4877,17 @@ restart_args: | |||
4879 | 4877 | ||
4880 | ret = -EBADF; | 4878 | ret = -EBADF; |
4881 | 4879 | ||
4882 | file = fget(fd); | 4880 | f = fdget(fd); |
4883 | if (unlikely(file == NULL)) { | 4881 | if (unlikely(f.file == NULL)) { |
4884 | DPRINT(("invalid fd %d\n", fd)); | 4882 | DPRINT(("invalid fd %d\n", fd)); |
4885 | goto error_args; | 4883 | goto error_args; |
4886 | } | 4884 | } |
4887 | if (unlikely(PFM_IS_FILE(file) == 0)) { | 4885 | if (unlikely(PFM_IS_FILE(f.file) == 0)) { |
4888 | DPRINT(("fd %d not related to perfmon\n", fd)); | 4886 | DPRINT(("fd %d not related to perfmon\n", fd)); |
4889 | goto error_args; | 4887 | goto error_args; |
4890 | } | 4888 | } |
4891 | 4889 | ||
4892 | ctx = file->private_data; | 4890 | ctx = f.file->private_data; |
4893 | if (unlikely(ctx == NULL)) { | 4891 | if (unlikely(ctx == NULL)) { |
4894 | DPRINT(("no context for fd %d\n", fd)); | 4892 | DPRINT(("no context for fd %d\n", fd)); |
4895 | goto error_args; | 4893 | goto error_args; |
@@ -4919,8 +4917,8 @@ abort_locked: | |||
4919 | if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; | 4917 | if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; |
4920 | 4918 | ||
4921 | error_args: | 4919 | error_args: |
4922 | if (file) | 4920 | if (f.file) |
4923 | fput(file); | 4921 | fdput(f); |
4924 | 4922 | ||
4925 | kfree(args_k); | 4923 | kfree(args_k); |
4926 | 4924 | ||
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index dd6fc1449741..ee31fe9b310e 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/kdebug.h> | 29 | #include <linux/kdebug.h> |
30 | #include <linux/utsname.h> | 30 | #include <linux/utsname.h> |
31 | #include <linux/tracehook.h> | 31 | #include <linux/tracehook.h> |
32 | #include <linux/rcupdate.h> | ||
32 | 33 | ||
33 | #include <asm/cpu.h> | 34 | #include <asm/cpu.h> |
34 | #include <asm/delay.h> | 35 | #include <asm/delay.h> |
@@ -196,8 +197,8 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall) | |||
196 | ia64_do_signal(scr, in_syscall); | 197 | ia64_do_signal(scr, in_syscall); |
197 | } | 198 | } |
198 | 199 | ||
199 | if (test_thread_flag(TIF_NOTIFY_RESUME)) { | 200 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) { |
200 | clear_thread_flag(TIF_NOTIFY_RESUME); | 201 | local_irq_enable(); /* force interrupt enable */ |
201 | tracehook_notify_resume(&scr->pt); | 202 | tracehook_notify_resume(&scr->pt); |
202 | } | 203 | } |
203 | 204 | ||
@@ -279,6 +280,7 @@ cpu_idle (void) | |||
279 | 280 | ||
280 | /* endless idle loop with no priority at all */ | 281 | /* endless idle loop with no priority at all */ |
281 | while (1) { | 282 | while (1) { |
283 | rcu_idle_enter(); | ||
282 | if (can_do_pal_halt) { | 284 | if (can_do_pal_halt) { |
283 | current_thread_info()->status &= ~TS_POLLING; | 285 | current_thread_info()->status &= ~TS_POLLING; |
284 | /* | 286 | /* |
@@ -309,6 +311,7 @@ cpu_idle (void) | |||
309 | normal_xtp(); | 311 | normal_xtp(); |
310 | #endif | 312 | #endif |
311 | } | 313 | } |
314 | rcu_idle_exit(); | ||
312 | schedule_preempt_disabled(); | 315 | schedule_preempt_disabled(); |
313 | check_pgt_cache(); | 316 | check_pgt_cache(); |
314 | if (cpu_is_offline(cpu)) | 317 | if (cpu_is_offline(cpu)) |
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c index 19f89c09d40d..680b73786be8 100644 --- a/arch/ia64/kernel/signal.c +++ b/arch/ia64/kernel/signal.c | |||
@@ -220,7 +220,7 @@ ia64_rt_sigreturn (struct sigscratch *scr) | |||
220 | si.si_errno = 0; | 220 | si.si_errno = 0; |
221 | si.si_code = SI_KERNEL; | 221 | si.si_code = SI_KERNEL; |
222 | si.si_pid = task_pid_vnr(current); | 222 | si.si_pid = task_pid_vnr(current); |
223 | si.si_uid = current_uid(); | 223 | si.si_uid = from_kuid_munged(current_user_ns(), current_uid()); |
224 | si.si_addr = sc; | 224 | si.si_addr = sc; |
225 | force_sig_info(SIGSEGV, &si, current); | 225 | force_sig_info(SIGSEGV, &si, current); |
226 | return retval; | 226 | return retval; |
@@ -317,7 +317,7 @@ force_sigsegv_info (int sig, void __user *addr) | |||
317 | si.si_errno = 0; | 317 | si.si_errno = 0; |
318 | si.si_code = SI_KERNEL; | 318 | si.si_code = SI_KERNEL; |
319 | si.si_pid = task_pid_vnr(current); | 319 | si.si_pid = task_pid_vnr(current); |
320 | si.si_uid = current_uid(); | 320 | si.si_uid = from_kuid_munged(current_user_ns(), current_uid()); |
321 | si.si_addr = addr; | 321 | si.si_addr = addr; |
322 | force_sig_info(SIGSEGV, &si, current); | 322 | force_sig_info(SIGSEGV, &si, current); |
323 | return 0; | 323 | return 0; |
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index ecc904b33c5f..80ff9acc5edf 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c | |||
@@ -83,32 +83,36 @@ static struct clocksource *itc_clocksource; | |||
83 | 83 | ||
84 | extern cputime_t cycle_to_cputime(u64 cyc); | 84 | extern cputime_t cycle_to_cputime(u64 cyc); |
85 | 85 | ||
86 | static void vtime_account_user(struct task_struct *tsk) | ||
87 | { | ||
88 | cputime_t delta_utime; | ||
89 | struct thread_info *ti = task_thread_info(tsk); | ||
90 | |||
91 | if (ti->ac_utime) { | ||
92 | delta_utime = cycle_to_cputime(ti->ac_utime); | ||
93 | account_user_time(tsk, delta_utime, delta_utime); | ||
94 | ti->ac_utime = 0; | ||
95 | } | ||
96 | } | ||
97 | |||
86 | /* | 98 | /* |
87 | * Called from the context switch with interrupts disabled, to charge all | 99 | * Called from the context switch with interrupts disabled, to charge all |
88 | * accumulated times to the current process, and to prepare accounting on | 100 | * accumulated times to the current process, and to prepare accounting on |
89 | * the next process. | 101 | * the next process. |
90 | */ | 102 | */ |
91 | void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next) | 103 | void vtime_task_switch(struct task_struct *prev) |
92 | { | 104 | { |
93 | struct thread_info *pi = task_thread_info(prev); | 105 | struct thread_info *pi = task_thread_info(prev); |
94 | struct thread_info *ni = task_thread_info(next); | 106 | struct thread_info *ni = task_thread_info(current); |
95 | cputime_t delta_stime, delta_utime; | ||
96 | __u64 now; | ||
97 | 107 | ||
98 | now = ia64_get_itc(); | ||
99 | |||
100 | delta_stime = cycle_to_cputime(pi->ac_stime + (now - pi->ac_stamp)); | ||
101 | if (idle_task(smp_processor_id()) != prev) | 108 | if (idle_task(smp_processor_id()) != prev) |
102 | account_system_time(prev, 0, delta_stime, delta_stime); | 109 | vtime_account_system(prev); |
103 | else | 110 | else |
104 | account_idle_time(delta_stime); | 111 | vtime_account_idle(prev); |
105 | 112 | ||
106 | if (pi->ac_utime) { | 113 | vtime_account_user(prev); |
107 | delta_utime = cycle_to_cputime(pi->ac_utime); | ||
108 | account_user_time(prev, delta_utime, delta_utime); | ||
109 | } | ||
110 | 114 | ||
111 | pi->ac_stamp = ni->ac_stamp = now; | 115 | pi->ac_stamp = ni->ac_stamp; |
112 | ni->ac_stime = ni->ac_utime = 0; | 116 | ni->ac_stime = ni->ac_utime = 0; |
113 | } | 117 | } |
114 | 118 | ||
@@ -116,29 +120,32 @@ void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next) | |||
116 | * Account time for a transition between system, hard irq or soft irq state. | 120 | * Account time for a transition between system, hard irq or soft irq state. |
117 | * Note that this function is called with interrupts enabled. | 121 | * Note that this function is called with interrupts enabled. |
118 | */ | 122 | */ |
119 | void account_system_vtime(struct task_struct *tsk) | 123 | static cputime_t vtime_delta(struct task_struct *tsk) |
120 | { | 124 | { |
121 | struct thread_info *ti = task_thread_info(tsk); | 125 | struct thread_info *ti = task_thread_info(tsk); |
122 | unsigned long flags; | ||
123 | cputime_t delta_stime; | 126 | cputime_t delta_stime; |
124 | __u64 now; | 127 | __u64 now; |
125 | 128 | ||
126 | local_irq_save(flags); | ||
127 | |||
128 | now = ia64_get_itc(); | 129 | now = ia64_get_itc(); |
129 | 130 | ||
130 | delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); | 131 | delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); |
131 | if (irq_count() || idle_task(smp_processor_id()) != tsk) | ||
132 | account_system_time(tsk, 0, delta_stime, delta_stime); | ||
133 | else | ||
134 | account_idle_time(delta_stime); | ||
135 | ti->ac_stime = 0; | 132 | ti->ac_stime = 0; |
136 | |||
137 | ti->ac_stamp = now; | 133 | ti->ac_stamp = now; |
138 | 134 | ||
139 | local_irq_restore(flags); | 135 | return delta_stime; |
136 | } | ||
137 | |||
138 | void vtime_account_system(struct task_struct *tsk) | ||
139 | { | ||
140 | cputime_t delta = vtime_delta(tsk); | ||
141 | |||
142 | account_system_time(tsk, 0, delta, delta); | ||
143 | } | ||
144 | |||
145 | void vtime_account_idle(struct task_struct *tsk) | ||
146 | { | ||
147 | account_idle_time(vtime_delta(tsk)); | ||
140 | } | 148 | } |
141 | EXPORT_SYMBOL_GPL(account_system_vtime); | ||
142 | 149 | ||
143 | /* | 150 | /* |
144 | * Called from the timer interrupt handler to charge accumulated user time | 151 | * Called from the timer interrupt handler to charge accumulated user time |
@@ -146,14 +153,7 @@ EXPORT_SYMBOL_GPL(account_system_vtime); | |||
146 | */ | 153 | */ |
147 | void account_process_tick(struct task_struct *p, int user_tick) | 154 | void account_process_tick(struct task_struct *p, int user_tick) |
148 | { | 155 | { |
149 | struct thread_info *ti = task_thread_info(p); | 156 | vtime_account_user(p); |
150 | cputime_t delta_utime; | ||
151 | |||
152 | if (ti->ac_utime) { | ||
153 | delta_utime = cycle_to_cputime(ti->ac_utime); | ||
154 | account_user_time(p, delta_utime, delta_utime); | ||
155 | ti->ac_utime = 0; | ||
156 | } | ||
157 | } | 157 | } |
158 | 158 | ||
159 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ | 159 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ |