Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp836870pxt; Fri, 6 Aug 2021 15:20:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhI6QTEK78LWbpwk1C7yN3JvcZF0gcOkUWrvkbu0M9bAxp7Pf2c66vOt+mjhNIHhHPO/uz X-Received: by 2002:aa7:d296:: with SMTP id w22mr15755520edq.170.1628288448123; Fri, 06 Aug 2021 15:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628288448; cv=none; d=google.com; s=arc-20160816; b=Qhx4uzEqFE17FrpUQeenHUdk0Esw69/OKzO3ewTtbarKClJQtaLsbShEscAPAbN4sw PqQn/XM6D/6pi8aOK7DawjBbnYN/frDBB8yZKmwnAK/Rc/EZjzs1XQWy/NE970y0IYx8 Nxt3C7KE+YLS8TcilB/PcyWPn7z3cWTPnh1lxWaEy7U0igTLorDf14kNC+FXleIYCpsq 1hf1CKU47KW+dtAoExO1zx4iJARoQbP4MjCgUW/Bbr2o0aDLcKtnewz+txHMI8YJLTO7 Nda/2o5rzYW4If7uWrB8K+856l0ebUo8GRjULe0reox04n6F3kq39iC/TMuffWdWDsXk CulA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=7UpU7U2RvZEHZjZoRZvnBeyqxLgKttdlJTf8+HjBSng=; b=XGMJbl8+Xq6nOUJQqmLuwwHe3mNOQXgXG7ZwlF80oF+1+Gnu+Yip8oDWWkv23IySPi DiVVK88KrOJsmvCb9MJrcxxS7S7YtoGevvCuDEg2AljYW6jysFqz+nohU82fL1H/+PhM uJehUm+ghm0qhRu9k0p6xd6VcMgyGOXPoB7JOlrZ9w26RGaUrwLgCy/LPIWmjVpMl5Iw chrEHcrz56/1cMwGbsK38shobeth3xRa6zOb3UAbe5oyh/eoA0nrmneTQUzWAyPSkxA3 cKQJ6tbGKk9fJMh2Kl2V+WxP4J/uC2mRPtEMPM3dCgumBCxoXZoqmhEM3KJioBrTBYjT TFzg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f23si10111488ejt.744.2021.08.06.15.20.24; Fri, 06 Aug 2021 15:20:48 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232024AbhHFOwV (ORCPT + 99 others); Fri, 6 Aug 2021 10:52:21 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:58923 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231577AbhHFOwV (ORCPT ); Fri, 6 Aug 2021 10:52:21 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]) by mrelayeu.kundenserver.de (mreue106 [213.165.67.113]) with ESMTPSA (Nemesis) id 1M42Ss-1mC1Ce0iLw-0007mA for ; Fri, 06 Aug 2021 16:52:04 +0200 Received: by mail-wr1-f50.google.com with SMTP id b13so11437422wrs.3 for ; Fri, 06 Aug 2021 07:52:04 -0700 (PDT) X-Gm-Message-State: AOAM530i+MDVvDkDoFbTqM/ildS2nGThNI3AiC8fR/e3nrtIIYSGk+3m G2T8K9k+/gvtT5sCP/1KdF1lD5OD+iV5nmnWwME= X-Received: by 2002:adf:f446:: with SMTP id f6mr11689710wrp.361.1628261523856; Fri, 06 Aug 2021 07:52:03 -0700 (PDT) MIME-Version: 1.0 References: <20210806030138.123479-1-xianting.tian@linux.alibaba.com> <20210806030138.123479-2-xianting.tian@linux.alibaba.com> In-Reply-To: <20210806030138.123479-2-xianting.tian@linux.alibaba.com> From: Arnd Bergmann Date: Fri, 6 Aug 2021 16:51:47 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 1/2] tty: hvc: pass DMA capable memory to put_chars() To: Xianting Tian Cc: gregkh , Jiri Slaby , Amit Shah , Arnd Bergmann , Omar Sandoval , linuxppc-dev , "open list:DRM DRIVER FOR QEMU'S CIRRUS DEVICE" , Linux Kernel Mailing List , Guo Ren Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:DuTto7kTHONKfiGCgAJejg3DLsCVVBUeFiGoJnb9xvfdOo7xrIM eNwunxdMv6eTZmqn2f59Rix3H5l1J3LcK88TIf0Y/lQhU6g7QUYjv6Vp8RdlXIZbP8Rebad ISzo0vr9P5R5VIXjvnFhVjwjM2CXz98fdNsoyYB5wVN+TGWiI+7ZtD+04W65nsoHzyGawcV 4RArcs0f8TPApUtVmLkXg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ubePW391dT4=:3EGI5fK9+AfIrYBqm9Mpbt Kr46qGeuHAc7VCc9wEfh3IBS+FS+2P8fUyI9KbOqKq6rXXWrPTxNoZZTRTO83n8dyP8zCyhSI 2WalzlHfdaIfXvgekXIr+lA4tpwdTCIbAmq3CqWLtlUqIQMdj8kXq+uFz175Dh+XhAyOQUjBB PX6RQtOc5UmJuyeQ2nLVxBn3cpb9fluuoFOGvDOUZBGuWMIESfSWNcJ9/WS+ybSVAAdsTOB2+ L74mykklgJO13ZBoLwu//TciX7W5atD1NWIgZL5bNMpCkym1TJogdO7AyEDMjbTOJuY6y4pGw P4rwYHN1TFwcqz/8l5kUUSn0c1De+KGHoQXT25Rr5uysAWwLa0NjB1OFjopX+LEXLuNGdgygm 29FXmjFCzbnifBiOIA1V3WCPd6lS3bt+9e5WSrI7zg7kWvRouh2VVCbQpzUpYTDrIlFRypex8 rRVnbqvqqcR/QRpxyHdf3+yZtMJ11ya4QiMYYhx+743vQpYEJgdl8M4WJnt9Mr6kY+H7eOBAH Bvl1T+cvB9+A631ZjiY9FVq/eLZ4n7MbZyV/Z9Mv4yhHsREO/FXBL4hCaWo9v2M9jlLcJwdFU eJK1+jO4r44uMOOLw3h64pHoKXJ3gekPDJ+T76oWrbt6E+m4LMHW6CYo15mqx3vfmp1Aa/mof q0xfpIt8pdpxZev/RoYy96ypqCr81ljX86cqwWykUuVpBOXDByhuKrkRNWHv/ga87Pas+ywqV f2TbZVfnLAwaldb1DZ6tyolB1bro6QE7ox4D0XCXojPkHLkMNpaXLNevzMkXVbk681+GRB8mB FRxfO9t/IgK81JXfjcdWFA4Oe4O50SQl6KJhW+tkysnAHmpXT9KAqUmlij7yJnI5GtQAoyp Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 6, 2021 at 5:01 AM Xianting Tian wrote: > @@ -163,6 +155,13 @@ static void hvc_console_print(struct console *co, const char *b, > if (vtermnos[index] == -1) > return; > > + list_for_each_entry(hp, &hvc_structs, next) > + if (hp->vtermno == vtermnos[index]) > + break; > + > + c = hp->c; > + > + spin_lock_irqsave(&hp->c_lock, flags); The loop looks like it might race against changes to the list. It seems strange that the print function has to actually search for the structure here. It may be better to have yet another array for the buffer pointers next to the cons_ops[] and vtermnos[] arrays. > +/* > + * These sizes are most efficient for vio, because they are the > + * native transfer size. We could make them selectable in the > + * future to better deal with backends that want other buffer sizes. > + */ > +#define N_OUTBUF 16 > +#define N_INBUF 16 > + > +#define __ALIGNED__ __attribute__((__aligned__(sizeof(long)))) I think you need a higher alignment for DMA buffers, instead of sizeof(long), I would suggest ARCH_DMA_MINALIGN. Arnd