Lines Matching full:sampling

3  * Performance event support for the System z CPU-measurement Sampling Facility
27 /* Perf PMU definitions for the sampling facility */
29 #define PERF_EVENT_CPUM_SF 0xB0000UL /* Event: Basic-sampling */
30 #define PERF_EVENT_CPUM_SF_DIAG 0xBD000UL /* Event: Combined-sampling */
31 #define PERF_CPUM_SF_BASIC_MODE 0x0001 /* Basic-sampling flag */
32 #define PERF_CPUM_SF_DIAG_MODE 0x0002 /* Diagnostic-sampling flag */
33 #define PERF_CPUM_SF_FREQ_MODE 0x0008 /* Sampling with frequency */
44 * At least one table is required for the sampling buffer structure.
65 /* Minimum and maximum sampling buffer sizes:
67 * This number represents the maximum size of the sampling buffer taking
69 * numbers apply to the basic-sampling function only.
71 * the diagnostic-sampling function is active.
73 * Sampling buffer size Buffer characteristics
105 /* CPU-measurement sampling information block */
107 /* CPU-measurement sampling control block */
109 struct sf_buffer sfb; /* Sampling buffer */
119 /* Sampling control helper functions */
160 * sf_disable() - Switch off sampling facility
171 * sf_buffer_available() - Check for an allocated sampling buffer
179 * deallocate sampling facility buffer
228 * Allocates new sample-data-blocks and adds them to the specified sampling
231 * Important: This modifies the sampling buffer and must be called when the
232 * sampling facility is disabled.
248 /* Append to the existing sampling buffer, overwriting the table-link in realloc_sampling_buffer()
256 * the sampling buffer origin. in realloc_sampling_buffer()
306 /* Link sampling buffer to its origin */ in realloc_sampling_buffer()
316 * Allocates and initializes a sampling buffer structure using the
403 /* Calculate sampling buffers using 4K pages in allocate_buffers()
405 * 1. The sampling size is 32 bytes for basic sampling. This size in allocate_buffers()
407 * sampling uses auxlilary data buffer setup which provides the in allocate_buffers()
421 * 3. Use the sampling frequency as input. in allocate_buffers()
424 * SDBs to handle a higher sampling rate. in allocate_buffers()
435 /* If there is already a sampling buffer allocated, it is very likely in allocate_buffers()
436 * that the sampling facility is enabled too. If the event to be in allocate_buffers()
437 * initialized requires a greater sampling buffer, the allocation must in allocate_buffers()
438 * be postponed. Changing the sampling buffer requires the sampling in allocate_buffers()
459 /* Use a percentage-based approach to extend the sampling facility in compute_sfb_extent()
506 /* extend_sampling_buffer() - Extend sampling buffer
507 * @sfb: Sampling buffer structure (for local CPU)
510 * Use this function to extend the sampling buffer based on the overflow counter
513 * Important: This function disables the sampling facility in order to safely
514 * change the sampling buffer structure. Do not call this function
526 /* Disable the sampling facility to reset any states and also in extend_sampling_buffer()
531 /* Extend the sampling buffer. in extend_sampling_buffer()
642 * Obtain the PID from the basic-sampling data entry and in cpumsf_output_event_pid()
674 /* The min/max sampling rates specifies the valid range in getrate()
682 * sampling rate does not exceed this value. This also helps in getrate()
694 /* The sampling information (si) contains information about the
695 * min/max sampling intervals and the CPU speed. So calculate the
696 * correct sampling interval and avoid the whole period adjust
699 * Since the CPU Measurement sampling facility can not handle frequency
700 * calculate the sampling interval when frequency is specified using
705 * set to the correct sampling rate.
743 /* Reserve CPU-measurement sampling facility */ in __hw_perf_event_init()
751 /* Access per-CPU sampling information (query sampling info) */ in __hw_perf_event_init()
755 * sampling info from the current CPU, otherwise use event->cpu to in __hw_perf_event_init()
757 * Later, cpuhw indicates whether to allocate sampling buffers for a in __hw_perf_event_init()
766 * sampling structure for accessing the CPU-specific QSI. in __hw_perf_event_init()
772 /* Check sampling facility authorization and, if not authorized, in __hw_perf_event_init()
782 pr_warn("CPU Measurement Facility sampling is temporarily not available\n"); in __hw_perf_event_init()
787 /* Always enable basic sampling */ in __hw_perf_event_init()
790 /* Check if diagnostic sampling is requested. Deny if the required in __hw_perf_event_init()
791 * sampling authorization is missing. in __hw_perf_event_init()
809 /* Allocate the per-CPU sampling buffer using the CPU information in __hw_perf_event_init()
811 * CPU (event->cpu == -1; or cpuhw == NULL), allocate sampling in __hw_perf_event_init()
818 /* Event is not pinned, allocate sampling buffer on in __hw_perf_event_init()
829 /* If PID/TID sampling is active, replace the default overflow in __hw_perf_event_init()
830 * handler to extract and resolve the PIDs from the basic-sampling in __hw_perf_event_init()
853 /* No support for taken branch sampling */ in cpumsf_pmu_event_init()
865 /* Support sampling of CPU cycles in addition to the in cpumsf_pmu_event_init()
868 * sampling events only. in cpumsf_pmu_event_init()
907 /* Check whether to extent the sampling buffer. in cpumsf_pmu_enable()
909 * Two conditions trigger an increase of the sampling buffer for a in cpumsf_pmu_enable()
912 * 2. Sampling overflows that contribute to pending allocations. in cpumsf_pmu_enable()
914 * Note that the extend_sampling_buffer() function disables the sampling in cpumsf_pmu_enable()
915 * facility, but it can be fully re-enabled using sampling controls that in cpumsf_pmu_enable()
929 /* (Re)enable the PMU and sampling facility */ in cpumsf_pmu_enable()
932 pr_err("Loading sampling controls failed: op 1 err %i\n", err); in cpumsf_pmu_enable()
954 /* Switch off sampling activation control */ in cpumsf_pmu_disable()
961 pr_err("Loading sampling controls failed: op 2 err %i\n", err); in cpumsf_pmu_disable()
967 * TEAR/DEAR values are valid only if the sampling facility is in cpumsf_pmu_disable()
969 * for a disabled sampling facility because cpumsf_pmu_enable() in cpumsf_pmu_disable()
1094 * Walks through a sample-data-block and collects sampling data entries that are
1095 * then pushed to the perf event subsystem. Depending on the sampling function,
1096 * there can be either basic-sampling or combined-sampling data entries. A
1097 * combined-sampling data entry consists of a basic- and a diagnostic-sampling
1098 * data entry. The sampling function is determined by the flags in the perf
1099 * event hardware structure. The function always works with a combined-sampling
1102 * Note that the implementation focuses on basic-sampling data entries and, if
1103 * such an entry is not valid, the entire combined-sampling data entry is
1145 * from a combined basic- and diagnostic-sampling. in hw_collect_samples()
1146 * If only basic-sampling is then active, entries are in hw_collect_samples()
1162 /* hw_perf_event_update() - Process sampling buffer
1166 * Processes the sampling buffer and create perf event samples.
1167 * The sampling buffer position are retrieved and saved in the TEAR_REG
1183 * AUX buffer is used when in diagnostic sampling mode. in hw_perf_event_update()
1206 * is reached, extend the sampling buffer. in hw_perf_event_update()
1294 * Finish sampling on the cpu. Called by cpumsf_pmu_del() with pmu
1327 * Start sampling on the CPU. Called by cpumsf_pmu_add() when an event
1489 * Measurement alert handler for diagnostic mode sampling.
1516 "diagnostic-sampling mode is full\n", in hw_collect_aux()
1580 * aux_buffer_setup() - Setup AUX buffer for diagnostic mode sampling
1606 "maximum sampling buffer limit\n", in aux_buffer_setup()
1611 "minimum sampling buffer limit\n", in aux_buffer_setup()
1693 /* Check if the new sampling period/frequency is appropriate.
1708 * sampling structure for accessing the CPU-specific QSI. in cpumsf_pmu_check_period()
1726 /* Activate sampling control.
1727 * Next call of pmu_enable() starts sampling.
1743 /* Deactivate sampling control.
1744 * Next call of pmu_enable() stops sampling.
1783 /* Set up sampling controls. Always program the sampling register in cpumsf_pmu_add()
1785 * that is used by hw_perf_event_update() to store the sampling buffer in cpumsf_pmu_add()
1797 /* Ensure sampling functions are in the disabled state. If disabled, in cpumsf_pmu_add()
1798 * switch on sampling enable control. */ in cpumsf_pmu_add()
1851 * The availablitiy depends on the CPU_MF sampling facility authorization
1853 * time by the sampling facility device driver.
1855 * also turned off for diagnostic sampling.
1858 * level for diagnostic sampling and installs the attribute
1859 * file for diagnostic sampling if necessary.
1951 /* Sampling authorization change request */ in cpumf_measurement_alert()
1962 /* Invalid sampling buffer entry */ in cpumf_measurement_alert()
1964 pr_err("A sampling buffer entry is incorrect (alert=%#x)\n", in cpumf_measurement_alert()
2026 pr_info("The sampling buffer limits have changed to: " in param_set_sfb_size()
2039 RS_INIT_FAILURE_BSDES = 2, /* Bad basic sampling size */
2046 pr_err("Sampling facility support for perf is not available: " in pr_cpumsf_err()
2070 /* Sampling of diagnostic data authorized, in init_cpum_sampling_pmu()