Skip to content

Commit 4290d5b

Browse files
committed
Merge tag 'for-linus-4.19b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross: - minor cleanup avoiding a warning when building with new gcc - a patch to add a new sysfs node for Xen frontend/backend drivers to make it easier to obtain the state of a pv device - two fixes for 32-bit pv-guests to avoid intermediate L1TF vulnerable PTEs * tag 'for-linus-4.19b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: x86/xen: remove redundant variable save_pud xen: export device state to sysfs x86/pae: use 64 bit atomic xchg function in native_ptep_get_and_clear x86/xen: don't write ptes directly in 32-bit PV guests
2 parents 01f6543 + 6d3c8ce commit 4290d5b

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

Documentation/ABI/stable/sysfs-bus-xen-backend

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,12 @@ KernelVersion: 3.0
7373
Contact: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
7474
Description:
7575
Number of sectors written by the frontend.
76+
77+
What: /sys/bus/xen-backend/devices/*/state
78+
Date: August 2018
79+
KernelVersion: 4.19
80+
Contact: Joe Jin <joe.jin@oracle.com>
81+
Description:
82+
The state of the device. One of: 'Unknown',
83+
'Initialising', 'Initialised', 'Connected', 'Closing',
84+
'Closed', 'Reconfiguring', 'Reconfigured'.

arch/x86/include/asm/pgtable-3level.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef _ASM_X86_PGTABLE_3LEVEL_H
33
#define _ASM_X86_PGTABLE_3LEVEL_H
44

5+
#include <asm/atomic64_32.h>
6+
57
/*
68
* Intel Physical Address Extension (PAE) Mode - three-level page
79
* tables on PPro+ CPUs.
@@ -150,10 +152,7 @@ static inline pte_t native_ptep_get_and_clear(pte_t *ptep)
150152
{
151153
pte_t res;
152154

153-
/* xchg acts as a barrier before the setting of the high bits */
154-
res.pte_low = xchg(&ptep->pte_low, 0);
155-
res.pte_high = ptep->pte_high;
156-
ptep->pte_high = 0;
155+
res.pte = (pteval_t)arch_atomic64_xchg((atomic64_t *)ptep, 0);
157156

158157
return res;
159158
}

arch/x86/xen/mmu_pv.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,13 @@ static void xen_set_pud(pud_t *ptr, pud_t val)
435435
static void xen_set_pte_atomic(pte_t *ptep, pte_t pte)
436436
{
437437
trace_xen_mmu_set_pte_atomic(ptep, pte);
438-
set_64bit((u64 *)ptep, native_pte_val(pte));
438+
__xen_set_pte(ptep, pte);
439439
}
440440

441441
static void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
442442
{
443443
trace_xen_mmu_pte_clear(mm, addr, ptep);
444-
if (!xen_batched_set_pte(ptep, native_make_pte(0)))
445-
native_pte_clear(mm, addr, ptep);
444+
__xen_set_pte(ptep, native_make_pte(0));
446445
}
447446

448447
static void xen_pmd_clear(pmd_t *pmdp)
@@ -1570,7 +1569,7 @@ static void __init xen_set_pte_init(pte_t *ptep, pte_t pte)
15701569
pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) &
15711570
pte_val_ma(pte));
15721571
#endif
1573-
native_set_pte(ptep, pte);
1572+
__xen_set_pte(ptep, pte);
15741573
}
15751574

15761575
/* Early in boot, while setting up the initial pagetable, assume
@@ -2061,7 +2060,6 @@ void __init xen_relocate_p2m(void)
20612060
pud_t *pud;
20622061
pgd_t *pgd;
20632062
unsigned long *new_p2m;
2064-
int save_pud;
20652063

20662064
size = PAGE_ALIGN(xen_start_info->nr_pages * sizeof(unsigned long));
20672065
n_pte = roundup(size, PAGE_SIZE) >> PAGE_SHIFT;
@@ -2091,7 +2089,6 @@ void __init xen_relocate_p2m(void)
20912089

20922090
pgd = __va(read_cr3_pa());
20932091
new_p2m = (unsigned long *)(2 * PGDIR_SIZE);
2094-
save_pud = n_pud;
20952092
for (idx_pud = 0; idx_pud < n_pud; idx_pud++) {
20962093
pud = early_memremap(pud_phys, PAGE_SIZE);
20972094
clear_page(pud);

drivers/xen/xenbus/xenbus_probe.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,19 @@ static ssize_t modalias_show(struct device *dev,
402402
}
403403
static DEVICE_ATTR_RO(modalias);
404404

405+
static ssize_t state_show(struct device *dev,
406+
struct device_attribute *attr, char *buf)
407+
{
408+
return sprintf(buf, "%s\n",
409+
xenbus_strstate(to_xenbus_device(dev)->state));
410+
}
411+
static DEVICE_ATTR_RO(state);
412+
405413
static struct attribute *xenbus_dev_attrs[] = {
406414
&dev_attr_nodename.attr,
407415
&dev_attr_devtype.attr,
408416
&dev_attr_modalias.attr,
417+
&dev_attr_state.attr,
409418
NULL,
410419
};
411420

0 commit comments

Comments
 (0)