Skip to content

Commit ca2d815

Browse files
committed
Merge tag 'v5.10.64' into rpi-5.10.y
This is the 5.10.64 stable release
2 parents 95c9767 + cb83afd commit ca2d815

28 files changed

Lines changed: 251 additions & 173 deletions

File tree

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 5
33
PATCHLEVEL = 10
4-
SUBLEVEL = 63
4+
SUBLEVEL = 64
55
EXTRAVERSION =
66
NAME = Dare mighty things
77

‎arch/x86/events/amd/iommu.c‎

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include "../perf_event.h"
1919
#include "iommu.h"
2020

21-
#define COUNTER_SHIFT 16
22-
2321
/* iommu pmu conf masks */
2422
#define GET_CSOURCE(x) ((x)->conf & 0xFFULL)
2523
#define GET_DEVID(x) (((x)->conf >> 8) & 0xFFFFULL)
@@ -285,22 +283,31 @@ static void perf_iommu_start(struct perf_event *event, int flags)
285283
WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
286284
hwc->state = 0;
287285

286+
/*
287+
* To account for power-gating, which prevents write to
288+
* the counter, we need to enable the counter
289+
* before setting up counter register.
290+
*/
291+
perf_iommu_enable_event(event);
292+
288293
if (flags & PERF_EF_RELOAD) {
289-
u64 prev_raw_count = local64_read(&hwc->prev_count);
294+
u64 count = 0;
290295
struct amd_iommu *iommu = perf_event_2_iommu(event);
291296

297+
/*
298+
* Since the IOMMU PMU only support counting mode,
299+
* the counter always start with value zero.
300+
*/
292301
amd_iommu_pc_set_reg(iommu, hwc->iommu_bank, hwc->iommu_cntr,
293-
IOMMU_PC_COUNTER_REG, &prev_raw_count);
302+
IOMMU_PC_COUNTER_REG, &count);
294303
}
295304

296-
perf_iommu_enable_event(event);
297305
perf_event_update_userpage(event);
298-
299306
}
300307

301308
static void perf_iommu_read(struct perf_event *event)
302309
{
303-
u64 count, prev, delta;
310+
u64 count;
304311
struct hw_perf_event *hwc = &event->hw;
305312
struct amd_iommu *iommu = perf_event_2_iommu(event);
306313

@@ -311,14 +318,11 @@ static void perf_iommu_read(struct perf_event *event)
311318
/* IOMMU pc counter register is only 48 bits */
312319
count &= GENMASK_ULL(47, 0);
313320

314-
prev = local64_read(&hwc->prev_count);
315-
if (local64_cmpxchg(&hwc->prev_count, prev, count) != prev)
316-
return;
317-
318-
/* Handle 48-bit counter overflow */
319-
delta = (count << COUNTER_SHIFT) - (prev << COUNTER_SHIFT);
320-
delta >>= COUNTER_SHIFT;
321-
local64_add(delta, &event->count);
321+
/*
322+
* Since the counter always start with value zero,
323+
* simply just accumulate the count for the event.
324+
*/
325+
local64_add(count, &event->count);
322326
}
323327

324328
static void perf_iommu_stop(struct perf_event *event, int flags)
@@ -328,15 +332,16 @@ static void perf_iommu_stop(struct perf_event *event, int flags)
328332
if (hwc->state & PERF_HES_UPTODATE)
329333
return;
330334

335+
/*
336+
* To account for power-gating, in which reading the counter would
337+
* return zero, we need to read the register before disabling.
338+
*/
339+
perf_iommu_read(event);
340+
hwc->state |= PERF_HES_UPTODATE;
341+
331342
perf_iommu_disable_event(event);
332343
WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED);
333344
hwc->state |= PERF_HES_STOPPED;
334-
335-
if (hwc->state & PERF_HES_UPTODATE)
336-
return;
337-
338-
perf_iommu_read(event);
339-
hwc->state |= PERF_HES_UPTODATE;
340345
}
341346

342347
static int perf_iommu_add(struct perf_event *event, int flags)

‎arch/x86/kernel/reboot.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,11 @@ static const struct dmi_system_id reboot_dmi_table[] __initconst = {
388388
},
389389
{ /* Handle problems with rebooting on the OptiPlex 990. */
390390
.callback = set_pci_reboot,
391-
.ident = "Dell OptiPlex 990",
391+
.ident = "Dell OptiPlex 990 BIOS A0x",
392392
.matches = {
393393
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
394394
DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"),
395+
DMI_MATCH(DMI_BIOS_VERSION, "A0"),
395396
},
396397
},
397398
{ /* Handle problems with rebooting on Dell 300's */

‎block/blk-core.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ void blk_rq_init(struct request_queue *q, struct request *rq)
121121
rq->internal_tag = BLK_MQ_NO_TAG;
122122
rq->start_time_ns = ktime_get_ns();
123123
rq->part = NULL;
124-
refcount_set(&rq->ref, 1);
125124
blk_crypto_rq_set_defaults(rq);
126125
}
127126
EXPORT_SYMBOL(blk_rq_init);

‎block/blk-flush.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)
263263
spin_unlock_irqrestore(&fq->mq_flush_lock, flags);
264264
}
265265

266+
bool is_flush_rq(struct request *rq)
267+
{
268+
return rq->end_io == flush_end_io;
269+
}
270+
266271
/**
267272
* blk_kick_flush - consider issuing flush request
268273
* @q: request_queue being kicked
@@ -330,6 +335,14 @@ static void blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq,
330335
flush_rq->rq_flags |= RQF_FLUSH_SEQ;
331336
flush_rq->rq_disk = first_rq->rq_disk;
332337
flush_rq->end_io = flush_end_io;
338+
/*
339+
* Order WRITE ->end_io and WRITE rq->ref, and its pair is the one
340+
* implied in refcount_inc_not_zero() called from
341+
* blk_mq_find_and_get_req(), which orders WRITE/READ flush_rq->ref
342+
* and READ flush_rq->end_io
343+
*/
344+
smp_wmb();
345+
refcount_set(&flush_rq->ref, 1);
333346

334347
blk_flush_queue_rq(flush_rq, false);
335348
}

‎block/blk-mq.c‎

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ static bool blk_mq_req_expired(struct request *rq, unsigned long *next)
929929

930930
void blk_mq_put_rq_ref(struct request *rq)
931931
{
932-
if (is_flush_rq(rq, rq->mq_hctx))
932+
if (is_flush_rq(rq))
933933
rq->end_io(rq, 0);
934934
else if (refcount_dec_and_test(&rq->ref))
935935
__blk_mq_free_request(rq);
@@ -2589,16 +2589,49 @@ static void blk_mq_remove_cpuhp(struct blk_mq_hw_ctx *hctx)
25892589
&hctx->cpuhp_dead);
25902590
}
25912591

2592+
/*
2593+
* Before freeing hw queue, clearing the flush request reference in
2594+
* tags->rqs[] for avoiding potential UAF.
2595+
*/
2596+
static void blk_mq_clear_flush_rq_mapping(struct blk_mq_tags *tags,
2597+
unsigned int queue_depth, struct request *flush_rq)
2598+
{
2599+
int i;
2600+
unsigned long flags;
2601+
2602+
/* The hw queue may not be mapped yet */
2603+
if (!tags)
2604+
return;
2605+
2606+
WARN_ON_ONCE(refcount_read(&flush_rq->ref) != 0);
2607+
2608+
for (i = 0; i < queue_depth; i++)
2609+
cmpxchg(&tags->rqs[i], flush_rq, NULL);
2610+
2611+
/*
2612+
* Wait until all pending iteration is done.
2613+
*
2614+
* Request reference is cleared and it is guaranteed to be observed
2615+
* after the ->lock is released.
2616+
*/
2617+
spin_lock_irqsave(&tags->lock, flags);
2618+
spin_unlock_irqrestore(&tags->lock, flags);
2619+
}
2620+
25922621
/* hctx->ctxs will be freed in queue's release handler */
25932622
static void blk_mq_exit_hctx(struct request_queue *q,
25942623
struct blk_mq_tag_set *set,
25952624
struct blk_mq_hw_ctx *hctx, unsigned int hctx_idx)
25962625
{
2626+
struct request *flush_rq = hctx->fq->flush_rq;
2627+
25972628
if (blk_mq_hw_queue_mapped(hctx))
25982629
blk_mq_tag_idle(hctx);
25992630

2631+
blk_mq_clear_flush_rq_mapping(set->tags[hctx_idx],
2632+
set->queue_depth, flush_rq);
26002633
if (set->ops->exit_request)
2601-
set->ops->exit_request(set, hctx->fq->flush_rq, hctx_idx);
2634+
set->ops->exit_request(set, flush_rq, hctx_idx);
26022635

26032636
if (set->ops->exit_hctx)
26042637
set->ops->exit_hctx(hctx, hctx_idx);

‎block/blk.h‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ static inline void __blk_get_queue(struct request_queue *q)
4444
kobject_get(&q->kobj);
4545
}
4646

47-
static inline bool
48-
is_flush_rq(struct request *req, struct blk_mq_hw_ctx *hctx)
49-
{
50-
return hctx->fq->flush_rq == req;
51-
}
47+
bool is_flush_rq(struct request *req);
5248

5349
struct blk_flush_queue *blk_alloc_flush_queue(int node, int cmd_size,
5450
gfp_t flags);

‎drivers/net/ethernet/realtek/r8169_main.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3547,6 +3547,7 @@ static void rtl_hw_start_8106(struct rtl8169_private *tp)
35473547
rtl_eri_write(tp, 0x1b0, ERIAR_MASK_0011, 0x0000);
35483548

35493549
rtl_pcie_state_l2l3_disable(tp);
3550+
rtl_hw_aspm_clkreq_enable(tp, true);
35503551
}
35513552

35523553
DECLARE_RTL_COND(rtl_mac_ocp_e00e_cond)

‎drivers/net/ethernet/xilinx/ll_temac_main.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,10 +942,8 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
942942
wmb();
943943
lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
944944

945-
if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) {
946-
netdev_info(ndev, "%s -> netif_stop_queue\n", __func__);
945+
if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1))
947946
netif_stop_queue(ndev);
948-
}
949947

950948
return NETDEV_TX_OK;
951949
}

‎drivers/pci/quirks.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3246,12 +3246,12 @@ static void fixup_mpss_256(struct pci_dev *dev)
32463246
{
32473247
dev->pcie_mpss = 1; /* 256 bytes */
32483248
}
3249-
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE,
3250-
PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0, fixup_mpss_256);
3251-
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE,
3252-
PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1, fixup_mpss_256);
3253-
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE,
3254-
PCI_DEVICE_ID_SOLARFLARE_SFC4000B, fixup_mpss_256);
3249+
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE,
3250+
PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0, fixup_mpss_256);
3251+
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE,
3252+
PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1, fixup_mpss_256);
3253+
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE,
3254+
PCI_DEVICE_ID_SOLARFLARE_SFC4000B, fixup_mpss_256);
32553255

32563256
/*
32573257
* Intel 5000 and 5100 Memory controllers have an erratum with read completion

0 commit comments

Comments
 (0)