Home Home > GIT Browse > vanilla
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-06-18 15:48:42 +0200
committerTakashi Iwai <tiwai@suse.de>2018-06-18 15:48:42 +0200
commit804ab6814e2d0c7ab8b3df19b750bfd07f274cd6 (patch)
tree54ea1c5a0574bb9d81c0b4bd0817a075bc91e131
parent8532205832fba8d0c63c4c220d1d9a2f967ade57 (diff)
parent6754714e4c0682d7a31338369510e61795f87a33 (diff)
Merge branch 'SLE12-SP3' into openSUSE-42.3rpm-4.4.138-59
-rw-r--r--arch/x86/include/asm/cpufeature.h1
-rw-r--r--arch/x86/include/asm/spec_ctrl.h44
-rw-r--r--arch/x86/kernel/cpu/bugs.c2
-rw-r--r--arch/x86/kernel/cpu/spec_ctrl.c16
-rw-r--r--drivers/net/xen-netfront.c4
-rw-r--r--fs/jfs/xattr.c8
6 files changed, 49 insertions, 26 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 86c82a54a516..953b219024af 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -77,7 +77,6 @@
* word 7 und we not even attempting to do a nasty kABI breakage.
*/
#define X86_FEATURE_ZEN ( 2*32+ 4) /* "" CPU is AMD family 0x17 (Zen) */
-#define X86_FEATURE_IBRS_OFF ( 2*32+ 5) /* "" Force-disabled IBRS usage on kernel entry */
/* Other features, Linux-defined mapping, word 3 */
/* This range is used for feature bits which conflict or are synthesized */
diff --git a/arch/x86/include/asm/spec_ctrl.h b/arch/x86/include/asm/spec_ctrl.h
index a1437da9e0a6..936060d50ade 100644
--- a/arch/x86/include/asm/spec_ctrl.h
+++ b/arch/x86/include/asm/spec_ctrl.h
@@ -16,27 +16,55 @@
.endm
.macro ENABLE_IBRS_CLOBBER
- ALTERNATIVE "", "jmp .Lend_\@", X86_FEATURE_IBRS_OFF
+ ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_SPEC_CTRL
+ call x86_ibrs_enabled
+ test %eax, %eax
+ jz .Llfence_\@
__ENABLE_IBRS_CLOBBER
+ jmp .Lend_\@
+
+.Llfence_\@:
+ lfence
.Lend_\@:
.endm
.macro ENABLE_IBRS
- ALTERNATIVE "", "jmp .Lend_\@", X86_FEATURE_IBRS_OFF
+ ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_SPEC_CTRL
+
+ pushq %rax
+
+ call x86_ibrs_enabled
+ test %eax, %eax
+ jz .Llfence_\@
pushq %rcx
pushq %rdx
__ENABLE_IBRS_CLOBBER
popq %rdx
popq %rcx
+
+ jmp .Lpop_\@
+
+.Llfence_\@:
+ lfence
+
+.Lpop_\@:
+ popq %rax
+
.Lend_\@:
.endm
.macro DISABLE_IBRS
- ALTERNATIVE "", "jmp .Lend_\@", X86_FEATURE_IBRS_OFF
+ ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_SPEC_CTRL
+
+ pushq %rax
+
+ call x86_ibrs_enabled
+ test %eax, %eax
+ jz .Llfence_\@
pushq %rcx
pushq %rdx
@@ -46,6 +74,15 @@
wrmsr
popq %rdx
popq %rcx
+
+ jmp .Lpop_\@
+
+.Llfence_\@:
+ lfence
+
+.Lpop_\@:
+ popq %rax
+
.Lend_\@:
.endm
@@ -58,7 +95,6 @@ void x86_disable_ibrs(void);
unsigned int x86_ibrs_enabled(void);
unsigned int x86_ibpb_enabled(void);
void x86_spec_check(void);
-void noibrs(void);
int nospec(char *str);
static inline void x86_ibp_barrier(void)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index ea22ededefb9..60ab1d35f35a 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -423,7 +423,7 @@ retpoline_auto:
if (!is_skylake_era()) {
pr_info("Retpolines enabled, force-disabling IBRS due to !SKL-era core\n");
- noibrs();
+ ibrs_state = 0;
}
}
diff --git a/arch/x86/kernel/cpu/spec_ctrl.c b/arch/x86/kernel/cpu/spec_ctrl.c
index 78e25fe8572d..d1f497279022 100644
--- a/arch/x86/kernel/cpu/spec_ctrl.c
+++ b/arch/x86/kernel/cpu/spec_ctrl.c
@@ -59,7 +59,6 @@ void x86_spec_check(void)
if (ibrs_state == -1) {
/* noone force-disabled IBRS */
ibrs_state = 1;
- setup_clear_cpu_cap(X86_FEATURE_IBRS_OFF);
printk_once(KERN_INFO "IBRS: initialized\n");
}
printk_once(KERN_INFO "IBPB: initialized\n");
@@ -80,13 +79,7 @@ void x86_spec_check(void)
}
EXPORT_SYMBOL_GPL(x86_spec_check);
-void noibrs(void)
-{
- setup_force_cpu_cap(X86_FEATURE_IBRS_OFF);
- ibrs_state = 0;
-}
-
-static void noibpb(void)
+int nospec(char *str)
{
/*
* Due to way how apply_forced_caps() works, we have to
@@ -95,13 +88,8 @@ static void noibpb(void)
*/
setup_clear_cpu_cap(X86_FEATURE_SPEC_CTRL);
clear_bit(X86_FEATURE_SPEC_CTRL, (unsigned long *)cpu_caps_set);
+ ibrs_state = 0;
ibpb_state = 0;
-}
-
-int nospec(char *str)
-{
- noibrs();
- noibpb();
return 0;
}
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 2eba9b8b6ea2..f76c4fb94af9 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -239,7 +239,7 @@ static void rx_refill_timeout(unsigned long data)
static int netfront_tx_slot_available(struct netfront_queue *queue)
{
return (queue->tx.req_prod_pvt - queue->tx.rsp_cons) <
- (NET_TX_RING_SIZE - MAX_SKB_FRAGS - 2);
+ (NET_TX_RING_SIZE - XEN_NETIF_NR_SLOTS_MIN - 1);
}
static void xennet_maybe_wake_tx(struct netfront_queue *queue)
@@ -784,7 +784,7 @@ static int xennet_get_responses(struct netfront_queue *queue,
RING_IDX cons = queue->rx.rsp_cons;
struct sk_buff *skb = xennet_get_rx_skb(queue, cons);
grant_ref_t ref = xennet_get_rx_ref(queue, cons);
- int max = MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD);
+ int max = XEN_NETIF_NR_SLOTS_MIN + (rx->status <= RX_COPY_THRESHOLD);
int slots = 1;
int err = 0;
unsigned long ret;
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 48b15a6e5558..75321df64505 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -495,14 +495,14 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
* To keep the rest of the code simple. Allocate a
* contiguous buffer to work with
*/
- ea_buf->xattr = kmalloc(size, GFP_KERNEL);
- if (ea_buf->xattr == NULL)
- return -ENOMEM;
-
ea_buf->flag = EA_MALLOC;
ea_buf->max_size = (size + sb->s_blocksize - 1) &
~(sb->s_blocksize - 1);
+ ea_buf->xattr = kmalloc(ea_buf->max_size, GFP_KERNEL);
+ if (ea_buf->xattr == NULL)
+ return -ENOMEM;
+
if (ea_size == 0)
return 0;