Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7662085imm; Thu, 28 Jun 2018 07:25:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLwZI9Pwmii0H+LklLN6mbTnpBZ4ytG1b7SFsn8JQ73oxLRq4dMyxL2vzp6WVMOSWLBDRmw X-Received: by 2002:a17:902:3f81:: with SMTP id a1-v6mr10691313pld.29.1530195923322; Thu, 28 Jun 2018 07:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530195923; cv=none; d=google.com; s=arc-20160816; b=SDZ3e87nSW7foPDhBuW+iLuN0QBpr+bPoondwX7ZQjtdVl0XTM1bmfECPauKEz68fF JZRHUliujFa5ySacbnkCsfLkEYFOWHtiC4Vaj/NKkD4qjrVKeVja6TPz2TO8/3k5HA1o 0nQ+kJrmQMdvvjnPJvQ3wCX6bnHIE+JADo8I12uxP5GfugKuDi3EbWGSpLRd5B9iB8a9 94+tqt23b2t5l7FfDijZ8bIpa/JC5i1weIy6zPUxVtBjTLNuL/4BUNGBcDUhcVAfY6V0 1WvYIRGKVL5J8IG1LRNh/GFKY6z6hE+BpmJ6Gh6ajLTX2+8zb/DNz91k95R3M7848Ow6 z8BA== 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=xwY4L3+z24Nz1tOrzjUOePVRcFS0hII7vNZ0cfc9LCg=; b=jbraThC8StR01gVLqj0C1oVnUxFZSkISkZryzJv/1MWDZKOUIjzBEY2ePMqaabozhS hsjvy/tH9/FfJb1LDZCa4j0Vy+4mik4GE+fPYOpPZWo79MPmEtbtDvAM1kQ+kZZIhx6J Sn4pZ8N6SLDQF3NnfIGNgL8jvWx9STAliOtYVB6rZLKWAVvAwCWFeu8QiL+GJI90tBFe 6Gf6Qudxt7twa4QV7sJiIBTu3TBzOW7i6tRTN41BseJ8aRL1GsMCo/ECMbZG57ig2msX +siqVWolXIkGSEd+jd0zhoe6IcxwKmeafl/Ht+BcPsc98h0dpxkEXVdeB01FpiBtIOfW ijUQ== 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 s84-v6si3613994pfd.288.2018.06.28.07.25.06; Thu, 28 Jun 2018 07:25:23 -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 S966550AbeF1OYV (ORCPT + 99 others); Thu, 28 Jun 2018 10:24:21 -0400 Received: from mga14.intel.com ([192.55.52.115]:60155 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966209AbeF1OYU (ORCPT ); Thu, 28 Jun 2018 10:24:20 -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; 28 Jun 2018 07:24:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,283,1526367600"; d="scan'208";a="52604005" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by orsmga007.jf.intel.com with ESMTP; 28 Jun 2018 07:24:00 -0700 Date: Thu, 28 Jun 2018 07:23:22 -0700 From: Fenghua Yu To: Thomas Gleixner Cc: Fenghua Yu , Peter Zijlstra , 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 04/16] x86/split_lock: Use non locked bit set instruction in set_cpu_cap Message-ID: <20180628142322.GK18979@romley-ivt3.sc.intel.com> References: <1527435965-202085-1-git-send-email-fenghua.yu@intel.com> <1527435965-202085-5-git-send-email-fenghua.yu@intel.com> <20180621195540.GC13636@worktop.programming.kicks-ass.net> <20180627233504.GJ18979@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 Thu, Jun 28, 2018 at 09:53:17AM +0200, Thomas Gleixner wrote: > On Wed, 27 Jun 2018, Fenghua Yu wrote: > > On Thu, Jun 21, 2018 at 09:55:40PM +0200, Peter Zijlstra wrote: > > > On Sun, May 27, 2018 at 08:45:53AM -0700, Fenghua Yu wrote: > > > > set_bit() called by set_cpu_cap() is a locked bit set instruction for > > > > atomic operation. > > > > > > > > Since the c->x86_capability can span two cache lines depending on kernel > > > > configuration and building evnironment, the locked bit set instruction may > > > > cause #AC exception when #AC exception for split lock is enabled. > > > > > > That doesn't make sense. Sure the bitmap may be longer, but depending on > > > if the argument is an immediate or not we either use a byte instruction > > > (which can never cross a cacheline boundary) or a 'word' aligned BTS. > > > And the bitmap really _should_ be 'unsigned long' aligned. > > > > > > If it is not aligned, fix that too. > > > > > > /me looks at cpuinfo_x86 and finds x86_capability is in fact a __u32 > > > array.. see that's broken and needs fixing first. > > > > Do you mean x86_capability's type should be changed from __u32 to unsigned > > long? > > > > Changing x86_capability's type won't directly fix the split lock in > > set_cpu_cap(), right? BTS still may access x86_capability across cache > > line no matter x86_capability's type. > > Errm. No. BTS & al are accessing a single 64bit location which is > > base_address + (bit_offset % 64) * 8 > > So if the base address is properly aligned then BTS & al will _NEVER_ have > to lock more than a single cache line. And it does not matter wheter we fix > the type or enforce 64bit alignement of the array by other means. > > If that's not true then BTS & al are terminally broken and you can stop > working on #AC right away. Is the following patch right fix for the x86_capability split lock issue (i.e. this patch replace patch 4 and 5)? - __u32 x86_capability[NCAPINTS + NBUGINTS]; + __u32 x86_capability[NCAPINTS + NBUGINTS] + __aligned(8); Thanks. -Fenghua