Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp517498pxk; Thu, 24 Sep 2020 11:05:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8/ZkuxqVB+MiJzP6KNOaQCpMp26CZ8yrDsBzH170wHnEoujEoLBIbdKYRiRPHT2sPwAPU X-Received: by 2002:a17:907:648:: with SMTP id wq8mr1202961ejb.291.1600970736029; Thu, 24 Sep 2020 11:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600970736; cv=none; d=google.com; s=arc-20160816; b=q77bX0Wu46TrtRefq+NxFhkE6JUrZgjW/6toJHCsFt1XuxisFpwawYt7PbceqITxtP A+RSLjPcJ9PBQArNbw7/wgbW01yjKXq/aWZYDbjijOP4CblKYOK60xK2vdqM3yjchDld OQmMBCc4+vCpKIi1oBQh2ilbI7f/QBR5Y4sLeCvaag2UTaYcZ/ohkHENQFBLkI//bRS9 gQGlw2kBwXpUP+qea2Pfop3NTUWeCVaRtlYr8uqT2pR+9CgC6Wc97qNToETBIrTMpDeU ucj8gisiSsU0QTqMNmOu2nLRBt7kN5hNYq24icapajFfGVDnCG4QYHgGn3z6SdTfI0Q2 eLpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=oG9xK2vkAqxbLwgvctfK5p6uVl/LG5CD3WRk8mHhnh4=; b=ot9wzIUESpB0nM7KaX4g5V0Jdi9pTusD6TtjuaaicYamFVOQQoCu/mProJZWwaO83X IhqblrJy5+W6oCpAVMPN5ud1ZkRn48Iu0FPm1xK3DZAgQcPJDZ2CIQF4KXCarDpFgLn5 MfXHqno8yCJQTtqNLy9ZBMefTdkipg/rh9zqUSrlx2dp6BTO8NhwV1QiENP3eClL8TCk UFOweBfqWG5elznMjH6WqEdyjeTGFIl2PWLe37eYjKgv9N82Fg0XFEA0fLzHJcsDWPKb YE5OzRc4vmDNYfPobNnfTizU5iiGqdRS1NIzeNQ/tX6YbHQIpbJKSM9F9dMADX0TGcXh KmhQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp19si213996ejc.122.2020.09.24.11.05.12; Thu, 24 Sep 2020 11:05:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728729AbgIXSBj (ORCPT + 99 others); Thu, 24 Sep 2020 14:01:39 -0400 Received: from mga07.intel.com ([134.134.136.100]:10426 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728577AbgIXSBj (ORCPT ); Thu, 24 Sep 2020 14:01:39 -0400 IronPort-SDR: tspAxKL38P51eu2PSgU6Ir6nbEdt8uMy8r8MvvcLvadxq6+P5PVSOp/zXzj6QT10NyH5CByIzT VogB/J68x3eQ== X-IronPort-AV: E=McAfee;i="6000,8403,9754"; a="225434734" X-IronPort-AV: E=Sophos;i="5.77,298,1596524400"; d="scan'208";a="225434734" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2020 11:01:22 -0700 IronPort-SDR: QJkOAgUtzmtFELwpkWXY/qDcpAauQAP7A0QAuKTa8XkbMa42AaMZapy+j9q6fR8Ru9ub+NgGCo M2n4erRyIbzA== X-IronPort-AV: E=Sophos;i="5.77,298,1596524400"; d="scan'208";a="305920835" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.160]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2020 11:01:21 -0700 Date: Thu, 24 Sep 2020 11:01:20 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] KVM: VMX: Replace MSR_IA32_RTIT_OUTPUT_BASE_MASK with helper function Message-ID: <20200924180120.GA9649@linux.intel.com> References: <20200923163629.20168-1-sean.j.christopherson@intel.com> <20200923163629.20168-3-sean.j.christopherson@intel.com> <0a215e25-798d-3f17-0fcb-885806f2351b@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0a215e25-798d-3f17-0fcb-885806f2351b@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 07:07:22PM +0200, Paolo Bonzini wrote: > On 23/09/20 18:36, Sean Christopherson wrote: > > +static inline bool pt_output_base_valid(struct kvm_vcpu *vcpu, u64 base) > > +{ > > + /* The base must be 128-byte aligned and a legal physical address. */ > > + return !(base & (~((1UL << cpuid_maxphyaddr(vcpu)) - 1) | 0x7f)); > > +} > > The fact that you deemed a comment necessary says something already. :) > What about: > > return !kvm_mmu_is_illegal_gpa(vcpu, base) && !(base & 0x7f); > > (where this new usage makes it obvious that mmu should have been vcpu). Ya. I think it was a sort of sunk cost fallacy. Dammit, I spent all that time figuring out what this code does, I'm keeping it!!! v3 incoming...