From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754960AbdCTP4F (ORCPT ); Mon, 20 Mar 2017 11:56:05 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34376 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753328AbdCTPz0 (ORCPT ); Mon, 20 Mar 2017 11:55:26 -0400 Subject: Re: [PATCH] tty: hvc: don't allocate a buffer for console print on stack To: Greg Kroah-Hartman References: <1487364165-21882-1-git-send-email-jan.dakinevich@gmail.com> <20170317050930.GB28075@kroah.com> Cc: Jiri Slaby , Peter Hurley , Dan Carpenter , Arnd Bergmann , Amit Shah , virtualization@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org From: Jan Dakinevich Message-ID: <18f113d4-9c37-0114-d637-3720ad093722@gmail.com> Date: Mon, 20 Mar 2017 18:55:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170317050930.GB28075@kroah.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > You shouldn't use 'static' data either, that's not always guaranteed to > be DMA-able, right? I naively thought all 'static' data was linked into .data and the section was always kmapped. > What about allocating it dynamically? That's the correct thing to do. Yep, the solution was more welcomed and happened earlier: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c4baad50297d84bde1a7ad45e50c73adae4a2192 On 03/17/2017 08:09 AM, Greg Kroah-Hartman wrote: > On Fri, Feb 17, 2017 at 11:42:45PM +0300, Jan Dakinevich wrote: >> The buffer is used by virtio console driver as DMA buffer. Since v4.9 >> (if VMAP_STACK is enabled) we shouldn't use the stack for DMA. > > You shouldn't use 'static' data either, that's not always guaranteed to > be DMA-able, right? > >> >> Signed-off-by: Jan Dakinevich >> --- >> drivers/tty/hvc/hvc_console.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c >> index 9b5c0fb..1ce6aaf 100644 >> --- a/drivers/tty/hvc/hvc_console.c >> +++ b/drivers/tty/hvc/hvc_console.c >> @@ -143,10 +143,15 @@ static struct hvc_struct *hvc_get_by_index(int index) >> static void hvc_console_print(struct console *co, const char *b, >> unsigned count) >> { >> - char c[N_OUTBUF] __ALIGNED__; >> unsigned i = 0, n = 0; >> int r, donecr = 0, index = co->index; >> >> + /* >> + * Access to the buffer is serialized by console_sem in caller code from >> + * kernel/printk/printk.c >> + */ >> + static char c[N_OUTBUF] __ALIGNED__; > > What about allocating it dynamically? That's the correct thing to do. > > thanks, > > greg k-h > -- Best regards Jan Dakinevich