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: <20191025144839.GA24735@kernel.org>
Date:   Fri, 25 Oct 2019 11:48:39 -0300
From:   Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H . Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Leo Yan <leo.yan@...aro.org>, Jiri Olsa <jolsa@...hat.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 5/6] perf auxtrace: Add auxtrace_cache__remove()

Em Fri, Oct 25, 2019 at 03:59:59PM +0300, Adrian Hunter escreveu:
> Add auxtrace_cache__remove(). Intel PT uses an auxtrace_cache to store the
> results of code-walking, so that the same block of instructions does not
> have to be decoded repeatedly. However, when there are text poke events,
> the associated cache entries need to be removed.

Applied this one as it is just leg work for the rest, that I'll wait a
bit for comments.

- Arnaldo
 
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
>  tools/perf/util/auxtrace.c | 28 ++++++++++++++++++++++++++++
>  tools/perf/util/auxtrace.h |  1 +
>  2 files changed, 29 insertions(+)
> 
> diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
> index 8470dfe9fe97..c555c3ccd79d 100644
> --- a/tools/perf/util/auxtrace.c
> +++ b/tools/perf/util/auxtrace.c
> @@ -1457,6 +1457,34 @@ int auxtrace_cache__add(struct auxtrace_cache *c, u32 key,
>  	return 0;
>  }
>  
> +static struct auxtrace_cache_entry *auxtrace_cache__rm(struct auxtrace_cache *c,
> +						       u32 key)
> +{
> +	struct auxtrace_cache_entry *entry;
> +	struct hlist_head *hlist;
> +	struct hlist_node *n;
> +
> +	if (!c)
> +		return NULL;
> +
> +	hlist = &c->hashtable[hash_32(key, c->bits)];
> +	hlist_for_each_entry_safe(entry, n, hlist, hash) {
> +		if (entry->key == key) {
> +			hlist_del(&entry->hash);
> +			return entry;
> +		}
> +	}
> +
> +	return NULL;
> +}
> +
> +void auxtrace_cache__remove(struct auxtrace_cache *c, u32 key)
> +{
> +	struct auxtrace_cache_entry *entry = auxtrace_cache__rm(c, key);
> +
> +	auxtrace_cache__free_entry(c, entry);
> +}
> +
>  void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key)
>  {
>  	struct auxtrace_cache_entry *entry;
> diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
> index f201f36bc35f..3f4aa5427d76 100644
> --- a/tools/perf/util/auxtrace.h
> +++ b/tools/perf/util/auxtrace.h
> @@ -489,6 +489,7 @@ void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c);
>  void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry);
>  int auxtrace_cache__add(struct auxtrace_cache *c, u32 key,
>  			struct auxtrace_cache_entry *entry);
> +void auxtrace_cache__remove(struct auxtrace_cache *c, u32 key);
>  void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key);
>  
>  struct auxtrace_record *auxtrace_record__init(struct evlist *evlist,
> -- 
> 2.17.1

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ