aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLCPD Auto Merger2017-08-12 17:11:19 -0500
committerLCPD Auto Merger2017-08-12 17:11:19 -0500
commitc1452110058ddac60648ea4e3a33fb8bc6143c20 (patch)
treec7b05b2998778ea51404cca182b1947816e6c356 /arch
parentb80afa6ffdcdfa146879d5db60da8d19c22c42d7 (diff)
parent78f902ff441b17f8a3c51e0211fa69c052e9cbbe (diff)
downloadkernel-omap-c1452110058ddac60648ea4e3a33fb8bc6143c20.tar.gz
kernel-omap-c1452110058ddac60648ea4e3a33fb8bc6143c20.tar.xz
kernel-omap-c1452110058ddac60648ea4e3a33fb8bc6143c20.zip
Merge branch 'ti-linux-4.4.y' of git.ti.com:ti-linux-kernel/ti-linux-kernel into ti-lsk-android-linux-4.4.y
TI-Feature: ti_linux_base_android TI-Tree: git@git.ti.com:ti-linux-kernel/ti-linux-kernel.git TI-Branch: ti-linux-4.4.y * 'ti-linux-4.4.y' of git.ti.com:ti-linux-kernel/ti-linux-kernel: (59 commits) Linux 4.4.81 workqueue: implicit ordered attribute should be overridable net: account for current skb length when deciding about UFO ipv4: Should use consistent conditional judgement for ip fragment in __ip_append_data and ip_finish_output mm: don't dereference struct page fields of invalid pages signal: protect SIGNAL_UNKILLABLE from unintentional clearing. lib/Kconfig.debug: fix frv build failure mm, slab: make sure that KMALLOC_MAX_SIZE will fit into MAX_ORDER ARM: 8632/1: ftrace: fix syscall name matching virtio_blk: fix panic in initialization error path drm/virtio: fix framebuffer sparse warning scsi: qla2xxx: Get mutex lock before checking optrom_state phy state machine: failsafe leave invalid RUNNING state x86/boot: Add missing declaration of string functions tg3: Fix race condition in tg3_get_stats64(). net: phy: dp83867: fix irq generation sh_eth: R8A7740 supports packet shecksumming wext: handle NULL extra data in iwe_stream_add_point better sparc64: Measure receiver forward progress to avoid send mondo timeout xen-netback: correctly schedule rate-limited queues ... Signed-off-by: LCPD Auto Merger <lcpd_integration@list.ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boot/dts/armada-388-gp.dts4
-rw-r--r--arch/arm/include/asm/ftrace.h18
-rw-r--r--arch/sparc/include/asm/trap_block.h1
-rw-r--r--arch/sparc/kernel/smp_64.c185
-rw-r--r--arch/sparc/kernel/sun4v_ivec.S15
-rw-r--r--arch/sparc/kernel/traps_64.c1
-rw-r--r--arch/x86/boot/string.c1
-rw-r--r--arch/x86/boot/string.h9
-rw-r--r--arch/x86/kernel/kvm.c6
9 files changed, 166 insertions, 74 deletions
diff --git a/arch/arm/boot/dts/armada-388-gp.dts b/arch/arm/boot/dts/armada-388-gp.dts
index cd316021d6ce..6c1b45c1af66 100644
--- a/arch/arm/boot/dts/armada-388-gp.dts
+++ b/arch/arm/boot/dts/armada-388-gp.dts
@@ -89,7 +89,7 @@
89 pinctrl-names = "default"; 89 pinctrl-names = "default";
90 pinctrl-0 = <&pca0_pins>; 90 pinctrl-0 = <&pca0_pins>;
91 interrupt-parent = <&gpio0>; 91 interrupt-parent = <&gpio0>;
92 interrupts = <18 IRQ_TYPE_EDGE_FALLING>; 92 interrupts = <18 IRQ_TYPE_LEVEL_LOW>;
93 gpio-controller; 93 gpio-controller;
94 #gpio-cells = <2>; 94 #gpio-cells = <2>;
95 interrupt-controller; 95 interrupt-controller;
@@ -101,7 +101,7 @@
101 compatible = "nxp,pca9555"; 101 compatible = "nxp,pca9555";
102 pinctrl-names = "default"; 102 pinctrl-names = "default";
103 interrupt-parent = <&gpio0>; 103 interrupt-parent = <&gpio0>;
104 interrupts = <18 IRQ_TYPE_EDGE_FALLING>; 104 interrupts = <18 IRQ_TYPE_LEVEL_LOW>;
105 gpio-controller; 105 gpio-controller;
106 #gpio-cells = <2>; 106 #gpio-cells = <2>;
107 interrupt-controller; 107 interrupt-controller;
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index bfe2a2f5a644..22b73112b75f 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -54,6 +54,24 @@ static inline void *return_address(unsigned int level)
54 54
55#define ftrace_return_address(n) return_address(n) 55#define ftrace_return_address(n) return_address(n)
56 56
57#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
58
59static inline bool arch_syscall_match_sym_name(const char *sym,
60 const char *name)
61{
62 if (!strcmp(sym, "sys_mmap2"))
63 sym = "sys_mmap_pgoff";
64 else if (!strcmp(sym, "sys_statfs64_wrapper"))
65 sym = "sys_statfs64";
66 else if (!strcmp(sym, "sys_fstatfs64_wrapper"))
67 sym = "sys_fstatfs64";
68 else if (!strcmp(sym, "sys_arm_fadvise64_64"))
69 sym = "sys_fadvise64_64";
70
71 /* Ignore case since sym may start with "SyS" instead of "sys" */
72 return !strcasecmp(sym, name);
73}
74
57#endif /* ifndef __ASSEMBLY__ */ 75#endif /* ifndef __ASSEMBLY__ */
58 76
59#endif /* _ASM_ARM_FTRACE */ 77#endif /* _ASM_ARM_FTRACE */
diff --git a/arch/sparc/include/asm/trap_block.h b/arch/sparc/include/asm/trap_block.h
index ec9c04de3664..ff05992dae7a 100644
--- a/arch/sparc/include/asm/trap_block.h
+++ b/arch/sparc/include/asm/trap_block.h
@@ -54,6 +54,7 @@ extern struct trap_per_cpu trap_block[NR_CPUS];
54void init_cur_cpu_trap(struct thread_info *); 54void init_cur_cpu_trap(struct thread_info *);
55void setup_tba(void); 55void setup_tba(void);
56extern int ncpus_probed; 56extern int ncpus_probed;
57extern u64 cpu_mondo_counter[NR_CPUS];
57 58
58unsigned long real_hard_smp_processor_id(void); 59unsigned long real_hard_smp_processor_id(void);
59 60
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 95a9fa0d2195..4511caa3b7e9 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -617,22 +617,48 @@ retry:
617 } 617 }
618} 618}
619 619
620/* Multi-cpu list version. */ 620#define CPU_MONDO_COUNTER(cpuid) (cpu_mondo_counter[cpuid])
621#define MONDO_USEC_WAIT_MIN 2
622#define MONDO_USEC_WAIT_MAX 100
623#define MONDO_RETRY_LIMIT 500000
624
625/* Multi-cpu list version.
626 *
627 * Deliver xcalls to 'cnt' number of cpus in 'cpu_list'.
628 * Sometimes not all cpus receive the mondo, requiring us to re-send
629 * the mondo until all cpus have received, or cpus are truly stuck
630 * unable to receive mondo, and we timeout.
631 * Occasionally a target cpu strand is borrowed briefly by hypervisor to
632 * perform guest service, such as PCIe error handling. Consider the
633 * service time, 1 second overall wait is reasonable for 1 cpu.
634 * Here two in-between mondo check wait time are defined: 2 usec for
635 * single cpu quick turn around and up to 100usec for large cpu count.
636 * Deliver mondo to large number of cpus could take longer, we adjusts
637 * the retry count as long as target cpus are making forward progress.
638 */
621static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt) 639static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt)
622{ 640{
623 int retries, this_cpu, prev_sent, i, saw_cpu_error; 641 int this_cpu, tot_cpus, prev_sent, i, rem;
642 int usec_wait, retries, tot_retries;
643 u16 first_cpu = 0xffff;
644 unsigned long xc_rcvd = 0;
624 unsigned long status; 645 unsigned long status;
646 int ecpuerror_id = 0;
647 int enocpu_id = 0;
625 u16 *cpu_list; 648 u16 *cpu_list;
649 u16 cpu;
626 650
627 this_cpu = smp_processor_id(); 651 this_cpu = smp_processor_id();
628
629 cpu_list = __va(tb->cpu_list_pa); 652 cpu_list = __va(tb->cpu_list_pa);
630 653 usec_wait = cnt * MONDO_USEC_WAIT_MIN;
631 saw_cpu_error = 0; 654 if (usec_wait > MONDO_USEC_WAIT_MAX)
632 retries = 0; 655 usec_wait = MONDO_USEC_WAIT_MAX;
656 retries = tot_retries = 0;
657 tot_cpus = cnt;
633 prev_sent = 0; 658 prev_sent = 0;
659
634 do { 660 do {
635 int forward_progress, n_sent; 661 int n_sent, mondo_delivered, target_cpu_busy;
636 662
637 status = sun4v_cpu_mondo_send(cnt, 663 status = sun4v_cpu_mondo_send(cnt,
638 tb->cpu_list_pa, 664 tb->cpu_list_pa,
@@ -640,94 +666,113 @@ static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt)
640 666
641 /* HV_EOK means all cpus received the xcall, we're done. */ 667 /* HV_EOK means all cpus received the xcall, we're done. */
642 if (likely(status == HV_EOK)) 668 if (likely(status == HV_EOK))
643 break; 669 goto xcall_done;
670
671 /* If not these non-fatal errors, panic */
672 if (unlikely((status != HV_EWOULDBLOCK) &&
673 (status != HV_ECPUERROR) &&
674 (status != HV_ENOCPU)))
675 goto fatal_errors;
644 676
645 /* First, see if we made any forward progress. 677 /* First, see if we made any forward progress.
646 * 678 *
679 * Go through the cpu_list, count the target cpus that have
680 * received our mondo (n_sent), and those that did not (rem).
681 * Re-pack cpu_list with the cpus remain to be retried in the
682 * front - this simplifies tracking the truly stalled cpus.
683 *
647 * The hypervisor indicates successful sends by setting 684 * The hypervisor indicates successful sends by setting
648 * cpu list entries to the value 0xffff. 685 * cpu list entries to the value 0xffff.
686 *
687 * EWOULDBLOCK means some target cpus did not receive the
688 * mondo and retry usually helps.
689 *
690 * ECPUERROR means at least one target cpu is in error state,
691 * it's usually safe to skip the faulty cpu and retry.
692 *
693 * ENOCPU means one of the target cpu doesn't belong to the
694 * domain, perhaps offlined which is unexpected, but not
695 * fatal and it's okay to skip the offlined cpu.
649 */ 696 */
697 rem = 0;
650 n_sent = 0; 698 n_sent = 0;
651 for (i = 0; i < cnt; i++) { 699 for (i = 0; i < cnt; i++) {
652 if (likely(cpu_list[i] == 0xffff)) 700 cpu = cpu_list[i];
701 if (likely(cpu == 0xffff)) {
653 n_sent++; 702 n_sent++;
703 } else if ((status == HV_ECPUERROR) &&
704 (sun4v_cpu_state(cpu) == HV_CPU_STATE_ERROR)) {
705 ecpuerror_id = cpu + 1;
706 } else if (status == HV_ENOCPU && !cpu_online(cpu)) {
707 enocpu_id = cpu + 1;
708 } else {
709 cpu_list[rem++] = cpu;
710 }
654 } 711 }
655 712
656 forward_progress = 0; 713 /* No cpu remained, we're done. */
657 if (n_sent > prev_sent) 714 if (rem == 0)
658 forward_progress = 1; 715 break;
659 716
660 prev_sent = n_sent; 717 /* Otherwise, update the cpu count for retry. */
718 cnt = rem;
661 719
662 /* If we get a HV_ECPUERROR, then one or more of the cpus 720 /* Record the overall number of mondos received by the
663 * in the list are in error state. Use the cpu_state() 721 * first of the remaining cpus.
664 * hypervisor call to find out which cpus are in error state.
665 */ 722 */
666 if (unlikely(status == HV_ECPUERROR)) { 723 if (first_cpu != cpu_list[0]) {
667 for (i = 0; i < cnt; i++) { 724 first_cpu = cpu_list[0];
668 long err; 725 xc_rcvd = CPU_MONDO_COUNTER(first_cpu);
669 u16 cpu; 726 }
670 727
671 cpu = cpu_list[i]; 728 /* Was any mondo delivered successfully? */
672 if (cpu == 0xffff) 729 mondo_delivered = (n_sent > prev_sent);
673 continue; 730 prev_sent = n_sent;
674 731
675 err = sun4v_cpu_state(cpu); 732 /* or, was any target cpu busy processing other mondos? */
676 if (err == HV_CPU_STATE_ERROR) { 733 target_cpu_busy = (xc_rcvd < CPU_MONDO_COUNTER(first_cpu));
677 saw_cpu_error = (cpu + 1); 734 xc_rcvd = CPU_MONDO_COUNTER(first_cpu);
678 cpu_list[i] = 0xffff;
679 }
680 }
681 } else if (unlikely(status != HV_EWOULDBLOCK))
682 goto fatal_mondo_error;
683 735
684 /* Don't bother rewriting the CPU list, just leave the 736 /* Retry count is for no progress. If we're making progress,
685 * 0xffff and non-0xffff entries in there and the 737 * reset the retry count.
686 * hypervisor will do the right thing.
687 *
688 * Only advance timeout state if we didn't make any
689 * forward progress.
690 */ 738 */
691 if (unlikely(!forward_progress)) { 739 if (likely(mondo_delivered || target_cpu_busy)) {
692 if (unlikely(++retries > 10000)) 740 tot_retries += retries;
693 goto fatal_mondo_timeout; 741 retries = 0;
694 742 } else if (unlikely(retries > MONDO_RETRY_LIMIT)) {
695 /* Delay a little bit to let other cpus catch up 743 goto fatal_mondo_timeout;
696 * on their cpu mondo queue work.
697 */
698 udelay(2 * cnt);
699 } 744 }
700 } while (1);
701 745
702 if (unlikely(saw_cpu_error)) 746 /* Delay a little bit to let other cpus catch up on
703 goto fatal_mondo_cpu_error; 747 * their cpu mondo queue work.
748 */
749 if (!mondo_delivered)
750 udelay(usec_wait);
704 751
705 return; 752 retries++;
753 } while (1);
706 754
707fatal_mondo_cpu_error: 755xcall_done:
708 printk(KERN_CRIT "CPU[%d]: SUN4V mondo cpu error, some target cpus " 756 if (unlikely(ecpuerror_id > 0)) {
709 "(including %d) were in error state\n", 757 pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) was in error state\n",
710 this_cpu, saw_cpu_error - 1); 758 this_cpu, ecpuerror_id - 1);
759 } else if (unlikely(enocpu_id > 0)) {
760 pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) does not belong to the domain\n",
761 this_cpu, enocpu_id - 1);
762 }
711 return; 763 return;
712 764
765fatal_errors:
766 /* fatal errors include bad alignment, etc */
767 pr_crit("CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) mondo_block_pa(%lx)\n",
768 this_cpu, tot_cpus, tb->cpu_list_pa, tb->cpu_mondo_block_pa);
769 panic("Unexpected SUN4V mondo error %lu\n", status);
770
713fatal_mondo_timeout: 771fatal_mondo_timeout:
714 printk(KERN_CRIT "CPU[%d]: SUN4V mondo timeout, no forward " 772 /* some cpus being non-responsive to the cpu mondo */
715 " progress after %d retries.\n", 773 pr_crit("CPU[%d]: SUN4V mondo timeout, cpu(%d) made no forward progress after %d retries. Total target cpus(%d).\n",
716 this_cpu, retries); 774 this_cpu, first_cpu, (tot_retries + retries), tot_cpus);
717 goto dump_cpu_list_and_out; 775 panic("SUN4V mondo timeout panic\n");
718
719fatal_mondo_error:
720 printk(KERN_CRIT "CPU[%d]: Unexpected SUN4V mondo error %lu\n",
721 this_cpu, status);
722 printk(KERN_CRIT "CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) "
723 "mondo_block_pa(%lx)\n",
724 this_cpu, cnt, tb->cpu_list_pa, tb->cpu_mondo_block_pa);
725
726dump_cpu_list_and_out:
727 printk(KERN_CRIT "CPU[%d]: CPU list [ ", this_cpu);
728 for (i = 0; i < cnt; i++)
729 printk("%u ", cpu_list[i]);
730 printk("]\n");
731} 776}
732 777
733static void (*xcall_deliver_impl)(struct trap_per_cpu *, int); 778static void (*xcall_deliver_impl)(struct trap_per_cpu *, int);
diff --git a/arch/sparc/kernel/sun4v_ivec.S b/arch/sparc/kernel/sun4v_ivec.S
index 559bc5e9c199..34631995859a 100644
--- a/arch/sparc/kernel/sun4v_ivec.S
+++ b/arch/sparc/kernel/sun4v_ivec.S
@@ -26,6 +26,21 @@ sun4v_cpu_mondo:
26 ldxa [%g0] ASI_SCRATCHPAD, %g4 26 ldxa [%g0] ASI_SCRATCHPAD, %g4
27 sub %g4, TRAP_PER_CPU_FAULT_INFO, %g4 27 sub %g4, TRAP_PER_CPU_FAULT_INFO, %g4
28 28
29 /* Get smp_processor_id() into %g3 */
30 sethi %hi(trap_block), %g5
31 or %g5, %lo(trap_block), %g5
32 sub %g4, %g5, %g3
33 srlx %g3, TRAP_BLOCK_SZ_SHIFT, %g3
34
35 /* Increment cpu_mondo_counter[smp_processor_id()] */
36 sethi %hi(cpu_mondo_counter), %g5
37 or %g5, %lo(cpu_mondo_counter), %g5
38 sllx %g3, 3, %g3
39 add %g5, %g3, %g5
40 ldx [%g5], %g3
41 add %g3, 1, %g3
42 stx %g3, [%g5]
43
29 /* Get CPU mondo queue base phys address into %g7. */ 44 /* Get CPU mondo queue base phys address into %g7. */
30 ldx [%g4 + TRAP_PER_CPU_CPU_MONDO_PA], %g7 45 ldx [%g4 + TRAP_PER_CPU_CPU_MONDO_PA], %g7
31 46
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index cc97a43268ee..d883c5951e8b 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -2659,6 +2659,7 @@ void do_getpsr(struct pt_regs *regs)
2659 } 2659 }
2660} 2660}
2661 2661
2662u64 cpu_mondo_counter[NR_CPUS] = {0};
2662struct trap_per_cpu trap_block[NR_CPUS]; 2663struct trap_per_cpu trap_block[NR_CPUS];
2663EXPORT_SYMBOL(trap_block); 2664EXPORT_SYMBOL(trap_block);
2664 2665
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
index 318b8465d302..06ceddb3a22e 100644
--- a/arch/x86/boot/string.c
+++ b/arch/x86/boot/string.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include "ctype.h" 16#include "ctype.h"
17#include "string.h"
17 18
18int memcmp(const void *s1, const void *s2, size_t len) 19int memcmp(const void *s1, const void *s2, size_t len)
19{ 20{
diff --git a/arch/x86/boot/string.h b/arch/x86/boot/string.h
index 725e820602b1..113588ddb43f 100644
--- a/arch/x86/boot/string.h
+++ b/arch/x86/boot/string.h
@@ -18,4 +18,13 @@ int memcmp(const void *s1, const void *s2, size_t len);
18#define memset(d,c,l) __builtin_memset(d,c,l) 18#define memset(d,c,l) __builtin_memset(d,c,l)
19#define memcmp __builtin_memcmp 19#define memcmp __builtin_memcmp
20 20
21extern int strcmp(const char *str1, const char *str2);
22extern int strncmp(const char *cs, const char *ct, size_t count);
23extern size_t strlen(const char *s);
24extern char *strstr(const char *s1, const char *s2);
25extern size_t strnlen(const char *s, size_t maxlen);
26extern unsigned int atou(const char *s);
27extern unsigned long long simple_strtoull(const char *cp, char **endp,
28 unsigned int base);
29
21#endif /* BOOT_STRING_H */ 30#endif /* BOOT_STRING_H */
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index cec49ecf5f31..32187f8a49b4 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -151,6 +151,8 @@ void kvm_async_pf_task_wait(u32 token)
151 if (hlist_unhashed(&n.link)) 151 if (hlist_unhashed(&n.link))
152 break; 152 break;
153 153
154 rcu_irq_exit();
155
154 if (!n.halted) { 156 if (!n.halted) {
155 local_irq_enable(); 157 local_irq_enable();
156 schedule(); 158 schedule();
@@ -159,11 +161,11 @@ void kvm_async_pf_task_wait(u32 token)
159 /* 161 /*
160 * We cannot reschedule. So halt. 162 * We cannot reschedule. So halt.
161 */ 163 */
162 rcu_irq_exit();
163 native_safe_halt(); 164 native_safe_halt();
164 local_irq_disable(); 165 local_irq_disable();
165 rcu_irq_enter();
166 } 166 }
167
168 rcu_irq_enter();
167 } 169 }
168 if (!n.halted) 170 if (!n.halted)
169 finish_wait(&n.wq, &wait); 171 finish_wait(&n.wq, &wait);