Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp695707pxb; Tue, 14 Sep 2021 06:51:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx66V+oHHvILWsEqdc2U3uDR4BqFK4y7hG3iEDKD1KEbK7SVtb7uE723s9EdUQeAK7ySv/F X-Received: by 2002:a2e:7f15:: with SMTP id a21mr5483413ljd.27.1631627483538; Tue, 14 Sep 2021 06:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631627483; cv=none; d=google.com; s=arc-20160816; b=Xl8gzl9jPFqOVeutZBDwFRlVmXDGYXK8dNnS/11xc39VUuCmHy1vQcywQVo+Luv6VM jjCpvA0qouCwgc147ykUjCwyUPXGGpVHq4N56aUUQtO5qxoi8QnGYIyXx+HwtlwvURMJ yQAg7LACiWMz5d8UI+4R4QuCrtMRv60Wcox6cMnBRWBqL/tiIPTdXVp9QGFBq5m1INAg r1fF5B+xg9/fKW9w+q3R12yoBR7r/+lAPm5zdVNJXApUrQh4Lgq7ESA8AtLJLsVx3CIT E64qsieMO3GUUmbckv8yk5BUMPa4p0tqjisVxq7ABeaCvzQF6gGseW1hmrR62gn/tmLa MX/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=/aJJEaXRb057+r+3y5jqLFQP2/kjRCxDTFE4xuRtqEI=; b=0H1PLWJzeJoxFsQXdAs0JIQvmnZ0AAf1gVz+mWJLKSSNOPUy3vSad2FB86BXVcf/r4 wNH6jZetwgB6omIHPLhvZz3yVa7zewgvi6O6qkotoU4Tr4sdFtWSWQaf6oTfWYAlAnlZ ApqGCCPT1dzRV5ItAakihJsAWwPSGWj+fLQg5c7LbHKH7EOZqNz8L6ajCkJY4Vd0MITc UCU8s0GWNo5/VBoxXrUbA2qhoATmvD+1T2dh4nKd+YgPzNH0rj70AQEj9Omrd6nYdHfv TkQ9S5gKOEyL9gma9NajJFC72e0fa0uI1EnFFb+qbTJ3l3Yofyny+RZNp/aF3EXdNf0i xT6A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si14843985lfq.529.2021.09.14.06.50.53; Tue, 14 Sep 2021 06:51:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233289AbhINNua (ORCPT + 99 others); Tue, 14 Sep 2021 09:50:30 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:40735 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231550AbhINNua (ORCPT ); Tue, 14 Sep 2021 09:50:30 -0400 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4H84T272hyz9sTY; Tue, 14 Sep 2021 15:49:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bcHh4GeAshDT; Tue, 14 Sep 2021 15:49:10 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4H84T25w7Qz9sTW; Tue, 14 Sep 2021 15:49:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B5EA08B773; Tue, 14 Sep 2021 15:49:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 1mJ0k4nwiphF; Tue, 14 Sep 2021 15:49:10 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.204.177]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BD0648B763; Tue, 14 Sep 2021 15:49:08 +0200 (CEST) Subject: Re: [RFC PATCH 0/8] Move task_struct::cpu back into thread_info To: Ard Biesheuvel , linux-kernel@vger.kernel.org Cc: Keith Packard , Russell King , Catalin Marinas , Will Deacon , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Kees Cook , Andy Lutomirski , Linus Torvalds , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org References: <20210914121036.3975026-1-ardb@kernel.org> From: Christophe Leroy Message-ID: Date: Tue, 14 Sep 2021 15:49:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210914121036.3975026-1-ardb@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr-FR Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 14/09/2021 à 14:10, Ard Biesheuvel a écrit : > Commit c65eacbe290b ("sched/core: Allow putting thread_info into > task_struct") mentions that, along with moving thread_info into > task_struct, the cpu field is moved out of the former into the latter, > but does not explain why. I think it does explain why (init/Kconfig): "an arch will need to remove all thread_info fields except flags". IIUC initially the intention with THREAD_INFO_IN_TASK was to remove everything from thread_info, but at the end it didn't happen it seems. > > While collaborating with Keith on adding THREAD_INFO_IN_TASK support to > ARM, we noticed that keeping CPU in task_struct is problematic for > architectures that define raw_smp_processor_id() in terms of this field, > as it requires linux/sched.h to be included, which causes a lot of pain > in terms of circular dependencies (or 'header soup', as the original > commit refers to it). > > For examples of how existing architectures work around this, please > refer to patches #6 or #7. In the former case, it uses an awful > asm-offsets hack to index thread_info/current without using its type > definition. The latter approach simply keeps a copy of the task_struct > CPU field in thread_info, and keeps it in sync at context switch time. It was a pain when implementing that on powerpc, so I really like your idea, the series looks good to me. > > Patch #8 reverts this latter approach for ARM, but this code is still > under review so it does not currently apply to mainline. > > We also discussed introducing yet another Kconfig symbol to indicate > that the arch has THREAD_INFO_IN_TASK enabled but still prefers to keep > its CPU field in thread_info, but simply keeping it in thread_info in > all cases seems to be the cleanest approach here. Yes, if we can avoid yet another config, that's better. We already have so many configs that are supposed to be temporary and have lasted for years if not decades. Christophe