Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2101274yba; Mon, 15 Apr 2019 05:06:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlvYtiS+nQQ8aGV4/K57qDAxuMSEWTRJzOCjruWqmQYcEINzBNgwQgbpBOEVbDGiFQ7o1K X-Received: by 2002:a63:2c55:: with SMTP id s82mr67048411pgs.356.1555329962138; Mon, 15 Apr 2019 05:06:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555329962; cv=none; d=google.com; s=arc-20160816; b=Ce0vEobI3BW/fvHDPBH1Bfrn4n+mJtTtuO8q8zFIcuvn66PCKcWUNJakfGdsRbOFTs LNts1tN9LpiZbaivv8a4j32TZW93nfvBpc5vYL3mcZ/ceHZ6LdhHCHNNGNKtjHmib0Xi TOZ/Ed4QGCHAufr+epZ1xiN3Zp8KE5+rzdUuWxZIVq6pxalJtx1j035PcGyZvOQ1qFaW y8Kal6FlEVzlKcje3XmrAzW5qlVIRFqzmfBEXtqDT6ReJVqCSK0DYLerSD1xIFxl/1Oe zOq0HEKFiBSlXMoXXa9TdhfENK9FTocxA3wzr8K935InXuR6rccre6njgZXee0RTZSRb vP/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VmLFfbiaIcxEWV4kEBlZ0BMPymLpnk8TU9PQIRS9AOo=; b=ontjH/4LKtGBeJrTbY+dQ829kN5HzV2Yio0scsQvg4eEkhJxEvcbVQA/V4PFvWWBix m65r4YpGJHG8LNn4pHFtu08JmsTYy6uhl/89d14Ls0YuSDtuF4zOvT90+tH0IHFt74E8 YmzcmrmGERpD1ZXtwo1dqzluv6uqgdJPflnqYp01i0vw24Nk/gw7vfw+ocql4yK9wxLj Pn/RKcepmYifPfGBioB47vcjOCCo543j8awJru5+x660AbwVueoSpWKYA3xUlUuPPasx sa/7jSmZCIbL5dKNQCNfWRow/Go1mtBLwFte8iZZs2ORM4YM2ebXL7U4Jhd3BaiKHfph W/tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qJsspAKo; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si34448929pgl.348.2019.04.15.05.05.46; Mon, 15 Apr 2019 05:06:02 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qJsspAKo; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727364AbfDOMEt (ORCPT + 99 others); Mon, 15 Apr 2019 08:04:49 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42132 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727329AbfDOMEs (ORCPT ); Mon, 15 Apr 2019 08:04:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VmLFfbiaIcxEWV4kEBlZ0BMPymLpnk8TU9PQIRS9AOo=; b=qJsspAKowlGOwC6n3mabzISmE 0kGla+MQ7pKk4zj4oSPamzisYvhl/K44Gjq+xY5rYDq7QtsxmbcqqtCaLzcvlWNuTqFETdsPQbbor a0r1ldAqhK3VpnA5UqdIv083vxZwKs6wmIBcsTly73vTdJQrCuSR/WlSUpjru74i+VIdsaeFPWb5U I1LQirgdWf7/RdmNunzOpqVsNMCQtHnjDYnC0pg72Ez9/21otYzfUI9Cx2fy6TM2tJDb27bM7Gbyv TcH8UaNkedUyaiC5mTZwExDDqBtiU4xSJ4locOaZZZA2HNqbHkvGbY+/047wqw/MZQ7VTSKVA40/J AeWh7RmTA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG0Lu-0004Im-35; Mon, 15 Apr 2019 12:04:46 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5A56128B6D257; Mon, 15 Apr 2019 14:04:44 +0200 (CEST) Date: Mon, 15 Apr 2019 14:04:44 +0200 From: Peter Zijlstra To: Bandan Das Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Jiri Olsa , linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH] perf/x86: descriptive failure messages for PMU init Message-ID: <20190415120444.GN11158@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 12, 2019 at 03:09:17PM -0400, Bandan Das wrote: > > There's a default warning message that gets printed, however, > there are various failure conditions: > - a msr read can fail > - a msr write can fail > - a msr has an unexpected value > - all msrs have unexpected values (disable PMU) > > Also, commit commit 005bd0077a79 ("perf/x86: Modify error message in > virtualized environment") completely removed printing the msr in > question but these messages could be helpful for debugging vPMUs as > well. Add them back and change them to pr_debugs, this keeps the > behavior the same for baremetal. > > Lastly, use %llx to silence checkpatch Yuck... if you're debugging a hypervisor, you can bloody well run your own kernel with additional print slattered around. The whole make an exception for virt bullshit was already pushing it, this is just insane. > @@ -266,12 +282,30 @@ static bool check_hw_exists(void) > return true; > > msr_fail: > - if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) { > + if (virt) > pr_cont("PMU not available due to virtualization, using software events only.\n"); > - } else { > - pr_cont("Broken PMU hardware detected, using software events only.\n"); > - pr_err("Failed to access perfctr msr (MSR %x is %Lx)\n", > - reg, val_new); > + switch (status) { > + case READ_FAIL: > + if (virt) > + pr_debug("Failed to read perfctr msr (MSR %x)\n", reg); > + else > + pr_err("Failed to read perfctr msr (MSR %x)\n", reg); > + break; > + case WRITE_FAIL: > + if (virt) > + pr_debug("Failed to write perfctr msr (MSR %x, wrote: %llx, read: %llx)\n", > + reg, val, val_new); > + else > + pr_err("Failed to write perfctr msr (MSR %x, wrote: %llx, read: %llx)\n", > + reg, val, val_new); > + break; > + case PMU_FAIL: > + /* fall through for default message */ > + default: > + if (virt) > + pr_debug("Broken PMU hardware detected, using software events only.\n"); > + else > + pr_cont("Broken PMU hardware detected, using software events only.\n"); > }