Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2349198ybt; Tue, 16 Jun 2020 03:52:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxU1NoXWzbv65KARjJlvKjcs5vjKUi5Gsp5g8tdnsx8Wm40+AgiUCpEq/l0iOSHAzM+7E9b X-Received: by 2002:a05:6402:1812:: with SMTP id g18mr1953097edy.96.1592304723075; Tue, 16 Jun 2020 03:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592304723; cv=none; d=google.com; s=arc-20160816; b=dc3QFL0FgzY6K2uM+Ib61FV4GrArIz/XkvjnBLPFyJpRTHMrjJ/IodEVXJm+vn4+Nb Wd7dYJ55xKXCgz/SdMnwIsSvJtjon+tija7U3InESgbSvwWGT8AeuvLG/8vKy0L66uVr /h42bdPPMxAl29jfxU1bVuLZ/Wvz5X+uKKNEwwa2HgwvSeWiEgr8nwaRNHYCSc/+FeGr N/vi4zEcsPedFU1qD0bo0KAWz0wn4Dti+id7k0BZL+pfLEt68myEQXPo9TZTMpgawZjl pVXD/Wib7NY/VobUmpUmSBDMyExWySAqvAAc1O3WrZNI0K5YAec9/qexSdBKMVYRZV0k WFwg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject:dkim-signature; bh=1H0luCJODbtQ42YgYv0yeAzbAXL/psZsh9fUX+jVH3w=; b=K4WW7RMT+viPQzJmJQSK8B6LX0wF60k/1R7kcjWsVPulv5d4VjwPBmkgMYWFHL2ehd I+sOEPoDmbOIS1jj0gK5eh6ZJQyT6VKUnGKaZEbRhwf6pEotIudAGBgSPmm6dp4d1ukM vJUhfG3Cj+kGKHuoP+iXtWghCq3Y9tCd7OQzkC+YvVunOdCHkxH/6mznEeCJ3JjJ3yE/ fdpWswWERzG5EP1UIUWWLgW/HM+DbouoCh3DstIFwhc6ORwd6Gb4cqEhBVTgKUMPF6ym HjHe6G4oNmHlCBzPNbyiaPub9Cmr/XwiDhYGqd6mq1DQrQ1VJz5rnPUUVvLvV/50YRKt EaWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U1RpiQFk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id nh1si10175309ejb.255.2020.06.16.03.51.39; Tue, 16 Jun 2020 03:52:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U1RpiQFk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728365AbgFPKtd (ORCPT + 99 others); Tue, 16 Jun 2020 06:49:33 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:44835 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725775AbgFPKt2 (ORCPT ); Tue, 16 Jun 2020 06:49:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592304567; 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:openpgp:openpgp; bh=1H0luCJODbtQ42YgYv0yeAzbAXL/psZsh9fUX+jVH3w=; b=U1RpiQFkBhOIm4GadxJbcvDtFTNpL/ghl1874VdxoGcb/smX2iF9LfrqWZ+lF8ltSgAnuT jGZRqxUZeiATEKHmbfrSnSosbagr+qu2Al+7zxBotdPhWYtUW/XrqId1MB16W589m/bQZE 0w5/C03Y7fUKXiEfZ28QI5QEtePTw8o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-dkMoe5--OaCYt8sZF_1gtA-1; Tue, 16 Jun 2020 06:49:24 -0400 X-MC-Unique: dkMoe5--OaCYt8sZF_1gtA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 21C62846375; Tue, 16 Jun 2020 10:49:23 +0000 (UTC) Received: from thuth.remote.csb (ovpn-114-128.ams2.redhat.com [10.36.114.128]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9AB2B768DC; Tue, 16 Jun 2020 10:49:19 +0000 (UTC) Subject: Re: [kvm-unit-tests PATCH] x86: pmu: Test full-width counter writes support To: Like Xu , Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200529074347.124619-1-like.xu@linux.intel.com> <20200529074347.124619-4-like.xu@linux.intel.com> From: Thomas Huth Openpgp: preference=signencrypt Message-ID: Date: Tue, 16 Jun 2020 12:49:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200529074347.124619-4-like.xu@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/05/2020 09.43, Like Xu wrote: > When the full-width writes capability is set, use the alternative MSR > range to write larger sign counter values (up to GP counter width). > > Signed-off-by: Like Xu > --- > lib/x86/msr.h | 1 + > x86/pmu.c | 125 ++++++++++++++++++++++++++++++++++++++++---------- > 2 files changed, 102 insertions(+), 24 deletions(-) [...] > @@ -452,6 +468,66 @@ static void check_running_counter_wrmsr(void) > report_prefix_pop(); > } > > +static void check_counters(void) > +{ > + check_gp_counters(); > + check_fixed_counters(); > + check_rdpmc(); > + check_counters_many(); > + check_counter_overflow(); > + check_gp_counter_cmask(); > + check_running_counter_wrmsr(); > +} > + > +static void do_unsupported_width_counter_write(void *index) > +{ > + wrmsr(MSR_IA32_PMC0 + *((int *) index), 0xffffff0123456789ull); > +} > + > +static void check_gp_counters_write_width(void) > +{ > + u64 val_64 = 0xffffff0123456789ull; > + u64 val_32 = val_64 & ((1ul << 32) - 1); Hi, this broke compilation on 32-bit hosts: https://travis-ci.com/github/huth/kvm-unit-tests/jobs/349654654#L710 Fix should be easy, I guess - either use 1ull or specify the mask 0xffffffff directly. Thomas