Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8655160imu; Tue, 4 Dec 2018 11:54:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/VVYsKmBxigx3rqSd5DiTFgnKJo8LIqMQmbebiSvIcRMNuqWG461MlAYctzg6HU50WAdZRZ X-Received: by 2002:a17:902:31a4:: with SMTP id x33mr20900194plb.41.1543953278655; Tue, 04 Dec 2018 11:54:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543953278; cv=none; d=google.com; s=arc-20160816; b=wuNvKvNA/zAPuciDQBUW3nSJ9mI9etZvNvX/4qUPqrOU68ne6nmtTLb4TSI1gY/4hF WtVZn3NhL4mPbdSAuhm5Uu190j5Tqz+GVz+xxjgtn9+GNr6uR2vkvS8DRFimB0/yIwvO tZgbHZKUkhvq5KT+Au1X/shfsaOsmgIZztGTi449v6OA8Ytu5PQfOqceI7cPvhP7SPA/ QeQRzYC8ldPv+7t6rxWBWdVggQQ2b2Jz4m8flgje/u6+wSSyzp1ChwU1uwYTuTvbykd1 u5OGXhtmA7JIplsIHEBz6sTMLB0DFnioRYHwOCJIjazoW9zT/oCWtRXC4eVI+SIRr3fm MwOQ== 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; bh=7NtEBw7RosA00kCRbxndCmQ/5ThPmJ6/AmlB7Zi7oxE=; b=08ekHqO4p3eevZWRcaCRljveKjIOIlG+s0CBvjYo6WQjFXAarWUiFMHtMnwwYVo8Hy wqyFsw9odeiOYyr+bVGGfpKXLdkIlxlK1Mri4g/mIKkv7hTdDQBIIAVdUg6NHtzq0tz1 6XcwYybSH/z8WiLRuPWPaO3P1lFH0SnHcy9/uSlp/RXWC8EqkOgDY49MA6gVGGeqJZKn 2HvXWb+gxE05k969FlnZwCFxdyNv5pNFVjrQBladiZHjjhz51dRA1Q5RdeoaFVuPHJho stOFV3MbUTsmhfGSKaT8i9P4VGrgCcx2pMtu5tThdsGmHyshP9WDG/pujQJ72vj3WfE9 +GDQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si18718070plx.33.2018.12.04.11.54.23; Tue, 04 Dec 2018 11:54:38 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726206AbeLDTwk (ORCPT + 99 others); Tue, 4 Dec 2018 14:52:40 -0500 Received: from mga01.intel.com ([192.55.52.88]:49934 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725880AbeLDTwk (ORCPT ); Tue, 4 Dec 2018 14:52:40 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2018 11:52:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,315,1539673200"; d="scan'208";a="106976700" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.154]) by fmsmga008.fm.intel.com with ESMTP; 04 Dec 2018 11:52:39 -0800 Date: Tue, 4 Dec 2018 11:52:39 -0800 From: Sean Christopherson To: Andy Lutomirski Cc: Ingo Molnar , X86 ML , LKML , Yu-cheng Yu , Dave Hansen , Peter Zijlstra , Borislav Petkov Subject: Re: [PATCH 6/5] x86/fault: Clean up the page fault oops decoder a bit Message-ID: <20181204195239.GE17374@linux.intel.com> References: <11212acb25980cd1b3030875cd9502414fbb214d.1542841400.git.luto@kernel.org> <20181122084119.GA44720@gmail.com> <20181127153202.GA27075@linux.intel.com> <20181204193346.GD17374@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 04, 2018 at 11:47:10AM -0800, Andy Lutomirski wrote: > On Tue, Dec 4, 2018 at 11:34 AM Sean Christopherson > wrote: > > > > On Tue, Dec 04, 2018 at 11:22:25AM -0800, Andy Lutomirski wrote: > > > On Tue, Nov 27, 2018 at 7:32 AM Sean Christopherson > > > wrote: > > > > diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c > > > > index 2ff25ad33233..510e263c256b 100644 > > > > --- a/arch/x86/mm/fault.c > > > > +++ b/arch/x86/mm/fault.c > > > > @@ -660,8 +660,10 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, unsigned long ad > > > > err_str_append(error_code, err_txt, X86_PF_RSVD, "[RSVD]" ); > > > > err_str_append(error_code, err_txt, X86_PF_INSTR, "[INSTR]"); > > > > err_str_append(error_code, err_txt, X86_PF_PK, "[PK]" ); > > > > - > > > > - pr_alert("#PF error: %s\n", error_code ? err_txt : "[normal kernel read fault]"); > > > > + err_str_append(~error_code, err_txt, X86_PF_USER, "[KERNEL]"); > > > > + err_str_append(~error_code, err_txt, X86_PF_WRITE | X86_PF_INSTR, > > > > + "[READ]"); > > > > + pr_alert("#PF error code: %s\n", err_txt); > > > > > > > > > > Seems generally nice, but I would suggest making the bit-not-set name > > > be another parameter to err_str_append(). I'm also slightly uneasy > > > about making "KERNEL" look like a bit, but I guess it doesn't bother > > > me too much. > > > > What about "SUPERVISOR" instead of "KERNEL"? It'd be consistent with > > the SDM and hopefully less likely to be misconstrued as something else. > > Or even just [!USER], perhaps. I thought about that too, but the pedant in me didn't like the inconsistency of doing "READ" instead of "[!WRITE] [!INSTR]", and IMO "READ" is a lot more readable (no pun intended). I also like having completely different text, makes it harder to miss a single "!" and go down the wrong path.