Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86, perf: P4 PMU - Fix typos in comments and style cleanup

This patch:

- fixes typos in comments and clarifies the text
- renames obscure p4_event_alias::original and ::alter members to
::original and ::alternative as appropriate
- drops parenthesis from the return of p4_get_alias_event()

No functional changes.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Link: http://lkml.kernel.org/r/20110721160625.GX7492@sun
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Cyrill Gorcunov and committed by
Ingo Molnar
f53173e4 baf040a0

+31 -37
+1 -1
arch/x86/include/asm/perf_event_p4.h
··· 133 133 134 134 /* 135 135 * In case of event aliasing we need to preserve some 136 - * caller bits otherwise the mapping won't be complete. 136 + * caller bits, otherwise the mapping won't be complete. 137 137 */ 138 138 #define P4_CONFIG_EVENT_ALIAS_MASK \ 139 139 (p4_config_pack_escr(P4_CONFIG_MASK_ESCR) | \
+30 -36
arch/x86/kernel/cpu/perf_event_p4.c
··· 571 571 }; 572 572 573 573 /* 574 - * Because of Netburst being quite restricted in now 575 - * many same events can run simultaneously, we use 576 - * event aliases, ie different events which have the 577 - * same functionallity but use non-intersected resources 578 - * (ESCR/CCCR/couter registers). This allow us to run 579 - * two or more semi-same events together. It is done 580 - * transparently to a user space. 574 + * Because of Netburst being quite restricted in how many 575 + * identical events may run simultaneously, we introduce event aliases, 576 + * ie the different events which have the same functionality but 577 + * utilize non-intersected resources (ESCR/CCCR/counter registers). 581 578 * 582 - * Never set any cusom internal bits such as P4_CONFIG_HT, 579 + * This allow us to relax restrictions a bit and run two or more 580 + * identical events together. 581 + * 582 + * Never set any custom internal bits such as P4_CONFIG_HT, 583 583 * P4_CONFIG_ALIASABLE or bits for P4_PEBS_METRIC, they are 584 - * either up-to-dated automatically either not appliable 585 - * at all. 586 - * 587 - * And be really carefull choosing aliases! 584 + * either up to date automatically or not applicable at all. 588 585 */ 589 586 struct p4_event_alias { 590 - u64 orig; 591 - u64 alter; 587 + u64 original; 588 + u64 alternative; 592 589 } p4_event_aliases[] = { 593 590 { 594 591 /* 595 - * Non-halted cycles can be substituted with 596 - * non-sleeping cycles (see Intel SDM Vol3b for 597 - * details). 592 + * Non-halted cycles can be substituted with non-sleeping cycles (see 593 + * Intel SDM Vol3b for details). We need this alias to be able 594 + * to run nmi-watchdog and 'perf top' (or any other user space tool 595 + * which is interested in running PERF_COUNT_HW_CPU_CYCLES) 596 + * simultaneously. 598 597 */ 599 - .orig = 598 + .original = 600 599 p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_GLOBAL_POWER_EVENTS) | 601 600 P4_ESCR_EMASK_BIT(P4_EVENT_GLOBAL_POWER_EVENTS, RUNNING)), 602 - .alter = 601 + .alternative = 603 602 p4_config_pack_escr(P4_ESCR_EVENT(P4_EVENT_EXECUTION_EVENT) | 604 603 P4_ESCR_EMASK_BIT(P4_EVENT_EXECUTION_EVENT, NBOGUS0)| 605 604 P4_ESCR_EMASK_BIT(P4_EVENT_EXECUTION_EVENT, NBOGUS1)| ··· 619 620 int i; 620 621 621 622 /* 622 - * Probably we're lucky and don't have to do 623 - * matching over all config bits. 623 + * Only event with special mark is allowed, 624 + * we're to be sure it didn't come as malformed 625 + * RAW event. 624 626 */ 625 627 if (!(config & P4_CONFIG_ALIASABLE)) 626 628 return 0; 627 629 628 630 config_match = config & P4_CONFIG_EVENT_ALIAS_MASK; 629 631 630 - /* 631 - * If an event was previously swapped to the alter config 632 - * we should swap it back otherwise contnention on registers 633 - * will return back. 634 - */ 635 632 for (i = 0; i < ARRAY_SIZE(p4_event_aliases); i++) { 636 - if (config_match == p4_event_aliases[i].orig) { 637 - config_match = p4_event_aliases[i].alter; 633 + if (config_match == p4_event_aliases[i].original) { 634 + config_match = p4_event_aliases[i].alternative; 638 635 break; 639 - } else if (config_match == p4_event_aliases[i].alter) { 640 - config_match = p4_event_aliases[i].orig; 636 + } else if (config_match == p4_event_aliases[i].alternative) { 637 + config_match = p4_event_aliases[i].original; 641 638 break; 642 639 } 643 640 } ··· 641 646 if (i >= ARRAY_SIZE(p4_event_aliases)) 642 647 return 0; 643 648 644 - return config_match | 645 - (config & P4_CONFIG_EVENT_ALIAS_IMMUTABLE_BITS); 649 + return config_match | (config & P4_CONFIG_EVENT_ALIAS_IMMUTABLE_BITS); 646 650 } 647 651 648 652 static u64 p4_general_events[PERF_COUNT_HW_MAX] = { ··· 1223 1229 1224 1230 again: 1225 1231 /* 1226 - * Aliases are swappable so we may hit circular 1227 - * lock if both original config and alias need 1228 - * resources (MSR registers) which already busy. 1232 + * It's possible to hit a circular lock 1233 + * between original and alternative events 1234 + * if both are scheduled already. 1229 1235 */ 1230 1236 if (pass > 2) 1231 1237 goto done; ··· 1245 1251 cntr_idx = p4_next_cntr(thread, used_mask, bind); 1246 1252 if (cntr_idx == -1 || test_bit(escr_idx, escr_mask)) { 1247 1253 /* 1248 - * Probably an event alias is still available. 1254 + * Check whether an event alias is still available. 1249 1255 */ 1250 1256 config_alias = p4_get_alias_event(hwc->config); 1251 1257 if (!config_alias)