Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4657089rdb; Fri, 15 Sep 2023 08:32:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnatH7wXPy0O+zgxMNeDP3cfdb5q6ZsXzaOQoU0Fw672svKUMMtm8BWj7yHxRXqQU/GWi+ X-Received: by 2002:a05:6a00:1a8d:b0:68c:705d:78ad with SMTP id e13-20020a056a001a8d00b0068c705d78admr1644948pfv.27.1694791942741; Fri, 15 Sep 2023 08:32:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694791942; cv=none; d=google.com; s=arc-20160816; b=0tssuZIO3AXmydo5ymJ3ZpOKtQYZ1k60noMQTiQItUlCInBsIEAHlY8HXY2ANtK0ae mnHyZvEmCTQIsmfmObWaAKcs5eLYsGGw5BIVxHMAXKAu/fbIaCzGqFtCg18VY413n/xA vzUi55K0bXq1VdJcX1/Q88U12K5qPdtTmzc7xHsZIjSldYCdZh9o3nJgyBu2W/+sUsWS 1X5i3JW9IrPkQ0HLlQG9xKi2ooja9eh8VNhHYgHGv97Fqe270Zbm6zIw0+0IFhFzZhwe eJ/zpZBEq2RRCsfvhf5uoHaoTSm3mt5hVkBZr+YPo3pEHYtbS4MeiyfKLWeVkkfeuCVF CShA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RyCsf2SR8nKFgYZlBBK2aLry7k9/yYDZdF0Q1M7p1AM=; fh=dp5q1D7VOH8ufaxrih++j1KU/sYeZzP9EMtTuBofM8w=; b=nXlYxfb8bzADXYm4Nklr6L0trpU0VUT5VI/xS998rBN1PgpnTnFhSz3knBkA0TofAD gcQW0r7M7uKydNAkDHmyqSBVirU8wIGfFUQA/psEKRm5EnJR3xNochpBUtxZ2qQFsanM xXWrwK2kRc7GtEiQMRjNzLmIyDYrdIVBIP1jogdrmXIST23RjBgbd4sWSDotshPWawCx zYFMYDBVcjl3S7bFl8ZeNXX2G0dOkzH7lKK1xW6b4AQdQMo27BZFKh9VWtKaQulJwDBG mVOFVGGBAbLDTAcfSiQ7HHOyO0oT54sY0W2CgChAh1xARDUjUuhVCfFPvh0+vlCGgptb X2Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wce7jhmQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id by7-20020a056a00400700b006903fc94799si1997030pfb.319.2023.09.15.08.32.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 08:32:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wce7jhmQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 881878219C27; Fri, 15 Sep 2023 02:54:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234183AbjIOJyz (ORCPT + 99 others); Fri, 15 Sep 2023 05:54:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234172AbjIOJyd (ORCPT ); Fri, 15 Sep 2023 05:54:33 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A955B2D43; Fri, 15 Sep 2023 02:53:16 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3F8FC433C9; Fri, 15 Sep 2023 09:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1694771596; bh=tRSYOs1YIvUKupCh/zQxAhrE6h+c8c1LmgwSRnPmf2Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wce7jhmQefHvj4g2gcdB7vKdStzRg+v2LwFNwb4XqndNtPwoXtE90+SfTNIVjGsYv emjnT1EQPpXXvLaa9x3OoaHBlBz+ChsMZm2S5H7wQJWLDVkBmpk5MFJLUBkbuo/naW s7iXS+iEzDYwitQbSjAv58wsvN+Qkz56QpickoaY= Date: Fri, 15 Sep 2023 11:53:13 +0200 From: Greg KH To: Enlin Mu Cc: John Ogness , Enlin Mu , pmladek@suse.com, rostedt@goodmis.org, senozhatsky@chromium.org, keescook@chromium.org, tony.luck@intel.com, gpiccoli@igalia.com, enlin.mu@unisoc.com, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] printk: add cpu id information to printk() output Message-ID: <2023091547-mug-unlikable-571f@gregkh> References: <8734zfx2bo.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 02:54:59 -0700 (PDT) On Fri, Sep 15, 2023 at 04:46:02PM +0800, Enlin Mu wrote: > John Ogness 于2023年9月15日周五 16:34写道: > > > > On 2023-09-15, Enlin Mu wrote: > > > Sometimes we want to print cpu id of printk() messages to consoles > > > > > > diff --git a/include/linux/threads.h b/include/linux/threads.h > > > index c34173e6c5f1..6700bd9a174f 100644 > > > --- a/include/linux/threads.h > > > +++ b/include/linux/threads.h > > > @@ -34,6 +34,9 @@ > > > #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \ > > > (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT)) > > > > > > +#define CPU_ID_SHIFT 23 > > > +#define CPU_ID_MASK 0xff800000 > > > > This only supports 256 CPUs. I think it doesn't make sense to try to > > squish CPU and Task IDs into 32 bits. > Yes, it is not good way, > > > > What about introducing a caller_id option to always only print the CPU > > ID? Or do you really need Task _and_ CPU? > Yes, I need it.Because I need to know which CPU is printing the > log, so that I can identify the current system operation, such as load > situation and CPU busy/idle status The cpu that is printing the log isn't the one that added the log message, so I think you will have incorrect data here, right? thanks, greg k-h