From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752267AbbHaUES (ORCPT ); Mon, 31 Aug 2015 16:04:18 -0400 Received: from one.firstfloor.org ([193.170.194.197]:55191 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751345AbbHaUER (ORCPT ); Mon, 31 Aug 2015 16:04:17 -0400 Date: Mon, 31 Aug 2015 22:04:15 +0200 From: Andi Kleen To: Alexander Shishkin Cc: Andi Kleen , Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo Subject: Re: [PATCH] perf/x86/intel/pt: Export cpu frequency ratios needed by PT decoders Message-ID: <20150831200415.GQ1747@two.firstfloor.org> References: <1440687986-27246-1-git-send-email-alexander.shishkin@linux.intel.com> <87lhcvtdg9.fsf@tassilo.jf.intel.com> <87io7vhaw3.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87io7vhaw3.fsf@ashishki-desk.ger.corp.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 31, 2015 at 03:59:08PM +0300, Alexander Shishkin wrote: > Andi Kleen writes: > > > Alexander Shishkin writes: > >> + return sprintf(page, "%lu\n", val); > >> + case 1: > >> + cpuid(0x15, &eax, &ebx, &ecx, &edx); > > > > Surely this needs to be protected by a cpuid level check? > > Broadwell for once doesn't have CPUID 0x15. > > I couldn't find where this is explicitly said in the SDM. However, the > leaf description says that CPUID.0x15.EBX[31:0]==0 means that the ratio > is not enumerated. I don't see how to better communicate this to > userspace though than to simply have 0 there. What I meant is -- the kernel may crash on a older CPU that does not support CPUID 0x15. For example Broadwell doesn't have it. For CPUID you always need to check the level. -Andi