Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756070AbcDDRMl (ORCPT ); Mon, 4 Apr 2016 13:12:41 -0400 Received: from terminus.zytor.com ([198.137.202.10]:42128 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752410AbcDDRMj (ORCPT ); Mon, 4 Apr 2016 13:12:39 -0400 Subject: Re: [RFC PATCH v6 1/5] Thread-local ABI system call: cache CPU number of running thread To: Mathieu Desnoyers , Andrew Morton , Russell King , Thomas Gleixner , Ingo Molnar References: <1459789313-4917-1-git-send-email-mathieu.desnoyers@efficios.com> <1459789313-4917-2-git-send-email-mathieu.desnoyers@efficios.com> Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Paul Turner , Andrew Hunter , Peter Zijlstra , Andy Lutomirski , Andi Kleen , Dave Watson , Chris Lameter , Ben Maurer , Steven Rostedt , "Paul E. McKenney" , Josh Triplett , Linus Torvalds , Catalin Marinas , Will Deacon , Michael Kerrisk , Boqun Feng From: "H. Peter Anvin" Message-ID: <5702A037.60200@zytor.com> Date: Mon, 4 Apr 2016 10:11:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <1459789313-4917-2-git-send-email-mathieu.desnoyers@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1103 Lines: 27 On 04/04/16 10:01, Mathieu Desnoyers wrote: > > Changes since v5: > - Rename "getcpu_cache" to "thread_local_abi", allowing to extend > this system call to cover future features such as restartable critical > sections. Generalizing this system call ensures that we can add > features similar to the cpu_id field within the same cache-line > without having to track one pointer per feature within the task > struct. > - Add a tlabi_nr parameter to the system call, thus allowing to extend > the ABI beyond the initial 64-byte structure by registering structures > with tlabi_nr greater than 0. The initial ABI structure is associated > with tlabi_nr 0. > - Rebased on kernel v4.5. > This seems absolutely insanely complex, both for the kernel and for userspace. A much saner way would be for userspace to query the kernel for the size of the structure; userspace then allocates the maximum of what it knows and what the kernel knows. That way, the kernel doesn't need to conditionalize its accesses to user space, and libc doesn't need to conditionalize its accesses either. -hpa