Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp459571pxb; Tue, 3 Nov 2020 04:19:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyy3n4Ag4VOL2z8g1rl/G3VjBiPgT52HK10cZ2cK6kkKofGPzJ1DGBpIQPIKTPMPjdmHF72 X-Received: by 2002:a17:906:c096:: with SMTP id f22mr6375629ejz.488.1604405959466; Tue, 03 Nov 2020 04:19:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604405959; cv=none; d=google.com; s=arc-20160816; b=xYRjJMOLvTrZ3Y2xqyVb51QhaFUAjCUFzh1rpG5fY/6pFnKGg+AebyPO8/OEdDvCd7 WcOgOD+NxVWuq/hYumhyq23d6NF/HV7QtGN0K2VjohR9tO5utzE2ACAZWoRuXvem1lEV ePolCk8fb8bQaSkmathu+1A6yKAqOJ4Th1Ejppd0XEo50blRL+jOlWOQrv2rOnSwdGw8 sOLuR43IbejsiITfcBZKwwl4f8ER6CBH5Z96wiUKjpEG4MNKAbbVvirkaTfFgl/FhNnq 1f3y0mvPuKNgUfS7hmOk2v7qYeQgDvxY7RAhjxbx0VdCCKVZDDJKki4y1sVf989JOpY7 Kw4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=y4Ywh2huJcjxhreG/CWJHlmeB/qbQvkwUKrsmoqSn+Q=; b=rpw5218cMD6Zlk/G+sGAUr2Iod3nqqa7FLwdhpX4sdmDfx0wH07hN2wIaazOsfkIK2 ZOZcabNZ8iJECyTsorvHtqsC4GRAVs0jPyEjOKCPuuqSP9aphTUcknsHAVdZi+8ZrOgK hO1SL8dLCE8kVZPd/hlB2I75S/hG/Vj3esepkNonJZpE67M00cwz1uRkHTKEO/1cDSIG rO1XdoQL3YeyqxgyJHCJO3e16hoCLIliCMR2AWgFhaqVDXwUYl3wIgqfER+X7tuYtAOo 3qi7V0yUQOQ6WMoWy60iIf4e6foR9uJV3iKNf31hFnU9z5aR6RY5EaAoY4WOoweF/L2c niXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id v8si11396235eju.136.2020.11.03.04.18.56; Tue, 03 Nov 2020 04:19:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729011AbgKCMPe (ORCPT + 99 others); Tue, 3 Nov 2020 07:15:34 -0500 Received: from mga02.intel.com ([134.134.136.20]:17445 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728889AbgKCMPe (ORCPT ); Tue, 3 Nov 2020 07:15:34 -0500 IronPort-SDR: z6lbI9/rdZqCH+ITG5lJKQsBoCxpuBsyoaVCBhIeN2Mxiz/rFaSkdBzSrNo35n5+4Nq1EuThmb 5ZpbXOQLPswQ== X-IronPort-AV: E=McAfee;i="6000,8403,9793"; a="156030734" X-IronPort-AV: E=Sophos;i="5.77,447,1596524400"; d="scan'208";a="156030734" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 04:15:33 -0800 IronPort-SDR: w2Z0yU18SM1WOXKQgjzJ2A4bre+P+PzGlF/xTtG2KjRbBL5yxEt5NCrvEhf31R7JF0BOiAa5I5 AU1JKBpeGIgQ== X-IronPort-AV: E=Sophos;i="5.77,447,1596524400"; d="scan'208";a="538468244" Received: from xiaoyaol-mobl.ccr.corp.intel.com (HELO [10.255.28.220]) ([10.255.28.220]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 04:15:29 -0800 Subject: Re: [PATCH RFC v3 2/4] x86/bus_lock: Handle warn and fatal in #DB for bus lock To: Fenghua Yu , Thomas Gleixner , Borislav Petkov , Ingo Molnar , Peter Zijlstra , Randy Dunlap , Tony Luck , Christopherson Sean J , Ashok Raj , Ravi V Shankar Cc: linux-kernel , x86 References: <20201031002714.3649728-1-fenghua.yu@intel.com> <20201031002714.3649728-3-fenghua.yu@intel.com> From: Xiaoyao Li Message-ID: <21d0415c-9af4-db18-8e65-410f6ab5ec68@linux.intel.com> Date: Tue, 3 Nov 2020 20:15:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201031002714.3649728-3-fenghua.yu@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/31/2020 8:27 AM, Fenghua Yu wrote: ... > diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c > index 3c70fb34028b..1c3442000972 100644 > --- a/arch/x86/kernel/traps.c > +++ b/arch/x86/kernel/traps.c > @@ -953,6 +953,13 @@ static __always_inline void exc_debug_user(struct pt_regs *regs, > goto out_irq; > } > > + /* > + * Handle bus lock. #DB for bus lock can only be triggered from > + * userspace. > + */ > + if (!(dr6 & DR_BUS_LOCK)) it should be if (dr6 & DR_BUS_LOCK) since you keep DR6.[bit 11] reserved in this version. bit 11 of debug_read_clear_dr6() being set to 1 means bus lock detected. > + handle_bus_lock(regs); > + > /* Add the virtual_dr6 bits for signals. */ > dr6 |= current->thread.virtual_dr6; > if (dr6 & (DR_STEP | DR_TRAP_BITS) || icebp) >