[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202cf491-5cdd-999f-d556-a5ebd2b4e266@linux.alibaba.com>
Date: Thu, 5 Aug 2021 19:14:13 +0800
From: Xianting Tian <xianting.tian@...ux.alibaba.com>
To: Jiri Slaby <jirislaby@...nel.org>, gregkh@...uxfoundation.org,
amit@...nel.org, arnd@...db.de, osandov@...com
Cc: linuxppc-dev@...ts.ozlabs.org,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/2] tty: hvc: pass DMA capable memory to put_chars()
在 2021/8/5 下午4:09, Jiri Slaby 写道:
> On 05. 08. 21, 9:58, Jiri Slaby wrote:
>> Hi,
>>
>> On 04. 08. 21, 4:54, Xianting Tian wrote:
>>> @@ -933,6 +949,16 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno,
>>> int data,
>>> hp->outbuf_size = outbuf_size;
>>> hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))];
>
> This deserves cleanup too. Why is "outbuf" not "char outbuf[0]
> __ALIGNED__" at the end of the structure? The allocation would be
> easier (using struct_size()) and this line would be gone completely.
I will make the cleanup in v4.
>
>>> + /*
>>> + * hvc_con_outbuf is guaranteed to be aligned at least to the
>>> + * size(N_OUTBUF) by kmalloc().
>>> + */
>>> + hp->hvc_con_outbuf = kzalloc(N_OUTBUF, GFP_KERNEL);
>>> + if (!hp->hvc_con_outbuf)
>>> + return ERR_PTR(-ENOMEM);
>>
>> This leaks hp, right?
>
> Actually, why don't you make
> char c[N_OUTBUF] __ALIGNED__;
>
> part of struct hvc_struct directly?
thanks, it a good idea, I will change it in v4.
>
>> BTW your 2 patches are still not threaded, that is hard to follow.
>>
>>> +
>>> + spin_lock_init(&hp->hvc_con_lock);
>>> +
>>> tty_port_init(&hp->port);
>>> hp->port.ops = &hvc_port_ops;
>>
>> thanks,
Powered by blists - more mailing lists