mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Dakinevich <jan.dakinevich@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>,
	Peter Hurley <peter@hurleysoftware.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Arnd Bergmann <arnd@arndb.de>, Amit Shah <amit@kernel.org>,
	virtualization@lists.linux-foundation.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: hvc: don't allocate a buffer for console print on stack
Date: Mon, 20 Mar 2017 18:55:15 +0300	[thread overview]
Message-ID: <18f113d4-9c37-0114-d637-3720ad093722@gmail.com> (raw)
In-Reply-To: <20170317050930.GB28075@kroah.com>

> 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 <jan.dakinevich@gmail.com>
>> ---
>>  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

      reply	other threads:[~2017-03-20 15:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 20:42 Jan Dakinevich
2017-03-17  5:09 ` Greg Kroah-Hartman
2017-03-20 15:55   ` Jan Dakinevich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18f113d4-9c37-0114-d637-3720ad093722@gmail.com \
    --to=jan.dakinevich@gmail.com \
    --cc=amit@kernel.org \
    --cc=arnd@arndb.de \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=peter@hurleysoftware.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®