Commit 92188b41 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'perf-tools-fixes-2020-07-19' of...

Merge tag 'perf-tools-fixes-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into master

Pull perf tooling fixes from Arnaldo Carvalho de Melo:

 - Update hashmap.h from libbpf and kvm.h from x86's kernel UAPI.

 - Set opt->set in libsubcmd's OPT_CALLBACK_SET(). This fixes
   'perf record --switch-output-event event-name' usage"

* tag 'perf-tools-fixes-2020-07-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  tools arch kvm: Sync kvm headers with the kernel sources
  perf tools: Sync hashmap.h with libbpf's
  libsubcmd: Fix OPT_CALLBACK_SET()
parents efb9666e 25d4e7f5
...@@ -408,14 +408,15 @@ struct kvm_vmx_nested_state_data { ...@@ -408,14 +408,15 @@ struct kvm_vmx_nested_state_data {
}; };
struct kvm_vmx_nested_state_hdr { struct kvm_vmx_nested_state_hdr {
__u32 flags;
__u64 vmxon_pa; __u64 vmxon_pa;
__u64 vmcs12_pa; __u64 vmcs12_pa;
__u64 preemption_timer_deadline;
struct { struct {
__u16 flags; __u16 flags;
} smm; } smm;
__u32 flags;
__u64 preemption_timer_deadline;
}; };
struct kvm_svm_nested_state_data { struct kvm_svm_nested_state_data {
......
...@@ -237,6 +237,9 @@ static int get_value(struct parse_opt_ctx_t *p, ...@@ -237,6 +237,9 @@ static int get_value(struct parse_opt_ctx_t *p,
return err; return err;
case OPTION_CALLBACK: case OPTION_CALLBACK:
if (opt->set)
*(bool *)opt->set = true;
if (unset) if (unset)
return (*opt->callback)(opt, NULL, 1) ? (-1) : 0; return (*opt->callback)(opt, NULL, 1) ? (-1) : 0;
if (opt->flags & PARSE_OPT_NOARG) if (opt->flags & PARSE_OPT_NOARG)
......
...@@ -11,14 +11,18 @@ ...@@ -11,14 +11,18 @@
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <limits.h> #include <limits.h>
#ifndef __WORDSIZE
#define __WORDSIZE (__SIZEOF_LONG__ * 8)
#endif
static inline size_t hash_bits(size_t h, int bits) static inline size_t hash_bits(size_t h, int bits)
{ {
/* shuffle bits and return requested number of upper bits */ /* shuffle bits and return requested number of upper bits */
return (h * 11400714819323198485llu) >> (__WORDSIZE - bits); #if (__SIZEOF_SIZE_T__ == __SIZEOF_LONG_LONG__)
/* LP64 case */
return (h * 11400714819323198485llu) >> (__SIZEOF_LONG_LONG__ * 8 - bits);
#elif (__SIZEOF_SIZE_T__ <= __SIZEOF_LONG__)
return (h * 2654435769lu) >> (__SIZEOF_LONG__ * 8 - bits);
#else
# error "Unsupported size_t size"
#endif
} }
typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx); typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment