Skip to content

Commit 92188b4

Browse files
committed
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()
2 parents efb9666 + 25d4e7f commit 92188b4

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

tools/arch/x86/include/uapi/asm/kvm.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,14 +408,15 @@ struct kvm_vmx_nested_state_data {
408408
};
409409

410410
struct kvm_vmx_nested_state_hdr {
411-
__u32 flags;
412411
__u64 vmxon_pa;
413412
__u64 vmcs12_pa;
414-
__u64 preemption_timer_deadline;
415413

416414
struct {
417415
__u16 flags;
418416
} smm;
417+
418+
__u32 flags;
419+
__u64 preemption_timer_deadline;
419420
};
420421

421422
struct kvm_svm_nested_state_data {

tools/lib/subcmd/parse-options.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ static int get_value(struct parse_opt_ctx_t *p,
237237
return err;
238238

239239
case OPTION_CALLBACK:
240+
if (opt->set)
241+
*(bool *)opt->set = true;
242+
240243
if (unset)
241244
return (*opt->callback)(opt, NULL, 1) ? (-1) : 0;
242245
if (opt->flags & PARSE_OPT_NOARG)

tools/perf/util/hashmap.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@
1111
#include <stdbool.h>
1212
#include <stddef.h>
1313
#include <limits.h>
14-
#ifndef __WORDSIZE
15-
#define __WORDSIZE (__SIZEOF_LONG__ * 8)
16-
#endif
1714

1815
static inline size_t hash_bits(size_t h, int bits)
1916
{
2017
/* shuffle bits and return requested number of upper bits */
21-
return (h * 11400714819323198485llu) >> (__WORDSIZE - bits);
18+
#if (__SIZEOF_SIZE_T__ == __SIZEOF_LONG_LONG__)
19+
/* LP64 case */
20+
return (h * 11400714819323198485llu) >> (__SIZEOF_LONG_LONG__ * 8 - bits);
21+
#elif (__SIZEOF_SIZE_T__ <= __SIZEOF_LONG__)
22+
return (h * 2654435769lu) >> (__SIZEOF_LONG__ * 8 - bits);
23+
#else
24+
# error "Unsupported size_t size"
25+
#endif
2226
}
2327

2428
typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx);

0 commit comments

Comments
 (0)