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
202 /* If the origin is reached, sampling buffer is freed */ in free_sampling_buffer()
240 * Allocates new sample-data-blocks and adds them to the specified sampling
243 * Important: This modifies the sampling buffer and must be called when the
244 * sampling facility is disabled.
260 /* Append to the existing sampling buffer, overwriting the table-link in realloc_sampling_buffer()
268 * the sampling buffer origin. in realloc_sampling_buffer()
318 /* Link sampling buffer to its origin */ in realloc_sampling_buffer()
328 * Allocates and initializes a sampling buffer structure using the
415 /* Calculate sampling buffers using 4K pages in allocate_buffers()
417 * 1. The sampling size is 32 bytes for basic sampling. This size in allocate_buffers()
419 * sampling uses auxlilary data buffer setup which provides the in allocate_buffers()
433 * 3. Use the sampling frequency as input. in allocate_buffers()
436 * SDBs to handle a higher sampling rate. in allocate_buffers()
447 /* If there is already a sampling buffer allocated, it is very likely in allocate_buffers()
448 * that the sampling facility is enabled too. If the event to be in allocate_buffers()
449 * initialized requires a greater sampling buffer, the allocation must in allocate_buffers()
450 * be postponed. Changing the sampling buffer requires the sampling in allocate_buffers()
471 /* Use a percentage-based approach to extend the sampling facility in compute_sfb_extent()
518 /* extend_sampling_buffer() - Extend sampling buffer
519 * @sfb: Sampling buffer structure (for local CPU)
522 * Use this function to extend the sampling buffer based on the overflow counter
525 * Important: This function disables the sampling facility in order to safely
526 * change the sampling buffer structure. Do not call this function
538 /* Disable the sampling facility to reset any states and also in extend_sampling_buffer()
543 /* Extend the sampling buffer. in extend_sampling_buffer()
655 * Obtain the PID from the basic-sampling data entry and in cpumsf_output_event_pid()
687 /* The min/max sampling rates specifies the valid range in getrate()
695 * sampling rate does not exceed this value. This also helps in getrate()
707 /* The sampling information (si) contains information about the
708 * min/max sampling intervals and the CPU speed. So calculate the
709 * correct sampling interval and avoid the whole period adjust
712 * Since the CPU Measurement sampling facility can not handle frequency
713 * calculate the sampling interval when frequency is specified using
718 * set to the correct sampling rate.
756 /* Reserve CPU-measurement sampling facility */ in __hw_perf_event_init()
765 /* Access per-CPU sampling information (query sampling info) */ in __hw_perf_event_init()
769 * sampling info from the current CPU, otherwise use event->cpu to in __hw_perf_event_init()
771 * Later, cpuhw indicates whether to allocate sampling buffers for a in __hw_perf_event_init()
780 * sampling structure for accessing the CPU-specific QSI. in __hw_perf_event_init()
786 /* Check sampling facility authorization and, if not authorized, in __hw_perf_event_init()
796 pr_warn("CPU Measurement Facility sampling is temporarily not available\n"); in __hw_perf_event_init()
801 /* Always enable basic sampling */ in __hw_perf_event_init()
804 /* Check if diagnostic sampling is requested. Deny if the required in __hw_perf_event_init()
805 * sampling authorization is missing. in __hw_perf_event_init()
823 /* Allocate the per-CPU sampling buffer using the CPU information in __hw_perf_event_init()
825 * CPU (event->cpu == -1; or cpuhw == NULL), allocate sampling in __hw_perf_event_init()
832 /* Event is not pinned, allocate sampling buffer on in __hw_perf_event_init()
843 /* If PID/TID sampling is active, replace the default overflow in __hw_perf_event_init()
844 * handler to extract and resolve the PIDs from the basic-sampling in __hw_perf_event_init()
866 /* No support for taken branch sampling */ in cpumsf_pmu_event_init()
878 /* Support sampling of CPU cycles in addition to the in cpumsf_pmu_event_init()
881 * sampling events only. in cpumsf_pmu_event_init()
919 /* Check whether to extent the sampling buffer. in cpumsf_pmu_enable()
921 * Two conditions trigger an increase of the sampling buffer for a in cpumsf_pmu_enable()
924 * 2. Sampling overflows that contribute to pending allocations. in cpumsf_pmu_enable()
926 * Note that the extend_sampling_buffer() function disables the sampling in cpumsf_pmu_enable()
927 * facility, but it can be fully re-enabled using sampling controls that in cpumsf_pmu_enable()
944 /* (Re)enable the PMU and sampling facility */ in cpumsf_pmu_enable()
951 pr_err("Loading sampling controls failed: op 1 err %i\n", err); in cpumsf_pmu_enable()
972 /* Switch off sampling activation control */ in cpumsf_pmu_disable()
979 pr_err("Loading sampling controls failed: op 2 err %i\n", err); in cpumsf_pmu_disable()
985 * TEAR/DEAR values are valid only if the sampling facility is in cpumsf_pmu_disable()
987 * for a disabled sampling facility because cpumsf_pmu_enable() in cpumsf_pmu_disable()
1112 * Walks through a sample-data-block and collects sampling data entries that are
1113 * then pushed to the perf event subsystem. Depending on the sampling function,
1114 * there can be either basic-sampling or combined-sampling data entries. A
1115 * combined-sampling data entry consists of a basic- and a diagnostic-sampling
1116 * data entry. The sampling function is determined by the flags in the perf
1117 * event hardware structure. The function always works with a combined-sampling
1120 * Note that the implementation focuses on basic-sampling data entries and, if
1121 * such an entry is not valid, the entire combined-sampling data entry is
1163 * from a combined basic- and diagnostic-sampling. in hw_collect_samples()
1164 * If only basic-sampling is then active, entries are in hw_collect_samples()
1180 /* hw_perf_event_update() - Process sampling buffer
1184 * Processes the sampling buffer and create perf event samples.
1185 * The sampling buffer position are retrieved and saved in the TEAR_REG
1201 * AUX buffer is used when in diagnostic sampling mode. in hw_perf_event_update()
1224 * is reached, extend the sampling buffer. in hw_perf_event_update()
1314 * Finish sampling on the cpu. Called by cpumsf_pmu_del() with pmu
1347 * Start sampling on the CPU. Called by cpumsf_pmu_add() when an event
1513 * Measurement alert handler for diagnostic mode sampling.
1540 "diagnostic-sampling mode is full\n", in hw_collect_aux()
1604 * aux_buffer_setup() - Setup AUX buffer for diagnostic mode sampling
1630 "maximum sampling buffer limit\n", in aux_buffer_setup()
1635 "minimum sampling buffer limit\n", in aux_buffer_setup()
1717 /* Check if the new sampling period/frequency is appropriate.
1732 * sampling structure for accessing the CPU-specific QSI. in cpumsf_pmu_check_period()
1750 /* Activate sampling control.
1751 * Next call of pmu_enable() starts sampling.
1767 /* Deactivate sampling control.
1768 * Next call of pmu_enable() stops sampling.
1805 /* Set up sampling controls. Always program the sampling register in cpumsf_pmu_add()
1807 * that is used by hw_perf_event_update() to store the sampling buffer in cpumsf_pmu_add()
1819 /* Ensure sampling functions are in the disabled state. If disabled, in cpumsf_pmu_add()
1820 * switch on sampling enable control. */ in cpumsf_pmu_add()
1873 * The availablitiy depends on the CPU_MF sampling facility authorization
1875 * time by the sampling facility device driver.
1877 * also turned off for diagnostic sampling.
1880 * level for diagnostic sampling and installs the attribute
1881 * file for diagnostic sampling if necessary.
1974 /* Sampling authorization change request */ in cpumf_measurement_alert()
1985 /* Invalid sampling buffer entry */ in cpumf_measurement_alert()
1987 pr_err("A sampling buffer entry is incorrect (alert=0x%x)\n", in cpumf_measurement_alert()
2049 pr_info("The sampling buffer limits have changed to: " in param_set_sfb_size()
2062 RS_INIT_FAILURE_BSDES = 2, /* Bad basic sampling size */
2069 pr_err("Sampling facility support for perf is not available: " in pr_cpumsf_err()
2093 /* Sampling of diagnostic data authorized, in init_cpum_sampling_pmu()