Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3256703imm; Mon, 10 Sep 2018 13:44:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYFEBQWdWVTMJMcsFOEjJR4ukCAfl+91LgYnLTzkPup7ci9+gOK9kW9EcyT4bd4gRlrq0A8 X-Received: by 2002:a63:d150:: with SMTP id c16-v6mr24822699pgj.188.1536612262509; Mon, 10 Sep 2018 13:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536612262; cv=none; d=google.com; s=arc-20160816; b=J7V+FanEPXmKea6Y1il9/1o/90yhG86FRiSOGWAK8BSEOcv7/g2kRsbY3F2XbAGAJ6 dFgK2sgXTyxcigWm9hqJzxZnP3/crBJ129fPnX1m9WJnll1959Em80+y/rNPHr756+NL KAsHxbmnfoCs8AgMB/mfoiDCZsFZxoKEWbr7L1Cg0/sA2DVERuO7V4xXNev64I9czIaD /M0KvxxXDxb6tGZFfrkMBVVQFLGTBlDeFbEGlDZn6AUklQ+nEBb9cr/ep8RGAU7xQID8 gckcBhS6vJhv/lphe6LxPMZ6fdVVTroTsDfcFq4HXBafQ7ap++/0KXb7y3Nc3rl8P0Pt rvFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=6DiMUpgSirFRgXtVTfrOJFeb5WNOpBRVKEMgszuNehA=; b=i7pWvG17hYiVmZ5YtIsi/hI3R6hhICfXQ1MiFDJrKdvMWZfHo6HcEBY/wPtzoBCZHc HJtbU8hXq150gKNibuJjQH2l+c64f1263ne42hjUURssh+vyN6LS3O762TmFnJlPWyn2 GAlQFT9XDvkEh9BAXECz1D08ToM7StEfbbHVgMDubymY3VbIxXC3TWDlkHEYb+ccGRce wwZdl2UTQc56AsN+BhWvTyxv0FgEv3cTn7SiJHk8Qa5VMQhhfeWGsqYB7Fbwuq+/iHUp hptpE6PQgXKJQdMrIKn1D+QrAZlFD3h9R7k+hfUL2iAzG4BNupdVPpfQSBHTfGB7KDLK qeKA== 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 d1-v6si17825432plr.455.2018.09.10.13.44.04; Mon, 10 Sep 2018 13:44:22 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726862AbeIKBjM (ORCPT + 99 others); Mon, 10 Sep 2018 21:39:12 -0400 Received: from mga01.intel.com ([192.55.52.88]:54885 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726795AbeIKBjM (ORCPT ); Mon, 10 Sep 2018 21:39:12 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Sep 2018 13:43:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,357,1531810800"; d="scan'208";a="73150820" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.20]) by orsmga006.jf.intel.com with ESMTP; 10 Sep 2018 13:43:17 -0700 Message-ID: <1536612197.3236.13.camel@intel.com> Subject: Re: [RFC][PATCH 5/8] x86/mm: fix exception table comments From: Sean Christopherson To: Dave Hansen , linux-kernel@vger.kernel.org Cc: peterz@infradead.org, tglx@linutronix.de, x86@kernel.org, luto@kernel.org Date: Mon, 10 Sep 2018 13:43:17 -0700 In-Reply-To: References: <20180907194852.3C351B82@viggo.jf.intel.com> <20180907194900.DF3B41C0@viggo.jf.intel.com> <1536354280.11460.28.camel@intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-09-07 at 14:51 -0700, Dave Hansen wrote: > > > > > > > > +  * Only do the expensive exception table search when we might be at > > > +  * risk of a deadlock: > > > +  * 1. We failed to acquire mmap_sem, and > > > +  * 2. The access was an explicit kernel-mode access > > > +  *    (X86_PF_USER=0). > > Might be worth reminding the reader that X86_PF_USER will be set in > > sw_error_code for implicit accesses.  I saw "explicit" and my mind > > immediately jumped to hw_error_code for whatever reason.  E.g.: > > > > * 2. The access was an explicit kernel-mode access (we set X86_PF_USER > > *    in sw_error_code for implicit kernel-mode accesses). > Yeah, that was not worded well.  Is this better? > > > > >          * Only do the expensive exception table search when we might be at > >          * risk of a deadlock: > >          * 1. We failed to acquire mmap_sem, and > >          * 2. The access was an explicit kernel-mode access.  An access > >          *    from user-mode will X86_PF_USER=1 set via hw_error_code or > >          *    set in sw_error_code if it were an implicit kernel-mode > >          *    access that originated in user mode. For me, mentioning hw_error_code just muddies the waters, e.g. why is hw_error_code mentioned when it's not checked in the code?  Comments alone won't help someone that's reading this code and doesn't understand that hardware sets X86_PF_USER for user-mode accesses.  Maybe this? * 2. The access was an explicit kernel-mode access.  X86_PF_USER *    is set in sw_error_code for both user-mode accesses and *    implicit kernel-mode accesses that originated in user mode.