Merge branch 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
 "A couple of fixlets for x86:

   - Fix the ESPFIX double fault handling for 5-level pagetables

   - Fix the commandline parsing for 'apic=' on 32bit systems and update
     documentation

   - Make zombie stack traces reliable

   - Fix kexec with stack canary

   - Fix the delivery mode for APICs which was missed when the x86
     vector management was converted to single target delivery. Caused a
     regression due to the broken hardware which ignores affinity
     settings in lowest prio delivery mode.

   - Unbreak modules when AMD memory encryption is enabled

   - Remove an unused parameter of prepare_switch_to"

* 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/apic: Switch all APICs to Fixed delivery mode
  x86/apic: Update the 'apic=' description of setting APIC driver
  x86/apic: Avoid wrong warning when parsing 'apic=' in X86-32 case
  x86-32: Fix kexec with stack canary (CONFIG_CC_STACKPROTECTOR)
  x86: Remove unused parameter of prepare_switch_to
  x86/stacktrace: Make zombie stack traces reliable
  x86/mm: Unbreak modules that use the DMA API
  x86/build: Make isoimage work on Debian
  x86/espfix/64: Fix espfix double-fault handling on 5-level systems
This commit is contained in:
Linus Torvalds 2017-12-31 13:13:56 -08:00
commit f39d7d78b7
14 changed files with 42 additions and 39 deletions

View File

@ -328,11 +328,15 @@
not play well with APC CPU idle - disable it if you have not play well with APC CPU idle - disable it if you have
APC and your system crashes randomly. APC and your system crashes randomly.
apic= [APIC,X86-32] Advanced Programmable Interrupt Controller apic= [APIC,X86] Advanced Programmable Interrupt Controller
Change the output verbosity whilst booting Change the output verbosity whilst booting
Format: { quiet (default) | verbose | debug } Format: { quiet (default) | verbose | debug }
Change the amount of debugging information output Change the amount of debugging information output
when initialising the APIC and IO-APIC components. when initialising the APIC and IO-APIC components.
For X86-32, this can also be used to specify an APIC
driver name.
Format: apic=driver_name
Examples: apic=bigsmp
apic_extnmi= [APIC,X86] External NMI delivery setting apic_extnmi= [APIC,X86] External NMI delivery setting
Format: { bsp (default) | all | none } Format: { bsp (default) | all | none }

View File

@ -80,39 +80,43 @@ genfdimage288() {
mcopy $FBZIMAGE w:linux mcopy $FBZIMAGE w:linux
} }
genisoimage() { geniso() {
tmp_dir=`dirname $FIMAGE`/isoimage tmp_dir=`dirname $FIMAGE`/isoimage
rm -rf $tmp_dir rm -rf $tmp_dir
mkdir $tmp_dir mkdir $tmp_dir
for i in lib lib64 share end ; do for i in lib lib64 share ; do
for j in syslinux ISOLINUX ; do for j in syslinux ISOLINUX ; do
if [ -f /usr/$i/$j/isolinux.bin ] ; then if [ -f /usr/$i/$j/isolinux.bin ] ; then
isolinux=/usr/$i/$j/isolinux.bin isolinux=/usr/$i/$j/isolinux.bin
cp $isolinux $tmp_dir
fi fi
done done
for j in syslinux syslinux/modules/bios ; do for j in syslinux syslinux/modules/bios ; do
if [ -f /usr/$i/$j/ldlinux.c32 ]; then if [ -f /usr/$i/$j/ldlinux.c32 ]; then
ldlinux=/usr/$i/$j/ldlinux.c32 ldlinux=/usr/$i/$j/ldlinux.c32
cp $ldlinux $tmp_dir
fi fi
done done
if [ -n "$isolinux" -a -n "$ldlinux" ] ; then if [ -n "$isolinux" -a -n "$ldlinux" ] ; then
break break
fi fi
if [ $i = end -a -z "$isolinux" ] ; then
echo 'Need an isolinux.bin file, please install syslinux/isolinux.'
exit 1
fi
done done
if [ -z "$isolinux" ] ; then
echo 'Need an isolinux.bin file, please install syslinux/isolinux.'
exit 1
fi
if [ -z "$ldlinux" ] ; then
echo 'Need an ldlinux.c32 file, please install syslinux/isolinux.'
exit 1
fi
cp $isolinux $tmp_dir
cp $ldlinux $tmp_dir
cp $FBZIMAGE $tmp_dir/linux cp $FBZIMAGE $tmp_dir/linux
echo "$KCMDLINE" > $tmp_dir/isolinux.cfg echo "$KCMDLINE" > $tmp_dir/isolinux.cfg
if [ -f "$FDINITRD" ] ; then if [ -f "$FDINITRD" ] ; then
cp "$FDINITRD" $tmp_dir/initrd.img cp "$FDINITRD" $tmp_dir/initrd.img
fi fi
mkisofs -J -r -input-charset=utf-8 -quiet -o $FIMAGE -b isolinux.bin \ genisoimage -J -r -input-charset=utf-8 -quiet -o $FIMAGE \
-c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \ -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 \
$tmp_dir -boot-info-table $tmp_dir
isohybrid $FIMAGE 2>/dev/null || true isohybrid $FIMAGE 2>/dev/null || true
rm -rf $tmp_dir rm -rf $tmp_dir
} }
@ -121,6 +125,6 @@ case $1 in
bzdisk) genbzdisk;; bzdisk) genbzdisk;;
fdimage144) genfdimage144;; fdimage144) genfdimage144;;
fdimage288) genfdimage288;; fdimage288) genfdimage288;;
isoimage) genisoimage;; isoimage) geniso;;
*) echo 'Unknown image format'; exit 1; *) echo 'Unknown image format'; exit 1;
esac esac

View File

@ -16,8 +16,7 @@ void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
struct tss_struct *tss); struct tss_struct *tss);
/* This runs runs on the previous thread's stack. */ /* This runs runs on the previous thread's stack. */
static inline void prepare_switch_to(struct task_struct *prev, static inline void prepare_switch_to(struct task_struct *next)
struct task_struct *next)
{ {
#ifdef CONFIG_VMAP_STACK #ifdef CONFIG_VMAP_STACK
/* /*
@ -70,7 +69,7 @@ struct fork_frame {
#define switch_to(prev, next, last) \ #define switch_to(prev, next, last) \
do { \ do { \
prepare_switch_to(prev, next); \ prepare_switch_to(next); \
\ \
((last) = __switch_to_asm((prev), (next))); \ ((last) = __switch_to_asm((prev), (next))); \
} while (0) } while (0)

View File

@ -2626,11 +2626,13 @@ static int __init apic_set_verbosity(char *arg)
apic_verbosity = APIC_DEBUG; apic_verbosity = APIC_DEBUG;
else if (strcmp("verbose", arg) == 0) else if (strcmp("verbose", arg) == 0)
apic_verbosity = APIC_VERBOSE; apic_verbosity = APIC_VERBOSE;
#ifdef CONFIG_X86_64
else { else {
pr_warning("APIC Verbosity level %s not recognised" pr_warning("APIC Verbosity level %s not recognised"
" use apic=verbose or apic=debug\n", arg); " use apic=verbose or apic=debug\n", arg);
return -EINVAL; return -EINVAL;
} }
#endif
return 0; return 0;
} }

View File

@ -151,7 +151,7 @@ static struct apic apic_flat __ro_after_init = {
.apic_id_valid = default_apic_id_valid, .apic_id_valid = default_apic_id_valid,
.apic_id_registered = flat_apic_id_registered, .apic_id_registered = flat_apic_id_registered,
.irq_delivery_mode = dest_LowestPrio, .irq_delivery_mode = dest_Fixed,
.irq_dest_mode = 1, /* logical */ .irq_dest_mode = 1, /* logical */
.disable_esr = 0, .disable_esr = 0,

View File

@ -110,7 +110,7 @@ struct apic apic_noop __ro_after_init = {
.apic_id_valid = default_apic_id_valid, .apic_id_valid = default_apic_id_valid,
.apic_id_registered = noop_apic_id_registered, .apic_id_registered = noop_apic_id_registered,
.irq_delivery_mode = dest_LowestPrio, .irq_delivery_mode = dest_Fixed,
/* logical delivery broadcast to all CPUs: */ /* logical delivery broadcast to all CPUs: */
.irq_dest_mode = 1, .irq_dest_mode = 1,

View File

@ -39,17 +39,13 @@ static void irq_msi_compose_msg(struct irq_data *data, struct msi_msg *msg)
((apic->irq_dest_mode == 0) ? ((apic->irq_dest_mode == 0) ?
MSI_ADDR_DEST_MODE_PHYSICAL : MSI_ADDR_DEST_MODE_PHYSICAL :
MSI_ADDR_DEST_MODE_LOGICAL) | MSI_ADDR_DEST_MODE_LOGICAL) |
((apic->irq_delivery_mode != dest_LowestPrio) ? MSI_ADDR_REDIRECTION_CPU |
MSI_ADDR_REDIRECTION_CPU :
MSI_ADDR_REDIRECTION_LOWPRI) |
MSI_ADDR_DEST_ID(cfg->dest_apicid); MSI_ADDR_DEST_ID(cfg->dest_apicid);
msg->data = msg->data =
MSI_DATA_TRIGGER_EDGE | MSI_DATA_TRIGGER_EDGE |
MSI_DATA_LEVEL_ASSERT | MSI_DATA_LEVEL_ASSERT |
((apic->irq_delivery_mode != dest_LowestPrio) ? MSI_DATA_DELIVERY_FIXED |
MSI_DATA_DELIVERY_FIXED :
MSI_DATA_DELIVERY_LOWPRI) |
MSI_DATA_VECTOR(cfg->vector); MSI_DATA_VECTOR(cfg->vector);
} }

View File

@ -105,7 +105,7 @@ static struct apic apic_default __ro_after_init = {
.apic_id_valid = default_apic_id_valid, .apic_id_valid = default_apic_id_valid,
.apic_id_registered = default_apic_id_registered, .apic_id_registered = default_apic_id_registered,
.irq_delivery_mode = dest_LowestPrio, .irq_delivery_mode = dest_Fixed,
/* logical delivery broadcast to all CPUs: */ /* logical delivery broadcast to all CPUs: */
.irq_dest_mode = 1, .irq_dest_mode = 1,

View File

@ -184,7 +184,7 @@ static struct apic apic_x2apic_cluster __ro_after_init = {
.apic_id_valid = x2apic_apic_id_valid, .apic_id_valid = x2apic_apic_id_valid,
.apic_id_registered = x2apic_apic_id_registered, .apic_id_registered = x2apic_apic_id_registered,
.irq_delivery_mode = dest_LowestPrio, .irq_delivery_mode = dest_Fixed,
.irq_dest_mode = 1, /* logical */ .irq_dest_mode = 1, /* logical */
.disable_esr = 0, .disable_esr = 0,

View File

@ -48,8 +48,6 @@ static void load_segments(void)
"\tmovl $"STR(__KERNEL_DS)",%%eax\n" "\tmovl $"STR(__KERNEL_DS)",%%eax\n"
"\tmovl %%eax,%%ds\n" "\tmovl %%eax,%%ds\n"
"\tmovl %%eax,%%es\n" "\tmovl %%eax,%%es\n"
"\tmovl %%eax,%%fs\n"
"\tmovl %%eax,%%gs\n"
"\tmovl %%eax,%%ss\n" "\tmovl %%eax,%%ss\n"
: : : "eax", "memory"); : : : "eax", "memory");
#undef STR #undef STR
@ -232,8 +230,8 @@ void machine_kexec(struct kimage *image)
* The gdt & idt are now invalid. * The gdt & idt are now invalid.
* If you want to load them you must set up your own idt & gdt. * If you want to load them you must set up your own idt & gdt.
*/ */
set_gdt(phys_to_virt(0), 0);
idt_invalidate(phys_to_virt(0)); idt_invalidate(phys_to_virt(0));
set_gdt(phys_to_virt(0), 0);
/* now call it */ /* now call it */
image->start = relocate_kernel_ptr((unsigned long)image->head, image->start = relocate_kernel_ptr((unsigned long)image->head,

View File

@ -164,8 +164,12 @@ int save_stack_trace_tsk_reliable(struct task_struct *tsk,
{ {
int ret; int ret;
/*
* If the task doesn't have a stack (e.g., a zombie), the stack is
* "reliably" empty.
*/
if (!try_get_task_stack(tsk)) if (!try_get_task_stack(tsk))
return -EINVAL; return 0;
ret = __save_stack_trace_reliable(trace, tsk); ret = __save_stack_trace_reliable(trace, tsk);

View File

@ -361,7 +361,7 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
* *
* No need for ist_enter here because we don't use RCU. * No need for ist_enter here because we don't use RCU.
*/ */
if (((long)regs->sp >> PGDIR_SHIFT) == ESPFIX_PGD_ENTRY && if (((long)regs->sp >> P4D_SHIFT) == ESPFIX_PGD_ENTRY &&
regs->cs == __KERNEL_CS && regs->cs == __KERNEL_CS &&
regs->ip == (unsigned long)native_irq_return_iret) regs->ip == (unsigned long)native_irq_return_iret)
{ {

View File

@ -405,13 +405,13 @@ bool sme_active(void)
{ {
return sme_me_mask && !sev_enabled; return sme_me_mask && !sev_enabled;
} }
EXPORT_SYMBOL_GPL(sme_active); EXPORT_SYMBOL(sme_active);
bool sev_active(void) bool sev_active(void)
{ {
return sme_me_mask && sev_enabled; return sme_me_mask && sev_enabled;
} }
EXPORT_SYMBOL_GPL(sev_active); EXPORT_SYMBOL(sev_active);
static const struct dma_map_ops sev_dma_ops = { static const struct dma_map_ops sev_dma_ops = {
.alloc = sev_alloc, .alloc = sev_alloc,

View File

@ -985,9 +985,7 @@ static u32 hv_compose_msi_req_v1(
int_pkt->wslot.slot = slot; int_pkt->wslot.slot = slot;
int_pkt->int_desc.vector = vector; int_pkt->int_desc.vector = vector;
int_pkt->int_desc.vector_count = 1; int_pkt->int_desc.vector_count = 1;
int_pkt->int_desc.delivery_mode = int_pkt->int_desc.delivery_mode = dest_Fixed;
(apic->irq_delivery_mode == dest_LowestPrio) ?
dest_LowestPrio : dest_Fixed;
/* /*
* Create MSI w/ dummy vCPU set, overwritten by subsequent retarget in * Create MSI w/ dummy vCPU set, overwritten by subsequent retarget in
@ -1008,9 +1006,7 @@ static u32 hv_compose_msi_req_v2(
int_pkt->wslot.slot = slot; int_pkt->wslot.slot = slot;
int_pkt->int_desc.vector = vector; int_pkt->int_desc.vector = vector;
int_pkt->int_desc.vector_count = 1; int_pkt->int_desc.vector_count = 1;
int_pkt->int_desc.delivery_mode = int_pkt->int_desc.delivery_mode = dest_Fixed;
(apic->irq_delivery_mode == dest_LowestPrio) ?
dest_LowestPrio : dest_Fixed;
/* /*
* Create MSI w/ dummy vCPU set targeting just one vCPU, overwritten * Create MSI w/ dummy vCPU set targeting just one vCPU, overwritten