Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp8902ybg; Tue, 9 Jun 2020 14:48:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUZ9U3/GXs2ZxmYDqm3I04ofazPX0lFPYNjZaXs8ZyiciM3qwRsNgb06z8hjBceYcAKcb4 X-Received: by 2002:a17:906:acc:: with SMTP id z12mr377236ejf.301.1591739288590; Tue, 09 Jun 2020 14:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591739288; cv=none; d=google.com; s=arc-20160816; b=LXDuH0y12oxuM/4dyOdy3zFzUNW/S1zAHJxxgKADPFhaY3gJnDn3tnNlB8GUZf536D c8lkAsjfXVKK2vkXsbBgbr98Cq/ny0PzbgatGkkoc3JqIg1co3WCB/IbSVfiHwwX97bQ vbM7i4Y5RdnFJ61hxrGO7SqOPJmJrq+C4XijBrOmTGH00v0p5OSEaoBzmw5uR5Hb2eRu slhtBr9iQBUGAWAQHWv3C4bl93+1z5y4SK3stfqgBT5KbFiBtSpIqhNoN59/Jqlfd3ug 8epfCPB0xntF2vwC4Fkgx0eYfeprNac8Q9YU7lxvsb6RczH8KrdkWAS6TZvGkaxM6PZL p99Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bwD3saL2YXFkhFhfFrmThCkI2mmg8KxWR69J/MWso5Y=; b=YEpDKx9ppjQHRJyEaJ4r9G0I69fK3JD+g25MsOJ/hYgOwvWmlaZCCJru8pQmAfqgBc WQJhdt6utZYvHMpgu9zcqVGHJz5NI4WqZxQpUfgLl2HexEkYNIdTQBksSxILUtqsLOQL uW+ZAMUsh6OcBEiUUyAYN5oThKvtFoVBKmcDfmc+7g+kDzkMld+wKMjwxzPb0w6PwrGY Ib0n5PIFqsZ2prRqIuFKqd3EJAX7smskxRmsOmfQjdirX/tqbEdTQIo8+sZ//dN4h/BV wq7FoJt+09u0CPGBWT7cScCKtzDxUv/2GMoMnvSmvaSK2Kc1EZGgV4+BUy2ZDc+xHefq Ihtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dtrhGd0U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j7si11446835ejb.289.2020.06.09.14.47.41; Tue, 09 Jun 2020 14:48:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dtrhGd0U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728254AbgFIVpP (ORCPT + 99 others); Tue, 9 Jun 2020 17:45:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:51120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728061AbgFIVpO (ORCPT ); Tue, 9 Jun 2020 17:45:14 -0400 Received: from sol.localdomain (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4D33820734; Tue, 9 Jun 2020 21:38:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591738711; bh=ZY4Cx5/3wFFlzCvlf1GcovX/L6l91uTsdeclxs8GR5U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dtrhGd0UWqgzVpTJrefK5wMOmp/2rIXyO7xI7RLrrO65jeGQt9kjPllDHHB/C6pWC NPvviiFafe8YZCmN49IMEtVPDWivkGI9BW372NAOwIYAjsOOjs5KO1G2paPDx+33h2 OPZGFtiyTM6anBAKfoqA8swyWS1pYZ/eZcYOEaTU= Date: Tue, 9 Jun 2020 14:38:29 -0700 From: Eric Biggers To: Guenter Roeck Cc: Peter Zijlstra , tglx@linutronix.de, frederic@kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, cai@lca.pw, mgorman@techsingularity.net Subject: Re: [RFC][PATCH 7/7] sched: Replace rq::wake_list Message-ID: <20200609213829.GA789@sol.localdomain> References: <20200526161057.531933155@infradead.org> <20200526161908.129371594@infradead.org> <20200604141837.GA179816@roeck-us.net> <20200605002433.GA148196@sol.localdomain> <20200605074154.GB2750@hirez.programming.kicks-ass.net> <20200605161532.GD1373@sol.localdomain> <53318971-561c-b445-0408-530b3d3ba44e@roeck-us.net> <20200609202134.GA1105@sol.localdomain> <20200609212509.GA239889@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200609212509.GA239889@roeck-us.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 09, 2020 at 02:25:09PM -0700, Guenter Roeck wrote: > > > > Still occurring on Linus' tree. This needs to be fixed. (And not by removing > > support for randstruct; that's not a "fix"...) > > > > How about the hack below ? > > Guenter > > --- > diff --git a/include/linux/sched.h b/include/linux/sched.h > index c5d96e3e7fff..df1cbb04f9b3 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -629,6 +629,15 @@ struct wake_q_node { > struct wake_q_node *next; > }; > > +/* > + * Hack around assumption that wake_entry_type follows wake_entry even with > + * CONFIG_GCC_PLUGIN_RANDSTRUCT=y. > + */ > +struct _wake_entry { > + struct llist_node wake_entry; > + unsigned int wake_entry_type; > +}; > + > struct task_struct { > #ifdef CONFIG_THREAD_INFO_IN_TASK > /* > @@ -653,8 +662,9 @@ struct task_struct { > unsigned int ptrace; > > #ifdef CONFIG_SMP > - struct llist_node wake_entry; > - unsigned int wake_entry_type; > + struct _wake_entry _we; > +#define wake_entry _we.wake_entry > +#define wake_entry_type _we.wake_entry_type > int on_cpu; > #ifdef CONFIG_THREAD_INFO_IN_TASK > /* Current CPU: */ Does the struct actually have to be named? How about: diff --git a/include/linux/sched.h b/include/linux/sched.h index c5d96e3e7fff42..14ca25cda19150 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -653,8 +653,14 @@ struct task_struct { unsigned int ptrace; #ifdef CONFIG_SMP - struct llist_node wake_entry; - unsigned int wake_entry_type; + /* + * wake_entry_type must follow wake_entry, even when + * CONFIG_GCC_PLUGIN_RANDSTRUCT=y. + */ + struct { + struct llist_node wake_entry; + unsigned int wake_entry_type; + }; int on_cpu; #ifdef CONFIG_THREAD_INFO_IN_TASK /* Current CPU: */ However, it would be preferable to not rely on different structs sharing the same field order, but rather write proper C code that uses the same struct everywhere to encapsulate these 2 fields... - Eric