Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp244491ybx; Wed, 6 Nov 2019 16:23:20 -0800 (PST) X-Google-Smtp-Source: APXvYqwLYTa+XS90ILA7NcRBz0ZdiX1zAd3VLpDI+IY0uHJDFjBxs2vi+DPWqtsPGiOFoliyn9eX X-Received: by 2002:a17:906:c801:: with SMTP id cx1mr404628ejb.266.1573086200496; Wed, 06 Nov 2019 16:23:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573086200; cv=none; d=google.com; s=arc-20160816; b=nTPUrU4nf9wRN574BPawliXEEUyjyeN5l67PHlWLij++d25rq/XHeEXeqTKZrRTWgL kWvyx0OoU3WE2TR4ugfXqZZJ3mD/PfMdVUAuc/4zOHTyjOCQ0mywzvL1Y3u0j/TJ+sej rNPUVL7nz2P1QdMMP7LqkHYNnQwY60uziMtZViK/GmWLwdTGIWOvt+7djnDTePGdkiGf YBtTTUqUAsTSpqV8G0bkRKph44B5uhAR/4gVx6izZI8j9VMyWl4KkajpfVS3VR1j8Nrf KtlWEM1hg0nl7qvrnLDzyVs2i16BDKkJsCT6Y+80rIGpjQjzE69bUR7oEToQ9EZRQvLX 9Ebw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IoBKiF8gKZ9/YDxTbalV/OjHsBLCzrm1vO49Me9eDAI=; b=ZwmRgHb4dbJ0Dm0x2aI0r0yUD1Vr/b7XoYJCq4w+Wlirp4sYiJFCq7JWXK5y5ljo5Y wLMCF/h9JOLQfiks0roNE0+NiuYLXFORVsd9TRGqpdRmUQQm4834uhIxNysli+WQOyfv BBQx4IM6mm4/TwEbQxX0AtfqfU2UCwE4mcuVIxeM3ja5ShEx1t50aCScv1yQm1eZ26NI fPJLCrszDDg6estd1oFat0xVDeGhqNyYTI7sc2aUp4Gsvvj2AOy09ARMSyGMNUZOHtUk bZ6WfryYy9wORGkWsNe3j7ASqRjDtaSuN6H8w0URR7wS2rTIO1jFkJAloN9gc7C+ZTJt chDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EDoDOczY; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s23si342965eju.55.2019.11.06.16.22.56; Wed, 06 Nov 2019 16:23:20 -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=@gmail.com header.s=20161025 header.b=EDoDOczY; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727646AbfKGAWE (ORCPT + 99 others); Wed, 6 Nov 2019 19:22:04 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:34430 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727228AbfKGAWE (ORCPT ); Wed, 6 Nov 2019 19:22:04 -0500 Received: by mail-yw1-f68.google.com with SMTP id y18so25170ywk.1 for ; Wed, 06 Nov 2019 16:22:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IoBKiF8gKZ9/YDxTbalV/OjHsBLCzrm1vO49Me9eDAI=; b=EDoDOczYRYd4+XNT+wFjozTXCFmMi8WfCp99vh5Y6lxe35MMRziQr69H7Ln1xuu4Hj N+esKa18r9/P8Zexe9oAdTuMWOtWl2t/Pu31Tpgv+iSSwjIJm0LcpkwuzZ3fPpD2Axvs Jy7mhaVl5EDe7AuktWs1agsAQlW0LVm2+g/CkIiF9KZT9S+5OkNgbrnqkhd9cREnafKt vZfNdZosd7c7o4ZAaehQnl8UIrrLEL3wHpAIdsggYgzM8stayD20TUSSUV85YvXa7Sn0 1PJ3EpWioqkNTqfmCNUiRis3fhGlPwsjXk/BtUDRGXNVY8A1CElFPqgams6RyVT9XlKY ClmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IoBKiF8gKZ9/YDxTbalV/OjHsBLCzrm1vO49Me9eDAI=; b=DFZn4AGktgrvg8ACdZr+HQXyi6Z5bd2l1rTMrLDX0YS7tOVVyXAdvZA9P5vCV8avZV dvLvNZ6QjLbWAEe6VsW7lFzagcPR4xpxsf+C3QfNly9+vwA7+11Q+wQpzyIWD1Fn2GlK lIV+NchLHsmecC2+CTzhPhz1MKPwUvGnNz/mlMq9YAcnNWoy7AFmUD/KtdHDsdYqWI3K luaYwzhJ4k3eJqyqcYJveUqJ2LGnnPWMikMR+jpNF1oX+Gvs7HRyA7payx/IigPIqDwk JkqheOnEzM61u3sGRmVAdAHH8moa5y2aOUlKtk2dO743vlwBZI25l+slSqKRsnzhJ5R1 C68Q== X-Gm-Message-State: APjAAAVKY9c2l3xd6rIJyN1Ag4IfcLbu6HYUto/W/Fvp8RxBC9HBDgex Q1wlnh704UEP78sAlX3ucEuVEdOgKVQs2uM5Z/U= X-Received: by 2002:a81:8415:: with SMTP id u21mr268081ywf.129.1573086122063; Wed, 06 Nov 2019 16:22:02 -0800 (PST) MIME-Version: 1.0 References: <20191106181617.1832-1-jcmvbkbc@gmail.com> In-Reply-To: From: Max Filippov Date: Wed, 6 Nov 2019 16:21:51 -0800 Message-ID: Subject: Re: [PATCH] xtensa: improve stack dumping To: Joe Perches Cc: "open list:TENSILICA XTENSA PORT (xtensa)" , Chris Zankel , LKML , Dmitry Safonov , Petr Mladek Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 6, 2019 at 2:34 PM Joe Perches wrote: > > @@ -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++); > > if (i % 8 == 7) > > - pr_cont("\n"); > > + pr_info("%s\n", buf); > > } > > + if (i % 8) > > + pr_info("%s\n", buf); > > Could this be done using hex_dump_to_buffer > by precalculating kstack_end ? I've got this, but it doesn't look very attractive to me: void show_stack(struct task_struct *task, unsigned long *sp) { unsigned long *stack; int len; if (!sp) sp = stack_pointer(task); stack = sp; len = min((-(unsigned long)stack) & (THREAD_SIZE - 4), kstack_depth_to_print * 4ul); pr_info("Stack:\n"); for (; len > 0; len -= 32) { char buf[9 * 8 + 1]; hex_dump_to_buffer(sp, min(len, 32), 32, 4, buf, sizeof(buf), false); pr_info(" %08lx: %s\n", (unsigned long)sp, buf); sp += 8; } show_trace(task, stack); } -- Thanks. -- Max