Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756472AbcJ1Ksn (ORCPT ); Fri, 28 Oct 2016 06:48:43 -0400 Received: from foss.arm.com ([217.140.101.70]:56604 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbcJ1Ksl (ORCPT ); Fri, 28 Oct 2016 06:48:41 -0400 Date: Fri, 28 Oct 2016 11:48:06 +0100 From: Mark Rutland To: Andy Lutomirski Cc: "linux-kernel@vger.kernel.org" , linux-arch , Andrew Morton , Heiko Carstens , "H. Peter Anvin" , Kees Cook , Andrew Lutomirski , Ingo Molnar , Thomas Gleixner Subject: Re: [PATCH 3/3] thread_info: include for THREAD_INFO_IN_TASK Message-ID: <20161028104806.GF5806@leverpostej> References: <1476901693-8492-1-git-send-email-mark.rutland@arm.com> <1476901693-8492-4-git-send-email-mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1423 Lines: 36 On Thu, Oct 27, 2016 at 04:13:49PM -0700, Andy Lutomirski wrote: > On Wed, Oct 19, 2016 at 11:28 AM, Mark Rutland wrote: > > When CONFIG_THREAD_INFO_IN_TASK is selected, the current_thread_info() > > macro relies on current having been defined prior to its use. However, > > not all users of current_thread_info() include , and thus > > current is not guaranteed to be defined. > > > > When CONFIG_THREAD_INFO_IN_TASK is not selected, it's possible that > > get_current() / current are based upon current_thread_info(), and > > includes . Thus always including > > would result in circular dependences on some platforms. > > > > To ensure both cases work, this patch includes , but only > > when CONFIG_THREAD_INFO_IN_TASK is selected. > > Reviewed-by: Andy Lutomirski Cheers! > although it would be nice if you moved your description of why the > include is conditional into a comment. Agreed. I've folded in the below: #ifdef CONFIG_THREAD_INFO_IN_TASK /* * For CONFIG_THREAD_INFO_IN_TASK kernels we need for the * definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels, * including can cause a circular dependency on some platforms. */ #include #define current_thread_info() ((struct thread_info *)current) #endif Thanks, Mark.