Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp184112ybv; Wed, 5 Feb 2020 03:47:04 -0800 (PST) X-Google-Smtp-Source: APXvYqyQfEV7zH/fetBpEgpPVC0CLSdf8rwvaH9ooCSK97qi9JEO0hc9zh01hvR5waGQg419vD+2 X-Received: by 2002:a9d:1284:: with SMTP id g4mr24973691otg.207.1580903224831; Wed, 05 Feb 2020 03:47:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580903224; cv=none; d=google.com; s=arc-20160816; b=l0jYczHza1k1i2xVHzFS+TH8SC92ymSjorAjWy1og9LPZuUrZJocAK+5B/Dau80WHN LoaS3hIqLF84GP8ILZFK6y9HCfRUYygfN2a2y/9WoFRV0sZA1iB500XMiLBNbp3bPYNF pjzqkrgoJdRz4nvAit/mMIz2nL1hq+PE+oYo+LCKxYE522EA3bui0iKB/6p+/okrCgN6 CG4vOoZcAvmySF+DRTV1ak3KZWLeH/movhh5AtTOCy+caJQqqLISQDt5pSVbX1WeGUSl d37WiKb+9OxqzWZYo0mctsk+jF+RQV6UVaM0VJ25cC2MRQXPT5Dg469e6lDI5sLHti8P 8xGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=qew9pA6q2eKxei1b7rOjMSLdZuvXZkTmwP0IR146xxg=; b=HlhW6oVtHa/9xPXnF5ujLQLWlR6WEHw9tBACRZkycRU6X+05cbW6H3rI6SFTLEnEOa vyy7wnbrGzpfGXNE2PjDecfhuc6ssoBYBDSRGczPaWXyZ4zNefWutpbZgYm0j6tiAuFt CU5BvKiXpHZiHPDp1AGcKuogaoH0Hrbbl4C5xj7FihlnmP+jbxlU/tXYs/u6UFjY+AIT hTJZArEcA2XjoMC/hjE7Pqma86vRAPWt4w8U/9Onx9M+tPyF7uSvbYPo5/H/DgUUwPc9 zorowlgxLicxRRbW6mtAmaRg6b850LA8ZbFXy0Ue9m54rjt0T5O57zLOC6+/w8pEkcOj Hvsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DK8KueOU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u14si13901377otg.10.2020.02.05.03.46.51; Wed, 05 Feb 2020 03:47:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DK8KueOU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726960AbgBELp4 (ORCPT + 99 others); Wed, 5 Feb 2020 06:45:56 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:44508 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726277AbgBELpz (ORCPT ); Wed, 5 Feb 2020 06:45:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580903155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qew9pA6q2eKxei1b7rOjMSLdZuvXZkTmwP0IR146xxg=; b=DK8KueOUcyhiMF6F8pHdtG2ENI900esqmmaGwpf9cffXDAdnq+suy5VcsOAB1jpxLlENuI KByhM3lDsI+/ZxURCX8fLGDcR4YgV3ScVYeTpIAbFYemr6ATK99eJAa7Gy9XEt6kFMmKgr LW0iU4eaOxqM0qAFfAN19OjGKOfPjXs= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-ub5DhB4FO3K4Ovra8QHw-Q-1; Wed, 05 Feb 2020 06:45:53 -0500 X-MC-Unique: ub5DhB4FO3K4Ovra8QHw-Q-1 Received: by mail-wr1-f69.google.com with SMTP id a12so1051819wrn.19 for ; Wed, 05 Feb 2020 03:45:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=qew9pA6q2eKxei1b7rOjMSLdZuvXZkTmwP0IR146xxg=; b=saTR/shmFRo0l43qJF+fSBWXZdOo8lesMMx9013ZOHUfoRseu+ycT0yEf8Rf/4azRo ZZjC8291xEciX9aEMBEsNOYyesn0PMsaovzFY2sMXrior24V4RWbB0EIzDc0o7hMePVF DVz6TOo0giD2/mFtvDivb8m+OwRfTAM57kOwIro96W6pCoQHtgndwV/AxVNWur9imccn b5QzH0ubIKE7ebF0AgH35+STimK5QgYhy0c1tVistjO1aFmQINu2nOj9IWiTsWYSiO4j n4Tzq7CxAS4Tzz/9rjzk8v8PKQFLml2aJ1CPHFRh/URy4LXMq+xL9a+BDPEBFaHtTxnw b9Ig== X-Gm-Message-State: APjAAAUTQKx7eNT+OvJfpuv4OsE970tPcErFpQf53AtjglLfhGdmkCas wX8ePNwthzj01lfrVodCQWc7vj4aCz7XgPsfrmUEETN15niKbe9bz+oiuDlkehgoGIkNVAqqg4V Q6ywCmnlauQJdUrTzVz2ZcQe3 X-Received: by 2002:a1c:4e01:: with SMTP id g1mr5093129wmh.12.1580903152366; Wed, 05 Feb 2020 03:45:52 -0800 (PST) X-Received: by 2002:a1c:4e01:: with SMTP id g1mr5093110wmh.12.1580903152160; Wed, 05 Feb 2020 03:45:52 -0800 (PST) Received: from vitty.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id n3sm33297899wrs.8.2020.02.05.03.45.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 03:45:51 -0800 (PST) From: Vitaly Kuznetsov To: Eric Hankland Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Eric Hankland , Paolo Bonzini , Jim Mattson , Peter Shier Subject: Re: [kvm-unit-tests PATCH] x86: pmu: Test WRMSR on a running counter In-Reply-To: <20200204012504.9590-1-ehankland@google.com> References: <20200204012504.9590-1-ehankland@google.com> Date: Wed, 05 Feb 2020 12:45:50 +0100 Message-ID: <87y2thl0k1.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric Hankland writes: > Ensure that the value of the counter was successfully set to 0 after > writing it while the counter was running. > > Signed-off-by: Eric Hankland > --- > x86/pmu.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/x86/pmu.c b/x86/pmu.c > index cb8c9e3..8a77993 100644 > --- a/x86/pmu.c > +++ b/x86/pmu.c > @@ -419,6 +419,21 @@ static void check_rdpmc(void) > report_prefix_pop(); > } > > +static void check_running_counter_wrmsr(void) > +{ > + pmu_counter_t evt = { > + .ctr = MSR_IA32_PERFCTR0, > + .config = EVNTSEL_OS | EVNTSEL_USR | gp_events[1].unit_sel, > + .count = 0, > + }; > + > + start_event(&evt); > + loop(); > + wrmsr(MSR_IA32_PERFCTR0, 0); > + stop_event(&evt); > + report("running counter wrmsr", evt.count < gp_events[1].min); > +} > + > int main(int ac, char **av) > { > struct cpuid id = cpuid(10); > @@ -453,6 +468,7 @@ int main(int ac, char **av) > check_counters_many(); > check_counter_overflow(); > check_gp_counter_cmask(); > + check_running_counter_wrmsr(); > > return report_summary(); > } > You shall not pass [-Werror]: gcc -mno-red-zone -mno-sse -mno-sse2 -m64 -O1 -g -MMD -MF x86/.pmu.d -fno-strict-aliasing -Wall -Wwrite-strings -Wempty-body -Wuninitialized -Wignored-qualifiers -Werror -fno-omit-frame-pointer -Wno-frame-address -fno-pic -no-pie -Wclobbered -Wunused-but-set-parameter -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -Wmissing-prototypes -Wstrict-prototypes -std=gnu99 -ffreestanding -I /home/vitty/workspace/Upstream/kvm-unit-tests/lib -I /home/vitty/workspace/Upstream/kvm-unit-tests/lib/x86 -I lib -c -o x86/pmu.o x86/pmu.c x86/pmu.c: In function ‘check_running_counter_wrmsr’: x86/pmu.c:435:44: error: passing argument 2 of ‘report’ makes pointer from integer without a cast [-Werror=int-conversion] 435 | report("running counter wrmsr", evt.count < gp_events[1].min); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~ | | | int In file included from /home/vitty/workspace/Upstream/kvm-unit-tests/lib/x86/processor.h:4, from x86/pmu.c:3: /home/vitty/workspace/Upstream/kvm-unit-tests/lib/libcflat.h:102:43: note: expected ‘const char *’ but argument is of type ‘int’ 102 | extern void report(bool pass, const char *msg_fmt, ...) | ~~~~~~~~~~~~^~~~~~~ cc1: all warnings being treated as errors -- Vitaly