From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DA9FC433EF for ; Fri, 10 Sep 2021 20:21:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3E342611C3 for ; Fri, 10 Sep 2021 20:21:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3E342611C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 82C6B900002; Fri, 10 Sep 2021 16:20:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 802256B0072; Fri, 10 Sep 2021 16:20:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C98E900002; Fri, 10 Sep 2021 16:20:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 5B68B6B0071 for ; Fri, 10 Sep 2021 16:20:59 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 0564E2B359 for ; Fri, 10 Sep 2021 20:20:59 +0000 (UTC) X-FDA: 78572782638.38.4CCF585 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) by imf14.hostedemail.com (Postfix) with ESMTP id BE54C6001983 for ; Fri, 10 Sep 2021 20:20:58 +0000 (UTC) Received: by mail-oi1-f173.google.com with SMTP id w144so4560743oie.13 for ; Fri, 10 Sep 2021 13:20:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=4IPxaQoHLBsI4TsWZBSz429Jh2IPs4Tsu9wpBitBgng=; b=u7tsBpXZa9XKlDmcvCEjyZlujsPbZ2gsHh5Gij34udOgYYnlUazyo/F2djXmIADQBZ fVY7CVRhAqmsCbtJyLRm6KSY6hWKv0imrhg7hxGsULvrhVPNgRQ3EOQvOjlZjkF6j3S8 4QczJw6jQnY/mBPlAFdU7616In0uyGKsTaIHdHO+ssq5ERPtcvZ4mij3xRFZZZ1fE0tx uouyDnr4LizCZAoUDT9pRFomkj5v+QoSG/+RApUTzx3gpUF+HDrdnH4dwxwnd3fZVrgK QRACSPR7pjltclOCWgMWiVtxp1YUyH/ueHY0NGFf8dkDD79sC5IOs8InYLlzGpNaUBkn VAkA== X-Gm-Message-State: AOAM5337dUzX32xs/1+Js3RjhTmQczYwXjc2hteY5XmiJFR+PXMuqxrX 3eKoIUW1duYs3Mr9SRyXNg== X-Google-Smtp-Source: ABdhPJz5SQZueBteIwX5jHufIZZ/JozLZUCT7O2iJGriI7vlauYxJk6NPj/twUv+QLH5Q4gVPTAZyQ== X-Received: by 2002:a05:6808:aa8:: with SMTP id r8mr5746125oij.171.1631305258063; Fri, 10 Sep 2021 13:20:58 -0700 (PDT) Received: from robh.at.kernel.org (66-90-148-213.dyn.grandenetworks.net. [66.90.148.213]) by smtp.gmail.com with ESMTPSA id s24sm1483439otp.37.2021.09.10.13.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 13:20:57 -0700 (PDT) Received: (nullmailer pid 3226408 invoked by uid 1000); Fri, 10 Sep 2021 20:20:55 -0000 Date: Fri, 10 Sep 2021 15:20:55 -0500 From: Rob Herring To: Keith Packard Cc: linux-kernel@vger.kernel.org, Abbott Liu , Alexei Starovoitov , Andrew Morton , Andrii Nakryiko , Anshuman Khandual , Ard Biesheuvel , Arnd Bergmann , Ben Segall , Bjorn Andersson , bpf@vger.kernel.org, Christoph Lameter , Daniel Borkmann , Daniel Bristot de Oliveira , Dennis Zhou , devicetree@vger.kernel.org, Dietmar Eggemann , Florian Fainelli , Frank Rowand , Geert Uytterhoeven , Ingo Molnar , Jason Wang , Jens Axboe , Joe Perches , John Fastabend , Juri Lelli , KP Singh , kvm@vger.kernel.org, Linus Walleij , linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, Manivannan Sadhasivam , Marc Zyngier , Martin KaFai Lau , Mel Gorman , Michael Ellerman , "Michael S. Tsirkin" , Miguel Ojeda , Mike Rapoport , netdev@vger.kernel.org, Nick Desaulniers , Nick Desaulniers , Nicolas Pitre , Peter Zijlstra , Russell King , Song Liu , Srikar Dronamraju , Steven Rostedt , Tejun Heo , Thomas Gleixner , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Valentin Schneider , Vincent Guittot , virtualization@lists.linux-foundation.org, "Wolfram Sang (Renesas)" , YiFei Zhu , Yonghong Song Subject: Re: [PATCH v4 4/7] Make sure task_struct is available for raw_smp_processor_id Message-ID: References: <20210908190605.419064-1-keithpac@amazon.com> <20210908190605.419064-5-keithpac@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210908190605.419064-5-keithpac@amazon.com> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: BE54C6001983 X-Stat-Signature: aqsgqp789w1jb79pqrisrqsh5griedro Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of robherring2@gmail.com designates 209.85.167.173 as permitted sender) smtp.mailfrom=robherring2@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) X-HE-Tag: 1631305258-805686 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Sep 08, 2021 at 12:06:02PM -0700, Keith Packard wrote: > To allow architectures to use the 'cpu' field in task_struct for cpu > identification, the task_struct must be visible whereever the > raw_smp_processor_id macro is used. It would be simplest to include > linux/sched.h from the relevant asm/smp.h file, but that file is > included from linux/sched.h, and the recursive include ends up with > several declarations in the wrong order. > > To avoid this, the PowerPC architecture code has this ugly hack: > > #define raw_smp_processor_id() \ > (*(unsigned int *)((void *)current + _TASK_CPU)) > > As an alternative, placing includes of linux/sched.h in a few files > that are used along with asm/smp.h means we can use the task_struct > field directly. > > Signed-off-by: Keith Packard > --- > arch/arm/mm/proc-v7-bugs.c | 1 + > drivers/vhost/vhost.c | 1 + > drivers/vhost/vhost.h | 1 + > include/asm-generic/irq_regs.h | 1 + > include/linux/of_address.h | 1 + Where does the DT code use raw_smp_processor_id()? The header itself certainly doesn't and the headers should only include what the headers use directly. In general this seems pretty terrible pulling in all of sched.h (and then everything else it includes) for just raw_smp_processor_id(). > include/linux/random.h | 1 + > include/linux/topology.h | 1 + > init/calibrate.c | 1 + > kernel/bpf/bpf_lru_list.h | 1 + > kernel/bpf/percpu_freelist.h | 1 + > kernel/sched/cpuacct.c | 2 +- > lib/irq_regs.c | 1 + > 12 files changed, 12 insertions(+), 1 deletion(-)