Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1603043 > unrolled thread
| Started by | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| First post | 2017-03-17 06:10 +0100 |
| Last post | 2017-03-20 17:00 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] tty: hvc: don't allocate a buffer for console print on stack Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-17 06:10 +0100
Re: [PATCH] tty: hvc: don't allocate a buffer for console print on stack Jan Dakinevich <jan.dakinevich@gmail.com> - 2017-03-20 17:00 +0100
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2017-03-17 06:10 +0100 |
| Subject | Re: [PATCH] tty: hvc: don't allocate a buffer for console print on stack |
| Message-ID | <tlSjg-10u-11@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Jan Dakinevich <jan.dakinevich@gmail.com> |
|---|---|
| Date | 2017-03-20 17:00 +0100 |
| Message-ID | <tn7SW-6Ou-17@gated-at.bofh.it> |
| In reply to | #1603043 |
> 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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web