Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3631452ybi; Tue, 2 Jul 2019 10:47:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQEPwiTmvOVYW8piVjxqyVb+zGvioUW3fPmB2zDdcA5tFplFwVG3O1jKzOEPQYIejWGrcm X-Received: by 2002:a17:902:d70a:: with SMTP id w10mr34662994ply.251.1562089637282; Tue, 02 Jul 2019 10:47:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562089637; cv=none; d=google.com; s=arc-20160816; b=sm9a4JKh9k1M/naO28pIUwHnW9gqqTKlw+9Fe6fqLZRfyXL3uQgbwIckF/mSACU1yl KamHofToDfuRtnzbcDmRSuGH7ITBwZ8cvgPCxxu2+3EFqDE4uiTBpBdzxVphNHIOiX7B 5lVnpezHe+ku3ZE7feMcyyLGX+liWOCjcvn7CQahFirm27po1fpWsDtAIAE4xsP4RQPh 4iQ73JQ7M7tCBfqkhdydNsMEHPgaG32NniHqgo71K1hFpPOfuK7sCM8Oke0A4R2TOLbA ndfQktMeL1xfd1Mx3jyEzmmoWkX1S/MCPWdXGEHkMDc3X+XRTwAXtDoqjimyyCSmfPUy dPWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=62xeVPs21E5ReOKr0PeNYmMpHFedVY8IfymEZkh+FCQ=; b=FcdlutimrK8DKC4rtbglSItljvP57aH8xMv1Vpo5GEyYPhJr/+sG9bQLeq4R9f5vEB e/RoXYzwieLHXO/LgshncxHLkzJj5EEzWCauG1X9RI+sAV+qWtnMSw25MueKUYXodcMG V9dVu3j/OaJ6xnfeO1K5RDmh1Rv2rnfryqm/t7gU1McW9pYd2J2JtwdtrJiBwbrJfeOT MKY9phtq1x2p5rOR+5tHXvN0qNPFhhXYXmyMV5fiDoKCNYouPfp5u7O6gUhpInQQTH8o ENjHWtMH4MoHUP80LwYQMdo+z1wgu4mN01rprK79bVPsB/ZISzPiOduW5Aoq33Uy4tNi 1R2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=S62756i4; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9si12845440pgp.72.2019.07.02.10.47.00; Tue, 02 Jul 2019 10:47:17 -0700 (PDT) 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=@google.com header.s=20161025 header.b=S62756i4; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726779AbfGBRqa (ORCPT + 99 others); Tue, 2 Jul 2019 13:46:30 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40465 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726613AbfGBRq3 (ORCPT ); Tue, 2 Jul 2019 13:46:29 -0400 Received: by mail-ed1-f67.google.com with SMTP id k8so28099972eds.7 for ; Tue, 02 Jul 2019 10:46:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=62xeVPs21E5ReOKr0PeNYmMpHFedVY8IfymEZkh+FCQ=; b=S62756i4kfBhwvThdrp/bluvzbNlIQhGr2N54PhVXSt+bW0Fi/DqOASwTjFn0iK8pH O4scfXJPkY3GXcYQW2rzoHqJyot3S894FWcAdSIEqZk4YStXK4NAY1qtHaa05VSYEVQw ypFocTubeKx4UpSHTcIfHAVwLY+DfTPdFB/QPPA/6io5p/bC36vp16JpzDFaICzTEYpn pUnjF49M/4lXBLlpaUm/pUbCp3kS/HQu191UUJFGzCeemFPZg40bEiZ5sElzpVhhBUto Ii0pKGfpV/f83Cx6GZSfpDb78rXAwFs7DvSh+JbVnTg2ezwdco08A8C/48egMrQr6M2O knkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=62xeVPs21E5ReOKr0PeNYmMpHFedVY8IfymEZkh+FCQ=; b=CTcux4h5+YefOZyi+iCiMT9o2hXimCOuA+/ostzdme2XD85nDERe4u7qVQxPs4tBO7 smtb0SefHW1uT/IRCXAyx7cY/rJ545+tKkfG4XDRzhE78zwWpaTAT6ZCyKAVmr77k5po iw/g7uYLqgMxeMQE7J6Ua/P0vtelodj0f8xmEqPYpgvh8ZWw+H07rYu9bG5kyPW7NF98 JswlSh7okanqqyVLQha9MsK/Lb5HrSl1wJRZg4BnnKTtttqqQnS9LicHie+pQ6UijTLO GwSKSd1ZkHrD2URZeD4EU1dC9nxNdIXg46qUpfYFfRNvdWtRxsY+Y5Hbtrxiqw4osYiT R4gQ== X-Gm-Message-State: APjAAAVPGf0vz8F09IPVEIVW0Hi0YLBdgp96K1a4fZzvSFxhO70qD9Gu 1dsz7CdgE7lZ9p8RbJJcasdgM/D3sCoaKXV04bJl+ZLHMcw= X-Received: by 2002:aa7:d845:: with SMTP id f5mr37202330eds.78.1562089587822; Tue, 02 Jul 2019 10:46:27 -0700 (PDT) MIME-Version: 1.0 References: <5D036843.2010607@intel.com> <5D11E58B.1060306@intel.com> In-Reply-To: <5D11E58B.1060306@intel.com> From: Eric Hankland Date: Tue, 2 Jul 2019 10:46:16 -0700 Message-ID: Subject: Re: [PATCH v1] KVM: x86: PMU Whitelist To: Wei Wang Cc: Paolo Bonzini , rkrcmar@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Actually I have another thing to discuss: > probably we could consider to make this filter list white/black configurable > from userspace. For example, userspace option: filter-list=white/black Works for me. I'll include this in the next version. > Probably we don't need this field to be passed from userspace? > > We could directly use AMD64_RAW_EVENTMASK_NB, which includes bit[35:32]. > Since those bits are reserved on Intel CPUs, have them as mask should be > fine. > > Alternatively, we could add this event_mask field to struct kvm_pmu, and > initalize > it in the vendor specific intel_pmu_init or amd_pmu_init. > > Both options above look good to me. Sounds good. I'll go with the first suggestion for now since it's simpler. If other reviewers prefer the second I can implement that. > For the fixed counter, we could add a bitmap flag to kvm_arch, > indicating which counter is whitelist-ed based on the > "eventsel+umask" value passed from userspace. This flag is > updated when updating the whitelist-ed events to kvm. > For example, if userspace gives "00+01" (INST_RETIRED_ANY), > then we enable fixed counter0 in the flag. > > When reprogram_fixed_counter, we check the flag and return > if the related counter isn't whitelisted. Sounds good to me. If you don't have any more comments I'll send out the next version with all the requested changes. Eric