Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1721471yba; Thu, 4 Apr 2019 17:16:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVPeBmgWAXa4SaahiK4/RwpKIh5A1El6fEkREGXFcvK0mNWIGtTPQOJRAg/p0HVA6gV8iq X-Received: by 2002:a63:ef09:: with SMTP id u9mr8860334pgh.126.1554423390678; Thu, 04 Apr 2019 17:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554423390; cv=none; d=google.com; s=arc-20160816; b=Oe4sQDK1zolo16rsJHZ6rLBPuXP+DO77q+AMfCwMDUQIxqZG047ZsJ8qNijdsfjaNf 6XE1C2TjfWywBIPYBWk5F+Jqvy24B2XE1OdwBQPxTvhSV8R8zZYz6Lo/8UdVoNwKO/3l VISwlkhkeWoBvil5tEOJ+dubqemRIgJzg6iySHyfVjbUahXE70q8aDG+XnW9O5bSVib6 xydig1G/Wqpk2kZSJC5WIJcxE8v7L+H70Hp6v+v0nU9dlkTdIpMtJZkryL+K7n38y9aO 4N0kKJkSuYU5008q8uXOy6guqRITBC7KsLhPKci3NBec/Zx6GoEoDyP5O19eUwNpxZcT YkbA== 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=NqesfUMp1c8GF18wAD7LhqcClN2qVZZJUnJYeaKok/k=; b=wqYHRraaysDL4DLAI/DWmS8j/eLRaIVwTVDzRdZVFpGdgW20DiUj7JSgi2HfcTcJDK 8Ml2lm7dMQjytljiUL37s9F2tX/Gt556ejgaETqfGfQyHi9ZIJuy14N3mceGX1aEcn+C jXl7cL+e44k6ke9pZA+jXhzmwpE4fLV3i4LDIgJbWGR2qfsJX/XJKYl9ovFK9YRnCKWa 5i+EXdf5t2xvhOo31edHzDs6B50ds6RAmNcS2l0c5qEhFdLK/Zy7IaTfXbOuXnnrBbh6 cYfF10SPCgvfJz9FglgCMLlFLsKI59xQ7c/9RZAOwbeSOMgkGOqUhzGpdEZA2O2L/Tqb wrOg== 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 a5si17021976pgt.393.2019.04.04.17.15.45; Thu, 04 Apr 2019 17:16:30 -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 S1730551AbfDDW4z (ORCPT + 99 others); Thu, 4 Apr 2019 18:56:55 -0400 Received: from mga14.intel.com ([192.55.52.115]:55973 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729009AbfDDW4y (ORCPT ); Thu, 4 Apr 2019 18:56:54 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2019 15:56:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,309,1549958400"; d="scan'208";a="128734818" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by orsmga007.jf.intel.com with ESMTP; 04 Apr 2019 15:56:53 -0700 Date: Thu, 4 Apr 2019 15:49:13 -0700 From: Fenghua Yu To: Thomas Gleixner Cc: Ingo Molnar , Borislav Petkov , H Peter Anvin , Dave Hansen , Paolo Bonzini , Ashok Raj , Peter Zijlstra , Kalle Valo , Xiaoyao Li , Michael Chan , Ravi V Shankar , linux-kernel , x86 , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v6 10/20] x86/split_lock: Handle #AC exception for split lock Message-ID: <20190404224913.GB178488@romley-ivt3.sc.intel.com> References: <1554326526-172295-1-git-send-email-fenghua.yu@intel.com> <1554326526-172295-11-git-send-email-fenghua.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 04, 2019 at 07:31:59PM +0200, Thomas Gleixner wrote: > On Wed, 3 Apr 2019, Fenghua Yu wrote: > > +dotraplinkage void do_alignment_check(struct pt_regs *regs, long error_code) > > +{ > > + unsigned int trapnr = X86_TRAP_AC; > > + char str[] = "alignment check"; > > + int signr = SIGBUS; > > + > > + RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); > > + > > + /* > > + * WARN*()s end up here; fix them up before we call the > > + * notifier chain. > > + */ > > How exactly is WARN*() ending up here? > > > + if (!user_mode(regs) && fixup_bug(regs, trapnr)) > > And that fixup_bug() check does what? > > int fixup_bug(struct pt_regs *regs, int trapnr) > { > if (trapnr != X86_TRAP_UD) > return 0; > > Copy and paste from do_error_trap() .... As you can see, do_alignment_check() is copied from do_error_trap(). But seems this part of code is irrelevant to #AC handler. So I will remove the "if (!user_mode(regs) && fixup_bug(regs, trapnr))" and surrounding code, right? > > > + return; > > + > > + if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) == > > + NOTIFY_STOP) > > + return; > > + > > + cond_local_irq_enable(regs); > > + if (!user_mode(regs) && > > + static_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT)) { > > + /* > > + * Only split lock can generate #AC from kernel at this point. > > + * Warn and disable split lock detection on this CPU. The > > + * faulting instruction will be executed without generating > > + * another #AC fault. User needs to check the warning and > > + * fix the split lock issue in the faulting instruction. > > "User needs to check the warning and fix the issue ..." > > I'm looking forward to all the fixes from Joe Users. > > Please remove that sentence. It's useless. Users report warnings if at all > and the kernel developers who actually look at them surely don't need an > advice like that. Sure. Will do this. Thanks. -Fenghua