lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1336388454.27020.2.camel@laptop>
Date:	Mon, 07 May 2012 13:00:54 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Robert Richter <robert.richter@....com>
Cc:	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Ingo Molnar <mingo@...nel.org>,
	Stephane Eranian <eranian@...gle.com>,
	Jiri Olsa <jolsa@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/7] perf/x86-ibs: Add support for IBS pseudo events

On Wed, 2012-05-02 at 20:26 +0200, Robert Richter wrote:
> +enum ibs_filter_type {
> +       IBS_NO_FILTER           = 0,
> +       IBS_MATCH_FILTER        = 1,
> +       IBS_ANY_SET_FILTER      = 2,
> +       IBS_PSEUDO_EVENT        = 0x0F,
> +};
> +
> +struct ibs_filter {
> +       struct {
> +               u16             idx             : 8;
> +               u16             reserved        : 4;
> +               u16             type            : 4;
> +       };
> +       union {
> +               struct {
> +                       u8      mask;
> +                       u8      match;
> +               };
> +               u16             any;
> +       };
> +};
> +
> +static bool
> +__perf_ibs_sample_matches(struct ibs_filter *filter, void *data, int size)
> +{
> +       int left = size;
> +
> +       switch (filter->type) {
> +       case IBS_MATCH_FILTER:
> +               left -= sizeof(u8);
> +               break;
> +       case IBS_ANY_SET_FILTER:
> +               left -= sizeof(u16);
> +               break;
> +       default:
> +               return false;
> +       }
> +
> +       left -= filter->idx;
> +       if (left < 0)
> +               return false;
> +
> +       switch (filter->type) {
> +       case IBS_MATCH_FILTER:
> +               return ((*(u8*)(data + filter->idx)) & filter->mask) == filter->match;
> +       case IBS_ANY_SET_FILTER:
> +               return (*(u16*)(data + filter->idx)) & filter->any;
> +       };
> +
> +       return false;
> +}
> +
> +static bool perf_ibs_sample_matches(struct perf_event *event,
> +                                   struct perf_ibs_data *data)
> +{
> +       int i;
> +       union {
> +               struct ibs_filter filter[4];
> +               u64     config[2];
> +       } f;
> +       struct ibs_filter *filter = f.filter;
> +
> +       f.config[0] = event->attr.config1;
> +       f.config[1] = event->attr.config2;
> +
> +       for (i = 0; i < 4; i++, filter++) {
> +               if (filter->type == IBS_NO_FILTER)
> +                       break;
> +               if (!__perf_ibs_sample_matches(filter, data->regs, data->size))
> +                       return false;
> +       }
> +
> +       return true;
> +} 

Who again wasn't decoding anything in perf_event_attr:config* ?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ