Re: [PATCH] [RESEND] perf/x86/intel/uncore: Fix the index of PCU.3 Broadwell CPUs

From: Masayoshi Mizuma
Date: Fri Jul 27 2018 - 13:00:18 EST


Hi Ingo,

Is the following Kan's patch ready to merge...?

Thanks,
Masa

On 07/17/2018 12:37 PM, Masayoshi Mizuma wrote:
...
>> Here is the patch.
>>
>> Masa, could you please give it a try?
>
> Thank you for the patch, it works well!
>
> Please feel free to add:
>
> Tested-by: Masayoshi Mizuma <m.mizuma@xxxxxxxxxxxxxx>
>
> Thanks,
> Masa
>
>>
>> Thanks,
>> Kan
>>
>> From 688378a4003ec33156958a52dc822105c18075af Mon Sep 17 00:00:00 2001
>> From: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
>> Date: Mon, 16 Jul 2018 04:57:51 -0400
>> Subject: [PATCH] perf/x86/intel/uncore: Fix hardcode index of Broadwell extra PCI DEV
>>
>> Masa reports that a warning message is shown while CPU hot-removing on
>> Broadwell server.
>>
>> Â WARNING: CPU: 126 PID: 6 at arch/x86/events/intel/uncore.c:988
>> Â uncore_pci_remove+0x10b/0x150
>> Â Call Trace:
>> ÂÂ pci_device_remove+0x42/0xd0
>> ÂÂ device_release_driver_internal+0x148/0x220
>> ÂÂ pci_stop_bus_device+0x76/0xa0
>> ÂÂ pci_stop_root_bus+0x44/0x60
>> ÂÂ acpi_pci_root_remove+0x1f/0x80
>> ÂÂ acpi_bus_trim+0x57/0x90
>> ÂÂ acpi_bus_trim+0x2e/0x90
>> ÂÂ acpi_device_hotplug+0x2bc/0x4b0
>> ÂÂ acpi_hotplug_work_fn+0x1a/0x30
>> ÂÂ process_one_work+0x174/0x3a0
>> ÂÂ worker_thread+0x4c/0x3d0
>> ÂÂ kthread+0xf8/0x130
>>
>> This bug was introduced in:
>>
>> Â commit 15a3e845b01c ("perf/x86/intel/uncore: Fix SBOX support for
>> Broadwell CPUs")
>>
>> The index of "QPI Port 2 filter" was hardcode to 2. The index of
>> "PCU.3" used enumerator "HSWEP_PCI_PCU_3", which equals to 2 as well.
>>
>> To fix the conflict, the hardcode index needs to be cleaned up.
>> Introduce a new enumerator "BDX_PCI_QPI_PORT2_FILTER" for "QPI Port 2
>> filter" on Broadwell, and increase the UNCORE_EXTRA_PCI_DEV_MAX.
>> Clean up hardcode index.
>>
>> Reported-by: Masayoshi Mizuma <m.mizuma@xxxxxxxxxxxxxx>
>> Suggested-by: Ingo Molnar <mingo@xxxxxxxxxx>
>> Signed-off-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
>> Fixes: 15a3e845b01c ("perf/x86/intel/uncore: Fix SBOX support for
>> Broadwell CPUs")
>> ---
>> Âarch/x86/events/intel/uncore.hÂÂÂÂÂÂ |Â 2 +-
>> Âarch/x86/events/intel/uncore_snbep.c | 10 +++++++---
>> Â2 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
>> index c9e1e0b..e17ab88 100644
>> --- a/arch/x86/events/intel/uncore.h
>> +++ b/arch/x86/events/intel/uncore.h
>> @@ -28,7 +28,7 @@
>> Â#define UNCORE_PCI_DEV_TYPE(data)ÂÂÂ ((data >> 8) & 0xff)
>> Â#define UNCORE_PCI_DEV_IDX(data)ÂÂÂ (data & 0xff)
>> Â#define UNCORE_EXTRA_PCI_DEVÂÂÂÂÂÂÂ 0xff
>> -#define UNCORE_EXTRA_PCI_DEV_MAXÂÂÂ 3
>> +#define UNCORE_EXTRA_PCI_DEV_MAXÂÂÂ 4
>>
>> Â#define UNCORE_EVENT_CONSTRAINT(c, n) EVENT_CONSTRAINT(c, n, 0xff)
>>
>> diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
>> index 87dc026..51d7c11 100644
>> --- a/arch/x86/events/intel/uncore_snbep.c
>> +++ b/arch/x86/events/intel/uncore_snbep.c
>> @@ -1029,6 +1029,7 @@ void snbep_uncore_cpu_init(void)
>> Âenum {
>> ÂÂÂÂ SNBEP_PCI_QPI_PORT0_FILTER,
>> ÂÂÂÂ SNBEP_PCI_QPI_PORT1_FILTER,
>> +ÂÂÂ BDX_PCI_QPI_PORT2_FILTER,
>> ÂÂÂÂ HSWEP_PCI_PCU_3,
>> Â};
>>
>> @@ -3286,15 +3287,18 @@ static const struct pci_device_id bdx_uncore_pci_ids[] = {
>> ÂÂÂÂ },
>>  { /* QPI Port 0 filter */
>> ÂÂÂÂÂÂÂÂ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f86),
>> -ÂÂÂÂÂÂÂ .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 0),
>> +ÂÂÂÂÂÂÂ .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ SNBEP_PCI_QPI_PORT0_FILTER),
>> ÂÂÂÂ },
>>  { /* QPI Port 1 filter */
>> ÂÂÂÂÂÂÂÂ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f96),
>> -ÂÂÂÂÂÂÂ .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 1),
>> +ÂÂÂÂÂÂÂ .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ SNBEP_PCI_QPI_PORT1_FILTER),
>> ÂÂÂÂ },
>>  { /* QPI Port 2 filter */
>> ÂÂÂÂÂÂÂÂ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6f46),
>> -ÂÂÂÂÂÂÂ .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 2),
>> +ÂÂÂÂÂÂÂ .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ BDX_PCI_QPI_PORT2_FILTER),
>> ÂÂÂÂ },
>> ÂÂÂÂ { /* PCU.3 (for Capability registers) */
>> ÂÂÂÂÂÂÂÂ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x6fc0),