Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756942AbdDRTaw (ORCPT ); Tue, 18 Apr 2017 15:30:52 -0400 Received: from terminus.zytor.com ([65.50.211.136]:40183 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750710AbdDRTat (ORCPT ); Tue, 18 Apr 2017 15:30:49 -0400 Subject: Re: [PATCH] X86: don't report PAT on CPUs that don't support it To: Mikulas Patocka , Thomas Gleixner , Ingo Molnar References: Cc: x86@kernel.org, linux-kernel@vger.kernel.org From: "H. Peter Anvin" Message-ID: Date: Tue, 18 Apr 2017 12:28:20 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1208 Lines: 28 On 04/18/17 12:07, Mikulas Patocka wrote: > In the file arch/x86/mm/pat.c, there's a variable __pat_enabled. The > variable is set to 1 by default and the function pat_init() sets > __pat_enabled to 0 if the CPU doesn't support PAT. > > However, on AMD K6-3 CPU, the processor initialization code never calls > pat_init() and so __pat_enabled stays 1 and the function pat_enabled() > returns true, even though the K6-3 CPU doesn't support PAT. > > The result of this bug is that this warning is produced when attemting to > start the Xserver and the Xserver doesn't start (fork() returns ENOMEM). > Another symptom of this bug is that the framebuffer driver doesn't set the > K6-3 MTRR registers. > > This patch changes pat_enabled() so that it returns true only if pat > initialization was actually done. > > Also, I changed boot_cpu_has(X86_FEATURE_PAT) to > this_cpu_has(X86_FEATURE_PAT) in pat_ap_init, so that we check the PAT > feature on the processor that is being initialized. > I'm thinking it would be better to replace __pat_enabled with static_cpu_has(X86_FEATURE_PAT) and disable the feature bit if the user has disabled it on the command line, just as we do with other features. -hpa