aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-08-01 18:55:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-01 18:55:31 -0400
commite48af7aaf1e6d266414b11540339e6d2dac20ad2 (patch)
tree4ff43886fc31c4f37db1780f9a504c5680123100
parented780686de61ab27e65f1cfedeccd7b45667bd70 (diff)
parentfbb0e4da96f4503e65bc4fb627cf4e1d7c8c64e6 (diff)
Merge tag 'please-pull-misc-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux
Pull ia64 updates from Tony Luck: "Miscellaneous ia64 cleanups" * tag 'please-pull-misc-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux: ia64: salinfo: use a waitqueue instead a sema down/up combo ia64: efi: use timespec64 for persistent clock
-rw-r--r--arch/ia64/kernel/efi.c4
-rw-r--r--arch/ia64/kernel/salinfo.c38
-rw-r--r--arch/ia64/kernel/time.c2
-rw-r--r--include/linux/efi.h2
4 files changed, 14 insertions, 32 deletions
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 3b7a60e40e8a..121295637d0d 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -236,7 +236,7 @@ STUB_GET_NEXT_HIGH_MONO_COUNT(virt, id)
236STUB_RESET_SYSTEM(virt, id) 236STUB_RESET_SYSTEM(virt, id)
237 237
238void 238void
239efi_gettimeofday (struct timespec *ts) 239efi_gettimeofday (struct timespec64 *ts)
240{ 240{
241 efi_time_t tm; 241 efi_time_t tm;
242 242
@@ -245,7 +245,7 @@ efi_gettimeofday (struct timespec *ts)
245 return; 245 return;
246 } 246 }
247 247
248 ts->tv_sec = mktime(tm.year, tm.month, tm.day, 248 ts->tv_sec = mktime64(tm.year, tm.month, tm.day,
249 tm.hour, tm.minute, tm.second); 249 tm.hour, tm.minute, tm.second);
250 ts->tv_nsec = tm.nanosecond; 250 ts->tv_nsec = tm.nanosecond;
251} 251}
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index 1eeffb7fbb16..5313007d5423 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -141,7 +141,7 @@ enum salinfo_state {
141 141
142struct salinfo_data { 142struct salinfo_data {
143 cpumask_t cpu_event; /* which cpus have outstanding events */ 143 cpumask_t cpu_event; /* which cpus have outstanding events */
144 struct semaphore mutex; 144 wait_queue_head_t read_wait;
145 u8 *log_buffer; 145 u8 *log_buffer;
146 u64 log_size; 146 u64 log_size;
147 u8 *oemdata; /* decoded oem data */ 147 u8 *oemdata; /* decoded oem data */
@@ -182,21 +182,6 @@ struct salinfo_platform_oemdata_parms {
182 int ret; 182 int ret;
183}; 183};
184 184
185/* Kick the mutex that tells user space that there is work to do. Instead of
186 * trying to track the state of the mutex across multiple cpus, in user
187 * context, interrupt context, non-maskable interrupt context and hotplug cpu,
188 * it is far easier just to grab the mutex if it is free then release it.
189 *
190 * This routine must be called with data_saved_lock held, to make the down/up
191 * operation atomic.
192 */
193static void
194salinfo_work_to_do(struct salinfo_data *data)
195{
196 (void)(down_trylock(&data->mutex) ?: 0);
197 up(&data->mutex);
198}
199
200static void 185static void
201salinfo_platform_oemdata_cpu(void *context) 186salinfo_platform_oemdata_cpu(void *context)
202{ 187{
@@ -258,7 +243,7 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
258 } 243 }
259 cpumask_set_cpu(smp_processor_id(), &data->cpu_event); 244 cpumask_set_cpu(smp_processor_id(), &data->cpu_event);
260 if (irqsafe) { 245 if (irqsafe) {
261 salinfo_work_to_do(data); 246 wake_up_interruptible(&data->read_wait);
262 spin_unlock_irqrestore(&data_saved_lock, flags); 247 spin_unlock_irqrestore(&data_saved_lock, flags);
263 } 248 }
264} 249}
@@ -271,14 +256,10 @@ extern void ia64_mlogbuf_dump(void);
271static void 256static void
272salinfo_timeout_check(struct salinfo_data *data) 257salinfo_timeout_check(struct salinfo_data *data)
273{ 258{
274 unsigned long flags;
275 if (!data->open) 259 if (!data->open)
276 return; 260 return;
277 if (!cpumask_empty(&data->cpu_event)) { 261 if (!cpumask_empty(&data->cpu_event))
278 spin_lock_irqsave(&data_saved_lock, flags); 262 wake_up_interruptible(&data->read_wait);
279 salinfo_work_to_do(data);
280 spin_unlock_irqrestore(&data_saved_lock, flags);
281 }
282} 263}
283 264
284static void 265static void
@@ -308,10 +289,11 @@ salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t
308 int i, n, cpu = -1; 289 int i, n, cpu = -1;
309 290
310retry: 291retry:
311 if (cpumask_empty(&data->cpu_event) && down_trylock(&data->mutex)) { 292 if (cpumask_empty(&data->cpu_event)) {
312 if (file->f_flags & O_NONBLOCK) 293 if (file->f_flags & O_NONBLOCK)
313 return -EAGAIN; 294 return -EAGAIN;
314 if (down_interruptible(&data->mutex)) 295 if (wait_event_interruptible(data->read_wait,
296 !cpumask_empty(&data->cpu_event)))
315 return -EINTR; 297 return -EINTR;
316 } 298 }
317 299
@@ -510,7 +492,7 @@ salinfo_log_clear(struct salinfo_data *data, int cpu)
510 if (data->state == STATE_LOG_RECORD) { 492 if (data->state == STATE_LOG_RECORD) {
511 spin_lock_irqsave(&data_saved_lock, flags); 493 spin_lock_irqsave(&data_saved_lock, flags);
512 cpumask_set_cpu(cpu, &data->cpu_event); 494 cpumask_set_cpu(cpu, &data->cpu_event);
513 salinfo_work_to_do(data); 495 wake_up_interruptible(&data->read_wait);
514 spin_unlock_irqrestore(&data_saved_lock, flags); 496 spin_unlock_irqrestore(&data_saved_lock, flags);
515 } 497 }
516 return 0; 498 return 0;
@@ -582,7 +564,7 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu
582 i < ARRAY_SIZE(salinfo_data); 564 i < ARRAY_SIZE(salinfo_data);
583 ++i, ++data) { 565 ++i, ++data) {
584 cpumask_set_cpu(cpu, &data->cpu_event); 566 cpumask_set_cpu(cpu, &data->cpu_event);
585 salinfo_work_to_do(data); 567 wake_up_interruptible(&data->read_wait);
586 } 568 }
587 spin_unlock_irqrestore(&data_saved_lock, flags); 569 spin_unlock_irqrestore(&data_saved_lock, flags);
588 break; 570 break;
@@ -640,7 +622,7 @@ salinfo_init(void)
640 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { 622 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
641 data = salinfo_data + i; 623 data = salinfo_data + i;
642 data->type = i; 624 data->type = i;
643 sema_init(&data->mutex, 1); 625 init_waitqueue_head(&data->read_wait);
644 dir = proc_mkdir(salinfo_log_name[i], salinfo_dir); 626 dir = proc_mkdir(salinfo_log_name[i], salinfo_dir);
645 if (!dir) 627 if (!dir)
646 continue; 628 continue;
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index c8dbe2acd735..6f892b94e906 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -355,7 +355,7 @@ static struct irqaction timer_irqaction = {
355 .name = "timer" 355 .name = "timer"
356}; 356};
357 357
358void read_persistent_clock(struct timespec *ts) 358void read_persistent_clock64(struct timespec64 *ts)
359{ 359{
360 efi_gettimeofday(ts); 360 efi_gettimeofday(ts);
361} 361}
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 7f80a75ee9e3..7f5a58225385 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -879,7 +879,7 @@ extern void efi_init (void);
879extern void *efi_get_pal_addr (void); 879extern void *efi_get_pal_addr (void);
880extern void efi_map_pal_code (void); 880extern void efi_map_pal_code (void);
881extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); 881extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
882extern void efi_gettimeofday (struct timespec *ts); 882extern void efi_gettimeofday (struct timespec64 *ts);
883extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ 883extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */
884#ifdef CONFIG_X86 884#ifdef CONFIG_X86
885extern void efi_late_init(void); 885extern void efi_late_init(void);