Skip to content

Commit c23a757

Browse files
committed
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thomas Gleixner: "A small set of fixes: - UAPI data type correction for hyperv - correct the cpu cores field in /proc/cpuinfo on CPU hotplug - return proper error code in the resctrl file system failure path to avoid silent subsequent failures - correct a subtle accounting issue in the new vector allocation code which went unnoticed for a while and caused suspend/resume failures" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/topology: Update the 'cpu cores' field in /proc/cpuinfo correctly across CPU hotplug operations x86/topology: Fix function name in documentation x86/intel_rdt: Fix incorrect returned value when creating rdgroup sub-directory in resctrl file system x86/apic/vector: Handle vector release on CPU unplug correctly genirq/matrix: Handle CPU offlining proper x86/headers/UAPI: Use __u64 instead of u64 in <uapi/asm/hyperv.h>
2 parents e912bf2 + 4596749 commit c23a757

File tree

6 files changed

+48
-22
lines changed

6 files changed

+48
-22
lines changed

Documentation/x86/topology.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The topology of a system is described in the units of:
108108

109109
The number of online threads is also printed in /proc/cpuinfo "siblings."
110110

111-
- topology_sibling_mask():
111+
- topology_sibling_cpumask():
112112

113113
The cpumask contains all online threads in the core to which a thread
114114
belongs.

arch/x86/include/uapi/asm/hyperv.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,24 +241,24 @@
241241
#define HV_X64_MSR_REENLIGHTENMENT_CONTROL 0x40000106
242242

243243
struct hv_reenlightenment_control {
244-
u64 vector:8;
245-
u64 reserved1:8;
246-
u64 enabled:1;
247-
u64 reserved2:15;
248-
u64 target_vp:32;
244+
__u64 vector:8;
245+
__u64 reserved1:8;
246+
__u64 enabled:1;
247+
__u64 reserved2:15;
248+
__u64 target_vp:32;
249249
};
250250

251251
#define HV_X64_MSR_TSC_EMULATION_CONTROL 0x40000107
252252
#define HV_X64_MSR_TSC_EMULATION_STATUS 0x40000108
253253

254254
struct hv_tsc_emulation_control {
255-
u64 enabled:1;
256-
u64 reserved:63;
255+
__u64 enabled:1;
256+
__u64 reserved:63;
257257
};
258258

259259
struct hv_tsc_emulation_status {
260-
u64 inprogress:1;
261-
u64 reserved:63;
260+
__u64 inprogress:1;
261+
__u64 reserved:63;
262262
};
263263

264264
#define HV_X64_MSR_HYPERCALL_ENABLE 0x00000001

arch/x86/kernel/apic/vector.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,40 @@ static void apic_update_vector(struct irq_data *irqd, unsigned int newvec,
134134
{
135135
struct apic_chip_data *apicd = apic_chip_data(irqd);
136136
struct irq_desc *desc = irq_data_to_desc(irqd);
137+
bool managed = irqd_affinity_is_managed(irqd);
137138

138139
lockdep_assert_held(&vector_lock);
139140

140141
trace_vector_update(irqd->irq, newvec, newcpu, apicd->vector,
141142
apicd->cpu);
142143

143-
/* Setup the vector move, if required */
144-
if (apicd->vector && cpu_online(apicd->cpu)) {
144+
/*
145+
* If there is no vector associated or if the associated vector is
146+
* the shutdown vector, which is associated to make PCI/MSI
147+
* shutdown mode work, then there is nothing to release. Clear out
148+
* prev_vector for this and the offlined target case.
149+
*/
150+
apicd->prev_vector = 0;
151+
if (!apicd->vector || apicd->vector == MANAGED_IRQ_SHUTDOWN_VECTOR)
152+
goto setnew;
153+
/*
154+
* If the target CPU of the previous vector is online, then mark
155+
* the vector as move in progress and store it for cleanup when the
156+
* first interrupt on the new vector arrives. If the target CPU is
157+
* offline then the regular release mechanism via the cleanup
158+
* vector is not possible and the vector can be immediately freed
159+
* in the underlying matrix allocator.
160+
*/
161+
if (cpu_online(apicd->cpu)) {
145162
apicd->move_in_progress = true;
146163
apicd->prev_vector = apicd->vector;
147164
apicd->prev_cpu = apicd->cpu;
148165
} else {
149-
apicd->prev_vector = 0;
166+
irq_matrix_free(vector_matrix, apicd->cpu, apicd->vector,
167+
managed);
150168
}
151169

170+
setnew:
152171
apicd->vector = newvec;
153172
apicd->cpu = newcpu;
154173
BUG_ON(!IS_ERR_OR_NULL(per_cpu(vector_irq, newcpu)[newvec]));

arch/x86/kernel/cpu/intel_rdt_rdtgroup.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,7 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node *parent_kn,
18041804
goto out_common_fail;
18051805
}
18061806
closid = ret;
1807+
ret = 0;
18071808

18081809
rdtgrp->closid = closid;
18091810
list_add(&rdtgrp->rdtgroup_list, &rdt_all_groups);

arch/x86/kernel/smpboot.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,7 @@ static void remove_siblinginfo(int cpu)
14371437
cpumask_clear(topology_sibling_cpumask(cpu));
14381438
cpumask_clear(topology_core_cpumask(cpu));
14391439
c->cpu_core_id = 0;
1440+
c->booted_cores = 0;
14401441
cpumask_clear_cpu(cpu, cpu_sibling_setup_mask);
14411442
recompute_smt_state();
14421443
}

kernel/irq/matrix.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct cpumap {
1616
unsigned int available;
1717
unsigned int allocated;
1818
unsigned int managed;
19+
bool initialized;
1920
bool online;
2021
unsigned long alloc_map[IRQ_MATRIX_SIZE];
2122
unsigned long managed_map[IRQ_MATRIX_SIZE];
@@ -81,9 +82,11 @@ void irq_matrix_online(struct irq_matrix *m)
8182

8283
BUG_ON(cm->online);
8384

84-
bitmap_zero(cm->alloc_map, m->matrix_bits);
85-
cm->available = m->alloc_size - (cm->managed + m->systembits_inalloc);
86-
cm->allocated = 0;
85+
if (!cm->initialized) {
86+
cm->available = m->alloc_size;
87+
cm->available -= cm->managed + m->systembits_inalloc;
88+
cm->initialized = true;
89+
}
8790
m->global_available += cm->available;
8891
cm->online = true;
8992
m->online_maps++;
@@ -370,14 +373,16 @@ void irq_matrix_free(struct irq_matrix *m, unsigned int cpu,
370373
if (WARN_ON_ONCE(bit < m->alloc_start || bit >= m->alloc_end))
371374
return;
372375

373-
if (cm->online) {
374-
clear_bit(bit, cm->alloc_map);
375-
cm->allocated--;
376+
clear_bit(bit, cm->alloc_map);
377+
cm->allocated--;
378+
379+
if (cm->online)
376380
m->total_allocated--;
377-
if (!managed) {
378-
cm->available++;
381+
382+
if (!managed) {
383+
cm->available++;
384+
if (cm->online)
379385
m->global_available++;
380-
}
381386
}
382387
trace_irq_matrix_free(bit, cpu, m, cm);
383388
}

0 commit comments

Comments
 (0)