From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 2/9] KVM: Expose a version 2 architectural PMU to a guests Date: Thu, 3 Nov 2011 10:31:15 +0200 Message-ID: <20111103083115.GH14726@redhat.com> References: <1319993624-20247-1-git-send-email-gleb@redhat.com> <1319993624-20247-3-git-send-email-gleb@redhat.com> <4EAFCE36.4070509@redhat.com> <20111101123041.GV17571@redhat.com> <4EB1150F.3020509@redhat.com> <20111102110945.GC14726@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, mtosatti@redhat.com, mingo@elte.hu, a.p.zijlstra@chello.nl, acme@ghostprotocols.net To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38827 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751870Ab1KCIbj (ORCPT ); Thu, 3 Nov 2011 04:31:39 -0400 Content-Disposition: inline In-Reply-To: <20111102110945.GC14726@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Nov 02, 2011 at 01:09:46PM +0200, Gleb Natapov wrote: > > > > The user can cause this to be very small (even zero). Can this cause an > > > > NMI storm? > > > > > > > If user will set it to zero then attr.sample_period will always be 0 and > > > perf will think that the event is non sampling and will use max_period > > > instead. For a small value greater than zero how is it different from > > > userspace creating an event with sample_period of 1? > > > > I don't know. Does the kernel survive it? > > > Need to test, but I do not see anything in the kernel that prevent userspace > from setting it to any value. > You can set sample_period to 1 by providing -c 1 to perf top/record. Kernel survives it easily since perf subsystem kindly throttles interrupts for you. You can set max interrupt per event per time tick in /proc/sys/kernel/perf_event_max_sample_rate. -- Gleb.