Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2131950yba; Mon, 15 Apr 2019 05:42:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwM/BhiXp7A1LQXU0bN9ZODbM3bvdfLED0uDXuaGACdWBCzuonuL+i9UstxlykXIPorAP9 X-Received: by 2002:a62:304:: with SMTP id 4mr74030631pfd.99.1555332174402; Mon, 15 Apr 2019 05:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555332174; cv=none; d=google.com; s=arc-20160816; b=MFjPZtsRJcrXEP5aClnQdOjOY9tSV3fN3Txr/CdcuBeFZYETwKjKTjYBPKnlz/9B/c zVwGYAiyZyoR2O3uXg9XgvkMoglHIpnglRNtkVH7e1pCZBAK8fi9hRLqvgphHrnypwqT kwFBWHq2d756pvaR/ozdQNeXfflDGBHBmSvjR2Dk4VLWhxYA+lRoPWy48yfxtxJjPH4G CnBuhcCwUETbquhcHSiZsQIrLKV0RkJpf3bVyfq6PRB9d8o4eLjnN0KQds9hI3TuMrEK Mp6+TOEo1Io2l4u2I3BAT54wL3PyHwfZGed4+xg2bbhmG6XcvG7wsCss1eN34PbiD+X+ FOAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=a8nglOP1vLrbPtc29udi/gfF7Op2XHUz/hwoszUOQWk=; b=cHr/Vsny1oWfDnNqZLLCGG236zbjbhSiihmMELqCNE2meLcZFx5KTlcIycJRSkVLZU nF+fbB8QWY4vk1Ww+UlbwP2EJWzKzfQdNmqq1nZ9ECkUknb7M3SKi+I69AcfoEv8KtwZ xqF/6Dtd5DIa3MBB41SwYuYaG+ftoEL4bTLiQ/zl3CRBiJEafKJSL6vQ0KY5zrx2cwyL wzGC1rlglc/nmCnOvA20H/0sBD/HuwZ0nwzeqe8HtQ1q1djIpYtnh4C4kxy1fo70wUnp 62H3jcRvpqKMJ8k0Vxa69IGT7n8u6bjB0Iuyl+mB35YFee3r3nmp/US/QAVq54F1EETX Y5Bw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 g20si2705425pfg.207.2019.04.15.05.42.38; Mon, 15 Apr 2019 05:42:54 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727442AbfDOMmG (ORCPT + 99 others); Mon, 15 Apr 2019 08:42:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38426 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726094AbfDOMmG (ORCPT ); Mon, 15 Apr 2019 08:42:06 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 1605C89C33; Mon, 15 Apr 2019 12:42:06 +0000 (UTC) Received: from gigantic.usersys.redhat.com (helium.bos.redhat.com [10.18.17.132]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F9745D717; Mon, 15 Apr 2019 12:42:05 +0000 (UTC) From: Bandan Das To: Peter Zijlstra 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 References: <20190415120444.GN11158@hirez.programming.kicks-ass.net> Date: Mon, 15 Apr 2019 08:42:04 -0400 In-Reply-To: <20190415120444.GN11158@hirez.programming.kicks-ass.net> (Peter Zijlstra's message of "Mon, 15 Apr 2019 14:04:44 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 15 Apr 2019 12:42:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, Peter Zijlstra writes: > 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. > The only virt specific parts are the pr_debugs which I can remove and replace with unconditional pr_err()s as suggested by Jiri. Is that ok ? Bandan >> @@ -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"); >> }