Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967533AbdCXUV6 (ORCPT ); Fri, 24 Mar 2017 16:21:58 -0400 Received: from mail-vk0-f49.google.com ([209.85.213.49]:33975 "EHLO mail-vk0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967164AbdCXUVs (ORCPT ); Fri, 24 Mar 2017 16:21:48 -0400 MIME-Version: 1.0 In-Reply-To: <20170324201439.GY5680@worktop> References: <20170324142140.vpyzl755oj6rb5qv@hirez.programming.kicks-ass.net> <20170324164108.ibcxxqbhvx6ao54r@hirez.programming.kicks-ass.net> <20170324172342.radlrhk2z6mwmdgk@hirez.programming.kicks-ass.net> <20170324180838.crc2dmxswklqmyrx@hirez.programming.kicks-ass.net> <20170324181303.fnasnmtw2tmcy27u@hirez.programming.kicks-ass.net> <20170324201439.GY5680@worktop> From: Andy Lutomirski Date: Fri, 24 Mar 2017 13:21:25 -0700 Message-ID: Subject: Re: locking/atomic: Introduce atomic_try_cmpxchg() To: Peter Zijlstra Cc: Andy Lutomirski , Dmitry Vyukov , Andrew Morton , Borislav Petkov , Brian Gerst , Denys Vlasenko , "H. Peter Anvin" , Josh Poimboeuf , Linus Torvalds , Paul McKenney , Thomas Gleixner , Ingo Molnar , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 939 Lines: 22 On Fri, Mar 24, 2017 at 1:14 PM, Peter Zijlstra wrote: > On Fri, Mar 24, 2017 at 12:16:11PM -0700, Andy Lutomirski wrote: >> On Fri, Mar 24, 2017 at 11:13 AM, Peter Zijlstra wrote: > >> > Not to mention we cannot use the C11 atomics in kernel because we want >> > to be able to runtime patch LOCK prefixes when only 1 CPU is available. >> >> Is this really a show-stopper? I bet that objtool could be persuaded >> to emit a list of the locations of all those LOCK prefixes. > > Ah, but its not _all_ LOCK prefixes. Some are needed even on UP, because > against hardware instead of other CPUs. Or again hypervisor instead of > other vCPU. > Make a table of mandatory lock prefixes and assume all the others (due to C11 atomics, etc) can be omitted on UP? I'm curious, though, whether anyone actually compiles an x86 SMP kernel, runs it on UP, and cares about performance these days. --Andy