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=-2.9 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT 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 4F2C3C004C9 for ; Tue, 7 May 2019 13:19:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A0FB205C9 for ; Tue, 7 May 2019 13:19:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726726AbfEGNTQ (ORCPT ); Tue, 7 May 2019 09:19:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42890 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbfEGNTQ (ORCPT ); Tue, 7 May 2019 09:19:16 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 231CE307D91F; Tue, 7 May 2019 13:19:16 +0000 (UTC) Received: from treble (ovpn-123-166.rdu2.redhat.com [10.10.123.166]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0519660C4E; Tue, 7 May 2019 13:19:09 +0000 (UTC) Date: Tue, 7 May 2019 08:19:07 -0500 From: Josh Poimboeuf To: Petr Mladek Cc: Jiri Kosina , Miroslav Benes , Joe Lawrence , Kamalesh Babulal , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] livepatch: Use static buffer for debugging messages under rq lock Message-ID: <20190507131907.ep5g2hi4hp2lvy3d@treble> References: <20190430091049.30413-1-pmladek@suse.com> <20190430091049.30413-3-pmladek@suse.com> <20190507004319.oxxncicid6pxg352@treble> <20190507115029.54qxbsd4vsouwvjo@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190507115029.54qxbsd4vsouwvjo@pathway.suse.cz> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 07 May 2019 13:19:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 07, 2019 at 01:50:29PM +0200, Petr Mladek wrote: > On Mon 2019-05-06 19:43:19, Josh Poimboeuf wrote: > > On Tue, Apr 30, 2019 at 11:10:49AM +0200, Petr Mladek wrote: > > > klp_try_switch_task() is called under klp_mutex. The buffer for > > > debugging messages might be static. > > > > The patch description is missing a "why" (presumably to reduce stack > > usage). > > Exactly. I thought that it was obvious. But I am infected by printk > code where line buffers are 1k and nobody wants them on the stack. > > 128bytes in klp_try_switch_task() context are acceptable but > it is still rather big buffer. > > OK, what about the following commit message? > > "klp_try_switch_task() is called under klp_mutex. The buffer for > debugging messages might be static to reduce stack usage." It's better to use imperative language. It would also be good to reverse the order of the wording by starting with the problem. Something like: The err_buf array uses 128 bytes of stack space. Move it off the stack by making it static. It's safe to use a shared buffer because klp_try_switch_task() is called under klp_mutex. -- Josh