Patch "perf/x86/amd/core: Always clear status for idx" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf/x86/amd/core: Always clear status for idx

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-x86-amd-core-always-clear-status-for-idx.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 849094aab00b592ae150dac8d12cf51bfba3dfb5
Author: Breno Leitao <leitao@xxxxxxxxxx>
Date:   Tue Mar 21 04:33:38 2023 -0700

    perf/x86/amd/core: Always clear status for idx
    
    [ Upstream commit 263f5ecaf7080513efc248ec739b6d9e00f4129f ]
    
    The variable 'status' (which contains the unhandled overflow bits) is
    not being properly masked in some cases, displaying the following
    warning:
    
      WARNING: CPU: 156 PID: 475601 at arch/x86/events/amd/core.c:972 amd_pmu_v2_handle_irq+0x216/0x270
    
    This seems to be happening because the loop is being continued before
    the status bit being unset, in case x86_perf_event_set_period()
    returns 0. This is also causing an inconsistency because the "handled"
    counter is incremented, but the status bit is not cleaned.
    
    Move the bit cleaning together above, together when the "handled"
    counter is incremented.
    
    Fixes: 7685665c390d ("perf/x86/amd/core: Add PerfMonV2 overflow handling")
    Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Reviewed-by: Sandipan Das <sandipan.das@xxxxxxx>
    Link: https://lore.kernel.org/r/20230321113338.1669660-1-leitao@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index 4386b10682ce4..8ca5e827f30b2 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -923,6 +923,7 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs)
 
 		/* Event overflow */
 		handled++;
+		status &= ~mask;
 		perf_sample_data_init(&data, 0, hwc->last_period);
 
 		if (!x86_perf_event_set_period(event))
@@ -935,8 +936,6 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs)
 
 		if (perf_event_overflow(event, &data, regs))
 			x86_pmu_stop(event, 0);
-
-		status &= ~mask;
 	}
 
 	/*



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux