Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2038800imm; Sat, 23 Jun 2018 08:07:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJHdR58OE0jGPzEtH5UGONmQhLa4Zhiy6BZARFTuollyGaQNGwJiu3zWcM0bmwtyHlby+VC X-Received: by 2002:a17:902:8341:: with SMTP id z1-v6mr5961480pln.40.1529766446003; Sat, 23 Jun 2018 08:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529766445; cv=none; d=google.com; s=arc-20160816; b=Ad97PGTjhaOlxNe0WZVXaf6NFC8EViVhpzj0TUARSiBSWtzEG/3spt/8f/5JtKjPgN uM/Tvyu5BgY42s4kOf+8Fq3dheRfDtkuwtw8VJMweRZKt0w+CxiNUPLqw9Sh08L5z53w Nt4mcY10nLmptoB3fXr3a37RG6niENzBt8Pai1cagHLxAnsrJUA6cVhhLPVu2QnWRNH5 V8TryX+88T6xpi874L3gH9lyUBwhPvh9kzyB0uctMQklmceNNXOQGqTb8Nj58X+gb/P3 ybFVnyrgk/3O2rWIQoa13TsmWye86HBrMCGnugsbEUPm7vHZ2lgzqW8Bhzp1icQzbEyI LepA== 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:arc-authentication-results; bh=YvJpTvbxJTAv+8PPou9rJEd8Qct5/9YLYQYQVkwny2E=; b=F3PjC0D2GN2zv/hJs4cRbt+/PRa3L2fqaRKY5Lv9/QfHks6Wyp00NF1UGcYj2/KJFo VoG1tGPHVOkty8EYRoZyf+fk4saahkcctXGFxpznoptha1YNzDRiHdopTa8pNMNimdsm IUZgPzg26d+W/J1fnAkJcN/nY4g2Qq/SAUClvcaV9TL+C5W4llLyFpa8ZJ+Pl5/Dq8Un +GSEKJrAvgyBDnaiFKV6n6xrYuHXA+ZeuzOWpOBaOgqH/i916I2tjNjTiVYDP2NdEvNO IIY2/sfoIPBj/QNUlVh6Yb9XqwMepuq66yeiZZwCh0bgnIvpdMTomwsvoiR3SKjp6xW4 LauQ== 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 p18-v6si8032220pgu.671.2018.06.23.08.06.58; Sat, 23 Jun 2018 08:07:25 -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 S1751606AbeFWPFz (ORCPT + 99 others); Sat, 23 Jun 2018 11:05:55 -0400 Received: from mga02.intel.com ([134.134.136.20]:3700 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbeFWPFx (ORCPT ); Sat, 23 Jun 2018 11:05:53 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jun 2018 08:05:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,262,1526367600"; d="scan'208";a="59605619" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by FMSMGA003.fm.intel.com with ESMTP; 23 Jun 2018 08:05:52 -0700 Date: Sat, 23 Jun 2018 08:05:21 -0700 From: Fenghua Yu To: Thomas Gleixner Cc: Fenghua Yu , Ingo Molnar , "H. Peter Anvin" , Ashok Raj , Dave Hansen , Rafael Wysocki , Tony Luck , Alan Cox , Ravi V Shankar , Arjan van de Ven , linux-kernel , x86 Subject: Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode Message-ID: <20180623150521.GG18979@romley-ivt3.sc.intel.com> References: <1527435965-202085-1-git-send-email-fenghua.yu@intel.com> <1527435965-202085-3-git-send-email-fenghua.yu@intel.com> <20180623042033.GF18979@romley-ivt3.sc.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 Sat, Jun 23, 2018 at 11:17:03AM +0200, Thomas Gleixner wrote: > On Fri, 22 Jun 2018, Fenghua Yu wrote: > > On Fri, Jun 22, 2018 at 12:49:00PM +0200, Thomas Gleixner wrote: > > > On Sun, 27 May 2018, Fenghua Yu wrote: > > > > +static void wait_for_reexecution(void) > > > > +{ > > > > + while (time_before(jiffies, disable_split_lock_jiffies + > > > > + reenable_split_lock_delay)) > > > > + cpu_relax(); > > > > +} > > > > + > > > > +/* > > > > + * TEST_CTL MSR is shared among threads on the same core. To simplify > > > > + * situation, disable_split_lock_jiffies is global instead of per core. > > > > > > This patch surely earns extra points in the trainwreck engineering contest, > > > but that's not taking place on LKML. > > > > > > The whole thing is simply: > > > > > > handle_ac() > > > { > > > if (user_mode(regs)) { > > > do_trap(AC, SIGBUS, ...); > > > } else { > > > disable_ac_on_local_cpu(); > > > WARN_ONCE(1); > > > } > > > } > > > > Should I add kernel parameter or control knob to opt-out the feature? > > A simple command line option 'acoff' or something more sensible should be > ok. No sysfs knobs or whatever please. The Kconfig option is not required > either. Ok. I will have a command line option. BTW, I have a Kconfig option to enable split lock test in kernel mode in patch #15. Are the Kconfig option and the kernel test code still needed in next version? > > > I'm afraid firmware may hang system after handling split lock if the > > feature is enabled by kernel, e.g. "reboot" hits split lock in firmware > > and firmware hangs the system after handling #AC. > > Have you observed the problem in reality? I mean why would 'reboot' be the > critical path? I'd rather expect that EFI callbacks or SMM 'value add' > would trip over it. > > Vs. reboot. If that is the only problem then we might just have to clear > #AC enable before issuing it, but that does not need to be part of the > initial patch set. Its an orthogonal issue. Yes, I do see a real firmware hang after hitting and handling a split lock in firmware during "reboot" in one simulation test environment. Apprantly the split lock (and alignment access) is treated as a failure in firmware. This real case triggered my concern that split lock in any future firmware may happen in any path including run time service, S3/S4/S5, hotplug. If we don't have opt-out option or something similar, system hang from split lock in firmware can be a blocking issue on some platforms. If that happens, bisect always finds the split lock patch to blame. Thanks. -Fenghua