From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH] x86/perf: Add hardware performance events support for Zhaoxin CPU.
Date: Thu, 02 Apr 2020 15:10:10 +0300 [thread overview]
Message-ID: <20200402121010.GO2001@kadam> (raw)
In-Reply-To: <1585647599-6649-1-git-send-email-CodyYao-oc@zhaoxin.com>
[-- Attachment #1: Type: text/plain, Size: 5781 bytes --]
Hi CodyYao-oc,
Thank you for the patch! Perhaps something to improve:
url: https://github.com/0day-ci/linux/commits/CodyYao-oc/x86-perf-Add-hardware-performance-events-support-for-Zhaoxin-CPU/20200331-223205
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 629b3df7ecb01fddfdf71cb5d3c563d143117c33
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
arch/x86/events/zhaoxin/core.c:369 zhaoxin_pmu_handle_irq() error: uninitialized symbol 'is_zxc'.
# https://github.com/0day-ci/linux/commit/41b71fb039d254422d4d46c8e7beef30c11c9d39
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 41b71fb039d254422d4d46c8e7beef30c11c9d39
vim +/is_zxc +369 arch/x86/events/zhaoxin/core.c
41b71fb039d254 CodyYao-oc 2020-03-31 346 static int zhaoxin_pmu_handle_irq(struct pt_regs *regs)
41b71fb039d254 CodyYao-oc 2020-03-31 347 {
41b71fb039d254 CodyYao-oc 2020-03-31 348 struct perf_sample_data data;
41b71fb039d254 CodyYao-oc 2020-03-31 349 struct cpu_hw_events *cpuc;
41b71fb039d254 CodyYao-oc 2020-03-31 350 int bit;
41b71fb039d254 CodyYao-oc 2020-03-31 351 u64 status;
41b71fb039d254 CodyYao-oc 2020-03-31 352 bool is_zxc;
^^^^^^^^^^^
bool is_zxc = false;
41b71fb039d254 CodyYao-oc 2020-03-31 353 int handled = 0;
41b71fb039d254 CodyYao-oc 2020-03-31 354
41b71fb039d254 CodyYao-oc 2020-03-31 355 cpuc = this_cpu_ptr(&cpu_hw_events);
41b71fb039d254 CodyYao-oc 2020-03-31 356 apic_write(APIC_LVTPC, APIC_DM_NMI);
41b71fb039d254 CodyYao-oc 2020-03-31 357 zhaoxin_pmu_disable_all();
41b71fb039d254 CodyYao-oc 2020-03-31 358 status = zhaoxin_pmu_get_status();
41b71fb039d254 CodyYao-oc 2020-03-31 359 if (!status)
41b71fb039d254 CodyYao-oc 2020-03-31 360 goto done;
41b71fb039d254 CodyYao-oc 2020-03-31 361
41b71fb039d254 CodyYao-oc 2020-03-31 362 if (boot_cpu_data.x86 == 0x06 &&
41b71fb039d254 CodyYao-oc 2020-03-31 363 (boot_cpu_data.x86_model == 0x0f ||
41b71fb039d254 CodyYao-oc 2020-03-31 364 boot_cpu_data.x86_model == 0x19))
41b71fb039d254 CodyYao-oc 2020-03-31 365 is_zxc = true;
41b71fb039d254 CodyYao-oc 2020-03-31 366 again:
41b71fb039d254 CodyYao-oc 2020-03-31 367
41b71fb039d254 CodyYao-oc 2020-03-31 368 /*Clearing status works only if the global control is enable on zxc.*/
41b71fb039d254 CodyYao-oc 2020-03-31 @369 if (is_zxc)
^^^^^^
41b71fb039d254 CodyYao-oc 2020-03-31 370 wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
41b71fb039d254 CodyYao-oc 2020-03-31 371
41b71fb039d254 CodyYao-oc 2020-03-31 372 zhaoxin_pmu_ack_status(status);
41b71fb039d254 CodyYao-oc 2020-03-31 373
41b71fb039d254 CodyYao-oc 2020-03-31 374 if (is_zxc)
41b71fb039d254 CodyYao-oc 2020-03-31 375 wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
41b71fb039d254 CodyYao-oc 2020-03-31 376
41b71fb039d254 CodyYao-oc 2020-03-31 377 inc_irq_stat(apic_perf_irqs);
41b71fb039d254 CodyYao-oc 2020-03-31 378
41b71fb039d254 CodyYao-oc 2020-03-31 379 /*
41b71fb039d254 CodyYao-oc 2020-03-31 380 * CondChgd bit 63 doesn't mean any overflow status. Ignore
41b71fb039d254 CodyYao-oc 2020-03-31 381 * and clear the bit.
41b71fb039d254 CodyYao-oc 2020-03-31 382 */
41b71fb039d254 CodyYao-oc 2020-03-31 383 if (__test_and_clear_bit(63, (unsigned long *)&status)) {
41b71fb039d254 CodyYao-oc 2020-03-31 384 if (!status)
41b71fb039d254 CodyYao-oc 2020-03-31 385 goto done;
41b71fb039d254 CodyYao-oc 2020-03-31 386 }
41b71fb039d254 CodyYao-oc 2020-03-31 387
41b71fb039d254 CodyYao-oc 2020-03-31 388 for_each_set_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) {
41b71fb039d254 CodyYao-oc 2020-03-31 389 struct perf_event *event = cpuc->events[bit];
41b71fb039d254 CodyYao-oc 2020-03-31 390
41b71fb039d254 CodyYao-oc 2020-03-31 391 handled++;
41b71fb039d254 CodyYao-oc 2020-03-31 392
41b71fb039d254 CodyYao-oc 2020-03-31 393 if (!test_bit(bit, cpuc->active_mask))
41b71fb039d254 CodyYao-oc 2020-03-31 394 continue;
41b71fb039d254 CodyYao-oc 2020-03-31 395
41b71fb039d254 CodyYao-oc 2020-03-31 396 x86_perf_event_update(event);
41b71fb039d254 CodyYao-oc 2020-03-31 397 perf_sample_data_init(&data, 0, event->hw.last_period);
41b71fb039d254 CodyYao-oc 2020-03-31 398
41b71fb039d254 CodyYao-oc 2020-03-31 399 if (!x86_perf_event_set_period(event))
41b71fb039d254 CodyYao-oc 2020-03-31 400 continue;
41b71fb039d254 CodyYao-oc 2020-03-31 401
41b71fb039d254 CodyYao-oc 2020-03-31 402 if (perf_event_overflow(event, &data, regs))
41b71fb039d254 CodyYao-oc 2020-03-31 403 x86_pmu_stop(event, 0);
41b71fb039d254 CodyYao-oc 2020-03-31 404 }
41b71fb039d254 CodyYao-oc 2020-03-31 405
41b71fb039d254 CodyYao-oc 2020-03-31 406 /*
41b71fb039d254 CodyYao-oc 2020-03-31 407 * Repeat if there is more work to be done:
41b71fb039d254 CodyYao-oc 2020-03-31 408 */
41b71fb039d254 CodyYao-oc 2020-03-31 409 status = zhaoxin_pmu_get_status();
41b71fb039d254 CodyYao-oc 2020-03-31 410 if (status)
41b71fb039d254 CodyYao-oc 2020-03-31 411 goto again;
41b71fb039d254 CodyYao-oc 2020-03-31 412
41b71fb039d254 CodyYao-oc 2020-03-31 413 done:
41b71fb039d254 CodyYao-oc 2020-03-31 414 zhaoxin_pmu_enable_all(0);
41b71fb039d254 CodyYao-oc 2020-03-31 415 return handled;
41b71fb039d254 CodyYao-oc 2020-03-31 416 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] x86/perf: Add hardware performance events support for Zhaoxin CPU.
Date: Thu, 02 Apr 2020 15:10:10 +0300 [thread overview]
Message-ID: <20200402121010.GO2001@kadam> (raw)
In-Reply-To: <1585647599-6649-1-git-send-email-CodyYao-oc@zhaoxin.com>
[-- Attachment #1: Type: text/plain, Size: 5781 bytes --]
Hi CodyYao-oc,
Thank you for the patch! Perhaps something to improve:
url: https://github.com/0day-ci/linux/commits/CodyYao-oc/x86-perf-Add-hardware-performance-events-support-for-Zhaoxin-CPU/20200331-223205
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 629b3df7ecb01fddfdf71cb5d3c563d143117c33
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
arch/x86/events/zhaoxin/core.c:369 zhaoxin_pmu_handle_irq() error: uninitialized symbol 'is_zxc'.
# https://github.com/0day-ci/linux/commit/41b71fb039d254422d4d46c8e7beef30c11c9d39
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 41b71fb039d254422d4d46c8e7beef30c11c9d39
vim +/is_zxc +369 arch/x86/events/zhaoxin/core.c
41b71fb039d254 CodyYao-oc 2020-03-31 346 static int zhaoxin_pmu_handle_irq(struct pt_regs *regs)
41b71fb039d254 CodyYao-oc 2020-03-31 347 {
41b71fb039d254 CodyYao-oc 2020-03-31 348 struct perf_sample_data data;
41b71fb039d254 CodyYao-oc 2020-03-31 349 struct cpu_hw_events *cpuc;
41b71fb039d254 CodyYao-oc 2020-03-31 350 int bit;
41b71fb039d254 CodyYao-oc 2020-03-31 351 u64 status;
41b71fb039d254 CodyYao-oc 2020-03-31 352 bool is_zxc;
^^^^^^^^^^^
bool is_zxc = false;
41b71fb039d254 CodyYao-oc 2020-03-31 353 int handled = 0;
41b71fb039d254 CodyYao-oc 2020-03-31 354
41b71fb039d254 CodyYao-oc 2020-03-31 355 cpuc = this_cpu_ptr(&cpu_hw_events);
41b71fb039d254 CodyYao-oc 2020-03-31 356 apic_write(APIC_LVTPC, APIC_DM_NMI);
41b71fb039d254 CodyYao-oc 2020-03-31 357 zhaoxin_pmu_disable_all();
41b71fb039d254 CodyYao-oc 2020-03-31 358 status = zhaoxin_pmu_get_status();
41b71fb039d254 CodyYao-oc 2020-03-31 359 if (!status)
41b71fb039d254 CodyYao-oc 2020-03-31 360 goto done;
41b71fb039d254 CodyYao-oc 2020-03-31 361
41b71fb039d254 CodyYao-oc 2020-03-31 362 if (boot_cpu_data.x86 == 0x06 &&
41b71fb039d254 CodyYao-oc 2020-03-31 363 (boot_cpu_data.x86_model == 0x0f ||
41b71fb039d254 CodyYao-oc 2020-03-31 364 boot_cpu_data.x86_model == 0x19))
41b71fb039d254 CodyYao-oc 2020-03-31 365 is_zxc = true;
41b71fb039d254 CodyYao-oc 2020-03-31 366 again:
41b71fb039d254 CodyYao-oc 2020-03-31 367
41b71fb039d254 CodyYao-oc 2020-03-31 368 /*Clearing status works only if the global control is enable on zxc.*/
41b71fb039d254 CodyYao-oc 2020-03-31 @369 if (is_zxc)
^^^^^^
41b71fb039d254 CodyYao-oc 2020-03-31 370 wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl);
41b71fb039d254 CodyYao-oc 2020-03-31 371
41b71fb039d254 CodyYao-oc 2020-03-31 372 zhaoxin_pmu_ack_status(status);
41b71fb039d254 CodyYao-oc 2020-03-31 373
41b71fb039d254 CodyYao-oc 2020-03-31 374 if (is_zxc)
41b71fb039d254 CodyYao-oc 2020-03-31 375 wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
41b71fb039d254 CodyYao-oc 2020-03-31 376
41b71fb039d254 CodyYao-oc 2020-03-31 377 inc_irq_stat(apic_perf_irqs);
41b71fb039d254 CodyYao-oc 2020-03-31 378
41b71fb039d254 CodyYao-oc 2020-03-31 379 /*
41b71fb039d254 CodyYao-oc 2020-03-31 380 * CondChgd bit 63 doesn't mean any overflow status. Ignore
41b71fb039d254 CodyYao-oc 2020-03-31 381 * and clear the bit.
41b71fb039d254 CodyYao-oc 2020-03-31 382 */
41b71fb039d254 CodyYao-oc 2020-03-31 383 if (__test_and_clear_bit(63, (unsigned long *)&status)) {
41b71fb039d254 CodyYao-oc 2020-03-31 384 if (!status)
41b71fb039d254 CodyYao-oc 2020-03-31 385 goto done;
41b71fb039d254 CodyYao-oc 2020-03-31 386 }
41b71fb039d254 CodyYao-oc 2020-03-31 387
41b71fb039d254 CodyYao-oc 2020-03-31 388 for_each_set_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) {
41b71fb039d254 CodyYao-oc 2020-03-31 389 struct perf_event *event = cpuc->events[bit];
41b71fb039d254 CodyYao-oc 2020-03-31 390
41b71fb039d254 CodyYao-oc 2020-03-31 391 handled++;
41b71fb039d254 CodyYao-oc 2020-03-31 392
41b71fb039d254 CodyYao-oc 2020-03-31 393 if (!test_bit(bit, cpuc->active_mask))
41b71fb039d254 CodyYao-oc 2020-03-31 394 continue;
41b71fb039d254 CodyYao-oc 2020-03-31 395
41b71fb039d254 CodyYao-oc 2020-03-31 396 x86_perf_event_update(event);
41b71fb039d254 CodyYao-oc 2020-03-31 397 perf_sample_data_init(&data, 0, event->hw.last_period);
41b71fb039d254 CodyYao-oc 2020-03-31 398
41b71fb039d254 CodyYao-oc 2020-03-31 399 if (!x86_perf_event_set_period(event))
41b71fb039d254 CodyYao-oc 2020-03-31 400 continue;
41b71fb039d254 CodyYao-oc 2020-03-31 401
41b71fb039d254 CodyYao-oc 2020-03-31 402 if (perf_event_overflow(event, &data, regs))
41b71fb039d254 CodyYao-oc 2020-03-31 403 x86_pmu_stop(event, 0);
41b71fb039d254 CodyYao-oc 2020-03-31 404 }
41b71fb039d254 CodyYao-oc 2020-03-31 405
41b71fb039d254 CodyYao-oc 2020-03-31 406 /*
41b71fb039d254 CodyYao-oc 2020-03-31 407 * Repeat if there is more work to be done:
41b71fb039d254 CodyYao-oc 2020-03-31 408 */
41b71fb039d254 CodyYao-oc 2020-03-31 409 status = zhaoxin_pmu_get_status();
41b71fb039d254 CodyYao-oc 2020-03-31 410 if (status)
41b71fb039d254 CodyYao-oc 2020-03-31 411 goto again;
41b71fb039d254 CodyYao-oc 2020-03-31 412
41b71fb039d254 CodyYao-oc 2020-03-31 413 done:
41b71fb039d254 CodyYao-oc 2020-03-31 414 zhaoxin_pmu_enable_all(0);
41b71fb039d254 CodyYao-oc 2020-03-31 415 return handled;
41b71fb039d254 CodyYao-oc 2020-03-31 416 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
next prev parent reply other threads:[~2020-04-02 12:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-31 9:39 [PATCH] x86/perf: Add hardware performance events support for Zhaoxin CPU CodyYao-oc
2020-03-31 10:18 ` Peter Zijlstra
2020-04-08 7:20 ` CodyYao-oc
2020-03-31 18:43 ` kbuild test robot
2020-04-02 12:10 ` Dan Carpenter [this message]
2020-04-02 12:10 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2020-04-13 3:14 CodyYao-oc
2020-04-15 9:36 ` Borislav Petkov
2020-04-16 6:16 ` CodyYao-oc
2020-04-15 10:23 ` Peter Zijlstra
2020-04-15 10:31 ` Peter Zijlstra
2020-04-16 7:36 ` CodyYao-oc
2020-05-06 12:55 ` CodyYao-oc
2020-04-16 6:26 ` CodyYao-oc
2020-04-19 13:10 CodyYao-oc
2020-04-26 3:04 ` CodyYao-oc
2020-04-27 12:30 CodyYao-oc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200402121010.GO2001@kadam \
--to=dan.carpenter@oracle.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.