Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7298422imm; Thu, 28 Jun 2018 01:05:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLWIRKd0N7HOj2hZr3ApL2phvQzaI+bLsty7Exx6TXY42Xh+XRvxd/tHg1RS0DeGCDboDGZ X-Received: by 2002:a17:902:bd05:: with SMTP id p5-v6mr9609023pls.32.1530173135034; Thu, 28 Jun 2018 01:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530173135; cv=none; d=google.com; s=arc-20160816; b=qYlhStGNUuIjwuSfi/hUlNqZnRYgpBIKZ9orcQbUi3WAXIdXtXHdhc2Q00WWhNoGcB ylOqhgqoGJeL5kPY3JDPaWPdOaGA72lHFcRyTG+5V84ys7qIQJa4qQiywgpdTpsgB6FV klYiwQeleMl1QIxveUHVghMj5E8sTklfgO8w9uZa2tEj93B9XLNjpFGAt3Yz4bO+7jni E3oyBpV+s32cU7bGNr3B2lkcV9oWr94cQe6GiclF1hXv95LfSI1LlJlgI9ZPk2kT9g9/ Q8+k2S1zw5GDRz0BjT+TPH4g66Ch/0dke/6p79Z8Up0cld+Y2ciaw82oxLNtUyhkT7J2 ROjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=XqMikU8pd27us0GTCiNTBhZE82XKydLhoTothd/n8GU=; b=ElyQ8z4FaSSCeR06d6qYqm185sWG1erQ5zFKEoKD1IExz9w3TmW2CK84xlOO3NKuEd N+ctznpWXTPLwd1bWAjP906ZDYuQ1kjeB6/T6RWHYZA2Gk0l8+1cj3Xb8XTVXXtoWBgW jC+V51V7rO5UkhRK9PlyQKTDlAV9ArV9VtSOghot/sw1ZWHp1w8nau+wv2PGlZZWC1Cy 069El2I7SXbOM59bg6w0rgf1WjJll9DMKeQx9etDZfQsbkz+dYzN6ToiL7uUAhtFItCi Li6I+69dLOFBDivv1k5V65iY1lLlIMXAD8+W7UqQNWVbMScnOLNbcmSu08lQc2TqR+HD 8bcw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1-v6si4418528pge.531.2018.06.28.01.05.17; Thu, 28 Jun 2018 01:05:34 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934285AbeF1Hxc (ORCPT + 99 others); Thu, 28 Jun 2018 03:53:32 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:55414 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934041AbeF1Hxb (ORCPT ); Thu, 28 Jun 2018 03:53:31 -0400 Received: from hsi-kbw-5-158-153-55.hsi19.kabel-badenwuerttemberg.de ([5.158.153.55] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fYRk2-0002pc-UL; Thu, 28 Jun 2018 09:53:23 +0200 Date: Thu, 28 Jun 2018 09:53:17 +0200 (CEST) From: Thomas Gleixner To: Fenghua Yu cc: 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 In-Reply-To: <20180627233504.GJ18979@romley-ivt3.sc.intel.com> Message-ID: 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> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, tglx