Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp38955ybx; Wed, 6 Nov 2019 12:52:21 -0800 (PST) X-Google-Smtp-Source: APXvYqwVBXLvlvg9qM1Y5pDk/jOgnFo/d+IMtDffs2PAOcWOu3bCwQz5T06Lu1ewxigER3e01LwZ X-Received: by 2002:a17:906:5807:: with SMTP id m7mr36914888ejq.58.1573073541729; Wed, 06 Nov 2019 12:52:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573073541; cv=none; d=google.com; s=arc-20160816; b=ACleJT0t8H98Dp+j8O+1UIyHdRVx2aZJbi5RiXrFNtfb4+IdeLzQIQX1CPseM6orH2 Y2Yhq16Bc3gNoWVvaZs/SKTlQeWOYywMyICNDh2xYIv04Ld+qVOHV6b2jzW3Kr7NO50g +gzyX0NykUh5MxVp2VFUUe9PaWgnfh+JMtIbXd/EDwhfCHvpvprFHptzLUl85bhX28Fs L3wHd5L5Zx1rEKjUTg9hXDHw9am8GoCFShuTYfxVYZEZ+kEah3nBqFUBGYLRycoAQ0oB 9/r8HlYo40C9n4wjh2fMcrgZONdZln3PlAbXhEMPYSlVHB/5mDqjPb/o2WVKYViZxYjf dLaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=vJ9OYEmFicBQTWC5Whu4ZobVh1fTGzzolfkLnikbPY4=; b=VEMOnzE76My6jY1UKg8UqvQrd6nvLlb9S7f1kl5pl2btk4pKcbQjhHQIflaeUj5T7b l+AXoyhWciv33/Yvvr4pO/AhRnKPLXLlD16KasXkgCmVtzsklTvazBddNNH0SydFRn7t iUcgX8Tex1XT2vD2WSEmk9G6yjioooHRY4lpvVy4PQ6HZPsiA6uDrEcSs7XrMm9quDnI Ca8IrFd/a2x7AAESuTzlPyGAtcZHZX6CyC+gJtXLkjmaGUNjbxyXWBB8kU9MyG/u0Rhw 1nRWh559a3M4rKLUH6/b1sW9QGkRs3Rrmq7wZnXTAq34nWWIWIWGn1djoj3dtBD4mRrc N6zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=mBGIaMQE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8si42287ejc.104.2019.11.06.12.51.57; Wed, 06 Nov 2019 12:52:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=mBGIaMQE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728580AbfKFUvK (ORCPT + 99 others); Wed, 6 Nov 2019 15:51:10 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41146 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727587AbfKFUvK (ORCPT ); Wed, 6 Nov 2019 15:51:10 -0500 Received: by mail-pg1-f195.google.com with SMTP id l3so17947805pgr.8 for ; Wed, 06 Nov 2019 12:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=vJ9OYEmFicBQTWC5Whu4ZobVh1fTGzzolfkLnikbPY4=; b=mBGIaMQE3+XoVaKnpNhd92Abqgr7jZea+yZZJIKuyqtQXCqrt1QwBqnV/d1M6mMaLI CpbZ0Ed/mH7mdSu3rACsHRsu0R4J1u1lKv4a0FhPvA8hv4V4u6K73a+8auCT1VxRsXF4 qBEfKY+G7dDAdfa44Cc2QlpWcfB1f6l3xozLnpY4F6WQsq1agIgA09BqYKZDmQPq5yuR tvsxe4T9Pa99B3/RaWl//T0GtcPZPyPBsTbc4nfbyvW5iGAadIOjil73EhVOfpUJ9zfi KMHfqTLRnsf48A9ZVi9H5ALepCZS8V4UFj3j+Yah/iY8YqPWOPgwnEUtps47DFwtEIs3 h6gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vJ9OYEmFicBQTWC5Whu4ZobVh1fTGzzolfkLnikbPY4=; b=LrK+ZuimzNqqzsIXaJm+FGfKK40BO9h0VorV8EbWb0vI+2uo5jX9p0vBghdMP3qoys V4nU+r+9UV7W5YB4aynLesS31JDXRdtUBfwe4so7vif3NaewzdZ31i7eYDHPqUl0IH5D imQbVKM6zVZy/rRHDZJUZ7typA154RfPStk9cZxeWm9VFNyIeKcqrmfA15CWvbc4SMeD km6amBZoyN+sC8b77D2mBjPRJJHoiP0FcLBZcG0sZQk7aCrBbGu5qOBWCMGlMH29NWvW r5ivhVu64BA5zZ2yfD1+c8wt5gn5U5ybwd0R7FHY8OjdYxlil3VJc38Lq6ULlROsskjs WDAQ== X-Gm-Message-State: APjAAAW/bh3u8bYSSOxQDk/HkXoXLmlJgUP1zL2dHO6bv6TcMs2fAlFl eHBsIWRRCtksrdZbpVcU8EPaXw== X-Received: by 2002:a65:6119:: with SMTP id z25mr5370779pgu.332.1573073469666; Wed, 06 Nov 2019 12:51:09 -0800 (PST) Received: from [10.83.36.153] ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id 205sm22138639pge.56.2019.11.06.12.51.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Nov 2019 12:51:07 -0800 (PST) Subject: Re: [PATCH] xtensa: improve stack dumping To: Max Filippov , linux-xtensa@linux-xtensa.org Cc: Chris Zankel , linux-kernel@vger.kernel.org, Petr Mladek References: <20191106181617.1832-1-jcmvbkbc@gmail.com> From: Dmitry Safonov Message-ID: <27720768-9fb7-0382-e1ef-ac9760cdf5cc@arista.com> Date: Wed, 6 Nov 2019 20:50:58 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191106181617.1832-1-jcmvbkbc@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Max, On 11/6/19 6:16 PM, Max Filippov wrote: > Collect whole stack dump lines in a buffer and print the whole buffer > when it's ready with pr_info instead of pr_cont. This makes stack dump > lines consistent in SMP case and relies less on pr_cont/printk > differences related to timestamps. > Make size of stack dump configurable. > Drop extra newline output in show_trace as its output format does not > depend on CONFIG_KALLSYMS. > > Signed-off-by: Max Filippov [..] > void show_stack(struct task_struct *task, unsigned long *sp) > { > int i = 0; > unsigned long *stack; > + char buf[9 * 8 + 1]; > > if (!sp) > sp = stack_pointer(task); > @@ -512,10 +510,12 @@ void show_stack(struct task_struct *task, unsigned long *sp) > for (i = 0; i < kstack_depth_to_print; i++) { > if (kstack_end(sp)) > break; > - pr_cont(" %08lx", *sp++); > + sprintf(buf + (i % 8) * 9, " %08lx", *sp++); buf is on the stack, does sprintf() put null-terminator for hex? > if (i % 8 == 7) > - pr_cont("\n"); > + pr_info("%s\n", buf); > } > + if (i % 8) > + pr_info("%s\n", buf); If the stack trace ends with (i % 8 == 7), you'll double-print the last line? Thanks, Dmitry