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: <1320676609.18053.44.camel@twins>
Date:	Mon, 07 Nov 2011 15:36:49 +0100
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Gleb Natapov <gleb@...hat.com>
Cc:	kvm@...r.kernel.org, avi@...hat.com, mtosatti@...hat.com,
	linux-kernel@...r.kernel.org, mingo@...e.hu,
	acme@...stprotocols.net
Subject: Re: [PATCHv2 2/9] KVM: Expose a version 2 architectural PMU to a
 guests

On Thu, 2011-11-03 at 14:33 +0200, Gleb Natapov wrote:
> +static u64 read_pmc(struct kvm_pmc *pmc)
> +{
> +       u64 counter, enabled, running;
> +
> +       counter = pmc->counter;
> +
> +       if (pmc->perf_event)
> +               counter += perf_event_read_value(pmc->perf_event,
> +                                                &enabled, &running);
> +
> +       /* FIXME: Scaling needed? */

Since the below programming doesn't use perf_event_attr::pinned, yes.

> +       return counter & pmc_bitmask(pmc);
> +}

> +static void reprogram_counter(struct kvm_pmc *pmc, u32 type,
> +               unsigned config, bool exclude_user, bool exclude_kernel,
> +               bool intr)
> +{
> +       struct perf_event *event;
> +       struct perf_event_attr attr = {
> +               .type = type,
> +               .size = sizeof(attr),
> +               .exclude_idle = true,
> +               .exclude_host = 1,
> +               .exclude_user = exclude_user,
> +               .exclude_kernel = exclude_kernel,
> +               .sample_period = (-pmc->counter) & pmc_bitmask(pmc),
> +               .config = config,
> +       };
> +
> +       event = perf_event_create_kernel_counter(&attr, -1, current,
> +                                                intr ? kvm_perf_overflow_intr :
> +                                                kvm_perf_overflow, pmc);
> +       if (IS_ERR(event)) {
> +               printk_once("kvm: pmu event creation failed %ld\n",
> +                               PTR_ERR(event));
> +               return;
> +       }
> +
> +       pmc->perf_event = event;
> +       clear_bit(pmc->idx, (unsigned long*)&pmc->vcpu->arch.pmu.reprogram_pmi);
> +} 
--
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