Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2593472rdb; Fri, 22 Sep 2023 03:20:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGezJIafe9WFplG94IjWnAcj7lG3Mbtq2Z4BlxqdWFi/2baX/iTUWJXY4AFRYqh4TpkNzBh X-Received: by 2002:a05:6300:8002:b0:157:877a:5f5e with SMTP id an2-20020a056300800200b00157877a5f5emr5867572pzc.61.1695378012554; Fri, 22 Sep 2023 03:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695378012; cv=none; d=google.com; s=arc-20160816; b=Eq0us8rdAaEXVnf4LxpswPfDSawiIWjub6+JFGjvglwgnSgM2UtDAYLgd/zILCwYX4 R706mA1U2h4uRkBBxByEDW4xtSDTpyQzposWRgpawRStit/KXmuA5niBlFigO7GYzGqI edOz2Ey2iiGvFAQiLVpWyAq5T8WloP+QRjP+6ZN4f5tCrccsGB0re0nF5cAjB2tXU0XC lbeEoeyhK4yQ7n0HZXlGIp14anVgrgu0znbzdM1bXtvqfO6cgN4jZcpNkLf0/CAtGFrz p+sbvBOazK0VQgZACxNNyfrTRLSos0m5cw32xAkM1pgAwgeOJxYSNAMggDhCOtHmk8df edpQ== 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=nCHJWLXY/1YrhTqt01qtJc1B4rW5IBdeEn9ZMU0RfFM=; fh=IdZfnnFR3MCGPTCDeHjjFs3d4+1V/Hpf9VeH1Cuv11M=; b=l+EV3K/LuQul2U5BNJyieAIYwpYIH9Xrmw+eE3sdR3/y68imTEZdTnrJDWtE4xpi7M IjwC3GUyPHXWi4W+Ci1UWqDopaG9KH17dm+44Awt8AszZ98BVV0N0/sf+n11WeCNSWOc l6uhLvVdD1giRRGg28SEZ6bsasf1kGklGSSSdTScuQAPA8/tQPzjsNgci5ygCV8UGAOj SFLML4vF9QEiI14Rw5C2wY8KREqoH9562r6JgqeDodG3dgWhVEBo0vzS/FNnIk38dM8c q6t5kQKga7Zm16CZQg1sO0mQLcRQxz3HrYR7lahj6Jhj+1qg7LzWEqYxYqJJO8lkDlAq Gu/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=S1J6FzTl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k15-20020a6568cf000000b005777c70ebfbsi3411293pgt.612.2023.09.22.03.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 03:20:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=S1J6FzTl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 63BBF8324318; Fri, 22 Sep 2023 00:48:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbjIVHrz (ORCPT + 99 others); Fri, 22 Sep 2023 03:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230435AbjIVHrx (ORCPT ); Fri, 22 Sep 2023 03:47:53 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3C04180; Fri, 22 Sep 2023 00:47:46 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 8546021954; Fri, 22 Sep 2023 07:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1695368865; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nCHJWLXY/1YrhTqt01qtJc1B4rW5IBdeEn9ZMU0RfFM=; b=S1J6FzTlABeg7deK/pGJfYJx9Ymmo3k9fUPr9VivC/k8RORz8OkEYiQpTHfo1jZwG2HKKf 7jAKPBYWtI6PUFnXvZNahHP7l/8ahMCv4YnhlGT3U3PGkbJ1zPfwEGH/dEjK4rTuLRu3Vc 2F6VxtnpW05sqoRVxUXElGF6pnBjbes= Received: from suse.cz (pmladek.udp.ovpn2.prg.suse.de [10.100.201.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A7E482C142; Fri, 22 Sep 2023 07:47:44 +0000 (UTC) Date: Fri, 22 Sep 2023 09:47:44 +0200 From: Petr Mladek To: Enlin Mu Cc: John Ogness , Enlin Mu , 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: 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.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 22 Sep 2023 00:48:05 -0700 (PDT) On Fri 2023-09-22 15:34:44, 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. > > > > 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. > For SOC manufacturer, sometimes cpu is not stable, we need some debug > tools for this exceptions. > When an exception occurs, we may not be able to detect it in a timely > manner, but through Task _and_ CPU, we can roughly locate the CPU at > the time of the exception. Would frace be enough in this case? It has already been suggested earlier. The problem is that adding CPU into would require changes in the metadata stored in the ring buffer. And it would require updating userspace tools which read the log from a crash dump. It means that such a feature would need a lot of effort. And I would prefer to avoid it when there is another solution. If you debug the problem by adding extra printk messages you might also print the current CPU in the debug messages. Best Regards, Petr