Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp711335pxt; Thu, 5 Aug 2021 09:45:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzapC1Uhdl3ItZZqpx2lUmuHLzHOO/fG4jBc2uTzqCYlA6w8/UD5y3kFrML+GB6aFxNBNRF X-Received: by 2002:a17:906:144e:: with SMTP id q14mr5829757ejc.19.1628181907929; Thu, 05 Aug 2021 09:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628181907; cv=none; d=google.com; s=arc-20160816; b=IJqgKmC6YXx8hBv6EjUZOjcAE2UJxac7Go9yzbnzmAz7ydFQJ7D91XEAsAz3kIQJTq n2ygyKaVT963pLQNFh+avGC4HzVhXt0AS/NhoZWcerUMKZmVAU80UxWYostgKZje3gVy mKaWL8GIao/hAzIt5oIv3DqsiQizlKOrkBuvBkCUEXFehgNSSqjfITHubPlGYT/VklYj vkEP9s0az6A/opKlH/s22JXjzFK9KoWs5R5kDYLyEEBiGkbyKW2/5IuwyRI8rPQq+/Ep D5Im5lFbOI7NFfwjIoYVtKIhTcE5r17C1hN/IkydNORqKeTZTIa1CmOm82PXt9AaBinc uhMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=0mDi7soY4zAnP8sKUiYrKXDuim3CQ8zyFUvk07tpDRI=; b=kvWPAakFGjr6Acg5r3DucM7f1odIG/0aS1gRnTcNzYZ8NA4DYbNfIwpoTe9htvFtKu vcBiOJieVoA7bRWH0mHKKxLWcaFJ81crSdo8apepb/LFVOk9py4vUdD0aGDWqS4U2M4g O5hxa5rK/IKV0IlqcNg3oHy4zqJHe14f9JX+MzZgAtRn2ntxBdNOtvqSqeo0Doxg1N1s LmXn/uyOF98R8+e5IXFQzdUpAVGT4gwGXW59PiQfNtVgrwh0mt5ZvEzAf/mAi1B2yZbl yUWgoveNI2nJ8xEcaTMYp6LVBg+ZTXCCUmGsRcE9Af1nJ/w78z1hyCwXx3sETU4RcG/x Q4JA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u23si5790726edy.77.2021.08.05.09.44.43; Thu, 05 Aug 2021 09:45:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240917AbhHELOd (ORCPT + 99 others); Thu, 5 Aug 2021 07:14:33 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:37496 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240826AbhHELOa (ORCPT ); Thu, 5 Aug 2021 07:14:30 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R941e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=xianting.tian@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0Ui1z.hC_1628162053; Received: from B-LB6YLVDL-0141.local(mailfrom:xianting.tian@linux.alibaba.com fp:SMTPD_---0Ui1z.hC_1628162053) by smtp.aliyun-inc.com(127.0.0.1); Thu, 05 Aug 2021 19:14:13 +0800 Subject: Re: [PATCH v3 1/2] tty: hvc: pass DMA capable memory to put_chars() To: Jiri Slaby , gregkh@linuxfoundation.org, amit@kernel.org, arnd@arndb.de, osandov@fb.com Cc: linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org References: <20210804025453.93543-1-xianting.tian@linux.alibaba.com> <0f26a1c3-53e8-9282-69e8-8d81a9cafc59@kernel.org> From: Xianting Tian Message-ID: <202cf491-5cdd-999f-d556-a5ebd2b4e266@linux.alibaba.com> Date: Thu, 5 Aug 2021 19:14:13 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 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,