mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
perf arm_spe: Store MIDR in arm_spe_pkt
The MIDR will affect printing of arm_spe_pkts, so store a copy of it there. Technically it's constant for each decoder, but there is no decoder when doing a raw dump, so it has to be stored in every packet. It will only be used in raw dump mode and not in normal decoding for now, but to avoid any surprises, set MIDR properly on the decoder too. Having both the MIDR and the arm_spe_pkt (which has a copy of it) in the decoder seemed a bit weird, so remove arm_spe_pkt from the decoder. The packet is only short lived anyway so probably shouldn't have been there in the first place. Reviewed-by: Leo Yan <leo.yan@arm.com> Signed-off-by: James Clark <james.clark@linaro.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will@kernel.org> Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
0c7e4d11fb
commit
8cf4d17ec7
|
|
@ -120,7 +120,8 @@ static int arm_spe_get_data(struct arm_spe_decoder *decoder)
|
|||
return decoder->len;
|
||||
}
|
||||
|
||||
static int arm_spe_get_next_packet(struct arm_spe_decoder *decoder)
|
||||
static int arm_spe_get_next_packet(struct arm_spe_decoder *decoder,
|
||||
struct arm_spe_pkt *packet)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -134,7 +135,8 @@ static int arm_spe_get_next_packet(struct arm_spe_decoder *decoder)
|
|||
}
|
||||
|
||||
ret = arm_spe_get_packet(decoder->buf, decoder->len,
|
||||
&decoder->packet);
|
||||
packet, decoder->midr);
|
||||
|
||||
if (ret <= 0) {
|
||||
/* Move forward for 1 byte */
|
||||
decoder->buf += 1;
|
||||
|
|
@ -144,7 +146,7 @@ static int arm_spe_get_next_packet(struct arm_spe_decoder *decoder)
|
|||
|
||||
decoder->buf += ret;
|
||||
decoder->len -= ret;
|
||||
} while (decoder->packet.type == ARM_SPE_PAD);
|
||||
} while (packet->type == ARM_SPE_PAD);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -154,19 +156,20 @@ static int arm_spe_read_record(struct arm_spe_decoder *decoder)
|
|||
int err;
|
||||
int idx;
|
||||
u64 payload, ip;
|
||||
struct arm_spe_pkt packet;
|
||||
|
||||
memset(&decoder->record, 0x0, sizeof(decoder->record));
|
||||
decoder->record.context_id = (u64)-1;
|
||||
|
||||
while (1) {
|
||||
err = arm_spe_get_next_packet(decoder);
|
||||
err = arm_spe_get_next_packet(decoder, &packet);
|
||||
if (err <= 0)
|
||||
return err;
|
||||
|
||||
idx = decoder->packet.index;
|
||||
payload = decoder->packet.payload;
|
||||
idx = packet.index;
|
||||
payload = packet.payload;
|
||||
|
||||
switch (decoder->packet.type) {
|
||||
switch (packet.type) {
|
||||
case ARM_SPE_TIMESTAMP:
|
||||
decoder->record.timestamp = payload;
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -147,8 +147,7 @@ struct arm_spe_decoder {
|
|||
|
||||
const unsigned char *buf;
|
||||
size_t len;
|
||||
|
||||
struct arm_spe_pkt packet;
|
||||
u64 midr;
|
||||
};
|
||||
|
||||
struct arm_spe_decoder *arm_spe_decoder_new(struct arm_spe_params *params);
|
||||
|
|
|
|||
|
|
@ -222,11 +222,12 @@ static int arm_spe_do_get_packet(const unsigned char *buf, size_t len,
|
|||
}
|
||||
|
||||
int arm_spe_get_packet(const unsigned char *buf, size_t len,
|
||||
struct arm_spe_pkt *packet)
|
||||
struct arm_spe_pkt *packet, u64 midr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = arm_spe_do_get_packet(buf, len, packet);
|
||||
packet->midr = midr;
|
||||
/* put multiple consecutive PADs on the same line, up to
|
||||
* the fixed-width output format of 16 bytes per line.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ struct arm_spe_pkt {
|
|||
enum arm_spe_pkt_type type;
|
||||
unsigned char index;
|
||||
uint64_t payload;
|
||||
uint64_t midr;
|
||||
};
|
||||
|
||||
/* Short header (HEADER0) and extended header (HEADER1) */
|
||||
|
|
@ -184,7 +185,7 @@ enum arm_spe_events {
|
|||
const char *arm_spe_pkt_name(enum arm_spe_pkt_type);
|
||||
|
||||
int arm_spe_get_packet(const unsigned char *buf, size_t len,
|
||||
struct arm_spe_pkt *packet);
|
||||
struct arm_spe_pkt *packet, u64 midr);
|
||||
|
||||
int arm_spe_pkt_desc(const struct arm_spe_pkt *packet, char *buf, size_t len);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -134,8 +134,10 @@ struct data_source_handle {
|
|||
.ds_synth = arm_spe__synth_##func, \
|
||||
}
|
||||
|
||||
static int arm_spe__get_midr(struct arm_spe *spe, int cpu, u64 *midr);
|
||||
|
||||
static void arm_spe_dump(struct arm_spe *spe __maybe_unused,
|
||||
unsigned char *buf, size_t len)
|
||||
unsigned char *buf, size_t len, u64 midr)
|
||||
{
|
||||
struct arm_spe_pkt packet;
|
||||
size_t pos = 0;
|
||||
|
|
@ -148,7 +150,8 @@ static void arm_spe_dump(struct arm_spe *spe __maybe_unused,
|
|||
len);
|
||||
|
||||
while (len) {
|
||||
ret = arm_spe_get_packet(buf, len, &packet);
|
||||
ret = arm_spe_get_packet(buf, len, &packet, midr);
|
||||
|
||||
if (ret > 0)
|
||||
pkt_len = ret;
|
||||
else
|
||||
|
|
@ -174,10 +177,10 @@ static void arm_spe_dump(struct arm_spe *spe __maybe_unused,
|
|||
}
|
||||
|
||||
static void arm_spe_dump_event(struct arm_spe *spe, unsigned char *buf,
|
||||
size_t len)
|
||||
size_t len, u64 midr)
|
||||
{
|
||||
printf(".\n");
|
||||
arm_spe_dump(spe, buf, len);
|
||||
arm_spe_dump(spe, buf, len, midr);
|
||||
}
|
||||
|
||||
static int arm_spe_get_trace(struct arm_spe_buffer *b, void *data)
|
||||
|
|
@ -302,8 +305,10 @@ static void arm_spe_set_pid_tid_cpu(struct arm_spe *spe,
|
|||
|
||||
if (speq->thread) {
|
||||
speq->pid = thread__pid(speq->thread);
|
||||
if (queue->cpu == -1)
|
||||
if (queue->cpu == -1) {
|
||||
speq->cpu = thread__cpu(speq->thread);
|
||||
arm_spe__get_midr(spe, speq->cpu, &speq->decoder->midr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1248,6 +1253,7 @@ static int arm_spe__setup_queue(struct arm_spe *spe,
|
|||
|
||||
if (queue->cpu != -1)
|
||||
speq->cpu = queue->cpu;
|
||||
arm_spe__get_midr(spe, queue->cpu, &speq->decoder->midr);
|
||||
|
||||
if (!speq->on_heap) {
|
||||
int ret;
|
||||
|
|
@ -1490,8 +1496,11 @@ static int arm_spe_process_auxtrace_event(struct perf_session *session,
|
|||
/* Dump here now we have copied a piped trace out of the pipe */
|
||||
if (dump_trace) {
|
||||
if (auxtrace_buffer__get_data(buffer, fd)) {
|
||||
u64 midr = 0;
|
||||
|
||||
arm_spe__get_midr(spe, buffer->cpu.cpu, &midr);
|
||||
arm_spe_dump_event(spe, buffer->data,
|
||||
buffer->size);
|
||||
buffer->size, midr);
|
||||
auxtrace_buffer__put_data(buffer);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user