Re: [PATCH v1 5/5] perf cs-etm: Track exception number
From: leo . yan
Date: Thu Dec 06 2018 - 00:47:48 EST
On Wed, Dec 05, 2018 at 11:03:29AM -0700, Mathieu Poirier wrote:
[...]
> > > > static ocsd_datapath_resp_t
> > > > cs_etm_decoder__buffer_exception(struct cs_etm_decoder *decoder,
> > > > + const ocsd_generic_trace_elem *elem,
> > > > const uint8_t trace_chan_id)
> > > > {
> > > > - return cs_etm_decoder__buffer_packet(decoder, trace_chan_id,
> > > > - CS_ETM_EXCEPTION);
> > > > + int ret;
> > > > + struct cs_etm_packet *packet;
> > > > +
> > > > + ret = cs_etm_decoder__buffer_packet(decoder, trace_chan_id,
> > > > + CS_ETM_EXCEPTION);
> > > > + if (ret != OCSD_RESP_CONT && ret != OCSD_RESP_WAIT)
> > > > + return ret;
> > > > +
> > > > + packet = &decoder->packet_buffer[decoder->tail];
> > > > +
> > > > + /*
> > > > + * Exception number is recorded per CPU and later can be used
> > > > + * for exception return instruction analysis.
> > > > + */
> > > > + decoder->exc_num[packet->cpu] = elem->exception_number;
> > >
> > > Am I missing something or the information about the exception number that is
> > > recorded here isn't used anywhere?
> >
> > The exception number will be used to set branch flag patch [1].
>
> Right, I realised that when I started reviewing that set. The rule of
> thumb here is to introduce code in the same patchset it is used so
> that we avoid adding needless code to the kernel.
Will move this patch into sample flag series.
Thanks,
Leo Yan