Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7693630imm; Thu, 28 Jun 2018 07:56:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJUv3xiETBwJ+t1hRoe0teQFN4PXqXLZb3Anm/aqNutZVhuUl6nCtcXku0UgMCgBceAA5jg X-Received: by 2002:a65:55c6:: with SMTP id k6-v6mr9016930pgs.6.1530197782278; Thu, 28 Jun 2018 07:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530197782; cv=none; d=google.com; s=arc-20160816; b=Wp8JzGLlP5rd6+bcf7ju/KcTrTNXdRFZd2Pj0oMqim1B5zpiwfWJESDi2QEuOMmmCH IRvn8CEBNtoUf8U7E3rdaz9KlCHnplf3+F+whY6UrzOHM0lgB3ueCTgB7ketAg1uuO6U huuV5CI714uXUgi6yZYpsFtajHyn8V0Wh+ji1qbaia5Jjuq0u9Zyo61hfsWw0Fv8X4E5 uq5eOjpb2uTffSntkq9ahfSGMc+8PhhV68riZhx0oOOTkgHhv5G38/T10LiIDp+iWq4C LL1hyVyy2wSX38AM60pyFGv+jT9LN58ZjnShvWcDcGeqoDymOmqr0Z3dlAwbr/5xD2iB FMrg== 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=xhcGxrXQtCVTwsVYRtFOioW5Xj5v6gXeoSPi1TNeKbc=; b=NICInWreBud9fO29Ct9ZFOXoAi+JHVhyqdAaOyb0GqeSv3H35c3aU2iFa6/ddR+YtR M/FPRkp7mBYPc++f4OWbQYdASjC7zcjv/ZPl/C4pU81zKwWKU3/d2PN2rLoTM/yPW6KQ /W/bjEzUBpcNb+4KGHcBeVkwmjx8xhHUomMGQaDOOvyBRHTxEEvdrWhib73ddpmdor/y AJOwFtjdLtRl6jgvjIwOiSbItZ+a9Ksorofujyje1KIWKe3tlPvzSxg0sCCly1SatEle aZ9+e0RVrwoQyu3ZvwtN+TZHuHvyox5edjJbjgR4BWpmrNq+HBCq4j1FCgZE4VETyB8q ktXQ== 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 c18-v6si6191276pgf.301.2018.06.28.07.56.07; Thu, 28 Jun 2018 07:56: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 S966659AbeF1Oz3 (ORCPT + 99 others); Thu, 28 Jun 2018 10:55:29 -0400 Received: from mga06.intel.com ([134.134.136.31]:43841 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966209AbeF1Oz2 (ORCPT ); Thu, 28 Jun 2018 10:55:28 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2018 07:55:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,284,1526367600"; d="scan'208";a="241412898" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga006.fm.intel.com with ESMTP; 28 Jun 2018 07:55:19 -0700 Date: Thu, 28 Jun 2018 07:54:41 -0700 From: Fenghua Yu To: Fenghua Yu Cc: Thomas Gleixner , 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: <20180628145441.GL18979@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> <20180628142322.GK18979@romley-ivt3.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180628142322.GK18979@romley-ivt3.sc.intel.com> 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 07:23:22AM -0700, Fenghua Yu wrote: > 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); Should be '__aligned(sizeof(unsigned long))' for both 32-bit and 64-bit. Thanks. -Fenghua