HV:Added SBuf support to copy samples generated to guest.

sbuf.h:
    Added new shared buffer types for SEP and SOCWATCH

profiling.c
   sbuf_next_ptr - returns  address of next available buffer

profiling_sbuf_put_variable:
   This function allows to write data of variable size into shared buffer.

profiling_generate_data:
     Read profiling data and transfer to SOS
     Drops transfer of profiling data if sbuf is full/insufficient and log it

Tracked-On: projectacrn#1409
Acked-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Chinthapally, Manisha <manisha.chinthapally@intel.com>
This commit is contained in:
Chinthapally, Manisha
2018-10-23 09:05:53 -07:00
committed by wenlingz
parent 5985c1216e
commit cab93c053a
4 changed files with 252 additions and 3 deletions

View File

@@ -217,6 +217,16 @@ struct sep_state {
uint64_t saved_debugctl_value;
} __aligned(8);
struct data_header {
int32_t collector_id;
uint16_t cpu_id;
uint16_t data_type;
uint64_t tsc;
uint64_t payload_size;
uint64_t reserved;
} __aligned(SEP_BUF_ENTRY_SIZE);
#define DATA_HEADER_SIZE ((uint64_t)sizeof(struct data_header))
struct core_pmu_sample {
/* context where PMI is triggered */
uint32_t os_id;
@@ -238,6 +248,7 @@ struct core_pmu_sample {
uint32_t cs;
} __aligned(SEP_BUF_ENTRY_SIZE);
#define CORE_PMU_SAMPLE_SIZE ((uint64_t)sizeof(struct core_pmu_sample))
#define NUM_LBR_ENTRY 32
struct lbr_pmu_sample {
@@ -251,6 +262,7 @@ struct lbr_pmu_sample {
uint64_t lbr_info[NUM_LBR_ENTRY];
} __aligned(SEP_BUF_ENTRY_SIZE);
#define LBR_PMU_SAMPLE_SIZE ((uint64_t)sizeof(struct lbr_pmu_sample))
struct pmu_sample {
/* core pmu sample */
struct core_pmu_sample csample;
@@ -265,6 +277,7 @@ struct vm_switch_trace {
int32_t os_id;
}__aligned(SEP_BUF_ENTRY_SIZE);
#define VM_SWITCH_TRACE_SIZE ((uint64_t)sizeof(struct vm_switch_trace))
/*
* Wrapper containing SEP sampling/profiling related data structures
*/

View File

@@ -39,6 +39,8 @@
enum {
ACRN_TRACE,
ACRN_HVLOG,
ACRN_SEP,
ACRN_SOCWATCH,
ACRN_SBUF_ID_MAX,
};
@@ -85,6 +87,7 @@ uint32_t sbuf_get(struct shared_buf *sbuf, uint8_t *data);
*/
uint32_t sbuf_put(struct shared_buf *sbuf, uint8_t *data);
int sbuf_share_setup(uint16_t pcpu_id, uint32_t sbuf_id, uint64_t *hva);
uint32_t sbuf_next_ptr(uint32_t pos, uint32_t span, uint32_t scope);
#else /* HV_DEBUG */