From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F76FC4338F for ; Fri, 6 Aug 2021 14:52:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5495A610FF for ; Fri, 6 Aug 2021 14:52:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232263AbhHFOwW (ORCPT ); Fri, 6 Aug 2021 10:52:22 -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-Google-Smtp-Source: ABdhPJzaR6qJfePFLgCHPEvS2rl+ctcdCp7KoQ3Fcdv85XiJXg5JdFJiE2fEE5Q5uLbt8pe01lz22DOOlzKs3X1rUrA= 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-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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D2CFC432BE for ; Fri, 6 Aug 2021 14:52:38 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6A78061052 for ; Fri, 6 Aug 2021 14:52:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6A78061052 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Gh7kB4R78z3d80 for ; Sat, 7 Aug 2021 00:52:34 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=arndb.de (client-ip=212.227.126.134; helo=mout.kundenserver.de; envelope-from=arnd@arndb.de; receiver=) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Gh7jk67FRz3bmf for ; Sat, 7 Aug 2021 00:52:09 +1000 (AEST) Received: from mail-wr1-f48.google.com ([209.85.221.48]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mati7-1mjQHX3OgN-00cQv0 for ; Fri, 06 Aug 2021 16:52:04 +0200 Received: by mail-wr1-f48.google.com with SMTP id d8so11432399wrm.4 for ; Fri, 06 Aug 2021 07:52:04 -0700 (PDT) X-Gm-Message-State: AOAM531zlWm96QSQ8VudtU0wRM4usTz2i443xkJ8l9CYCov8nB1OZYCn MST50LpDpaCMPPBQ7vj+dwjFK6K5TBqj05YM0BI= X-Google-Smtp-Source: ABdhPJzaR6qJfePFLgCHPEvS2rl+ctcdCp7KoQ3Fcdv85XiJXg5JdFJiE2fEE5Q5uLbt8pe01lz22DOOlzKs3X1rUrA= 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 Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:CWwIIv4pyhdNE4mN8f4XtprjfxP1kCZL5ngO3JZdXOtL3jNkvS2 ctG+obuaiqWvaB8BYGcMLKBLrdHaHI02FATZbXPNjUMdMG46A+2fLAZN0ugW/MQes76DPLW 3gWZv4Gwe9tSMzrernXngzNtGYCs8YfqoyDsn+pjwqbunnkO5Qfgzut92v1ZSc3wMD6WNwK 1jvjl07XpeLUwpUCi75Zg== X-UI-Out-Filterresults: notjunk:1;V03:K0:taeBenBSWCw=:mEQvoS0roRqoAj3JIIIWzn +oLmeo6JypZKvdTsCOh7xk9mlbFMn4etPRR2LRDPKnS+aJ89PHs0x2mSC67RaeoLyCyGoSMA7 1qW0upbnIam5lfolSa3KRJ4v+mXeutyQhoNrNCzPl+acD1x+8JXSOWKODK86elbHRhMK40ECA eeQeAgf/K92yTxP4OIDLbD4zC7JGZBcb+a0AmlqylO2YOUDuHZg2sVOgX0LEE6HgbidkFEJh2 dF5hFYg3z7oZ4we7x6+53YOjdC+HKsIka1C5+sZUJPKs7UN64+NELgeXWxmuJGAPc1a9T84X1 P0hcGbVZMk+3rzBbJ7yRxiEsKOe5f/+k4aUAb0dwRlgv6d10pIw6t2VnQtSD8VWr59jin89oo Jg9LhXHADCYMCdZHmKN5TIYabKD4DYTuSQLgoXzpC8cn6YEYnSJCcPTYnjdoDFez7OBhIy9Wj tQt+y48sWAiFJDoSrA2ScPXZhsZBd1tmqYbXRGDlWOnI6vqw5ZShUrlQFf7wu82rDcoeSUGFK CRtAAznLuX3RegOfjrkrwE4smeCZWDtdsFXnE0SIvBbfaYM/FQfTom6HeN7as2RZHcfiSa9q5 bH3b4GXOSzQSQErnado2qBmu6JXBqnn13viYwRpMV9zgRQqSWkLm5ZmeTQFHAuC/gQ8TjPsTW 5Ly4YYW4zrlMWo5BZMKKPCBSwPJj5be66PVJZIBv22BemhNoOos4+i72RuJfmTV+/hOvmPe7q 3maVbQlkmuQPqwgrRMIXmvhpSVsJQI6HZam+EmnSxBLw7O/XKwiJfPiC5S/SHTuz2tdTZ3hG3 h6hj/dCIv7PTJJeBUZvKOaLDLmOIZXNdscvoskvqJ1mKBvr1VpRV4FeYtK1WprlIkjBFQ/cE/ otruh8oTbSF5u/Eew1qONIeIQ2m5AhdN7lXMjVVg/x4KZ7y6gJj8svPWENmv+Jx1w75hv+I02 2jLP/8Wvy8LPDMKDuFXnisdlJAhm5D00f9fr9N0xttzC0lXdAovBg X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Jiri Slaby , Amit Shah , gregkh , Linux Kernel Mailing List , "open list:DRM DRIVER FOR QEMU'S CIRRUS DEVICE" , Guo Ren , linuxppc-dev , Omar Sandoval Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DCCFC4338F for ; Fri, 6 Aug 2021 14:52:14 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E2DF86105A for ; Fri, 6 Aug 2021 14:52:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E2DF86105A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 9D60C83AE2; Fri, 6 Aug 2021 14:52:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AmbBXTZKqBnM; Fri, 6 Aug 2021 14:52:12 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4EB4383ADB; Fri, 6 Aug 2021 14:52:12 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 26E37C001A; Fri, 6 Aug 2021 14:52:12 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 11C0EC000E for ; Fri, 6 Aug 2021 14:52:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0C765405F5 for ; Fri, 6 Aug 2021 14:52:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NPNj_aKxuJ3H for ; Fri, 6 Aug 2021 14:52:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) by smtp4.osuosl.org (Postfix) with ESMTPS id 28D3740628 for ; Fri, 6 Aug 2021 14:52:06 +0000 (UTC) Received: from mail-wr1-f47.google.com ([209.85.221.47]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MlfL0-1mujtG0yuY-00inkV for ; Fri, 06 Aug 2021 16:52:04 +0200 Received: by mail-wr1-f47.google.com with SMTP id c9so11397166wri.8 for ; Fri, 06 Aug 2021 07:52:04 -0700 (PDT) X-Gm-Message-State: AOAM531vi0gLOasp/r1B9sEPRovWfGbr8lXpPvM851IJ7FX/z9lUUZKy ZtsxbiFRabmXclrxow9zm6Mp2jiSSpnSmtX0gL0= X-Google-Smtp-Source: ABdhPJzaR6qJfePFLgCHPEvS2rl+ctcdCp7KoQ3Fcdv85XiJXg5JdFJiE2fEE5Q5uLbt8pe01lz22DOOlzKs3X1rUrA= 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 X-Provags-ID: V03:K1:OFhpfsKLcsQV4t0EYb6IvtJoSrA+DPNk8VVbxwUrYDYSQeq2tgK uRsgFr2cTHk71iFSJV7eaEtKVkAeUxlPWCXMKJDETuMLUQu9+bnlXfvQN+NnIaoewpFVTkv tiCJS9zNqM5HSKkMZ4TB+qkLlr9fz+d0Z8MorbOLXN+U5yds6vq9Ad82+U3s/u4sdD5ZmGm sKJVx+p2VfcMgcJIASx+A== X-UI-Out-Filterresults: notjunk:1;V03:K0:tepUAV1ISzU=:JR4XUVcq6mxQLw7oD8owlB pwTWJkJAaIzuJ3TE3Y4pNCN9ZvegoQsABBg00WGEGsk9ADXKiNXRiSKD2uZ0aoR9pI3nrvGrN DfUQSZJ3XxMlkT2O5FcFBrQ2desUJsKJARnCOAfF7SIMbjoy+wttOUBRuD4mYOzNIGfI+DFJo iBuOIR9pCw8h8hdu89VL9lbu9Fkhx1OtGyRq5Yjw3H+j7l0lEN3LEmPc+YzDKcI+7SED8IFv/ gzHHaHmwK+2Th3UWd3e+2q3sohJnO8ruWPvuYtO9gFKhu48ofvy8p8n+N9mSu9QyGyYfVvOZj dojcqa8brvWvlniIudyFDsiZgc2H1itciq6+W71P4doEJVrYPxRDmqtnXZbeoix2x0NekkHXJ TWWZEMyUmRKRWQGx762PgF+tXq3FnyGqPHG8oVAbvp9E6AyqgWZbUcGdHuYWfJ8OPKVJiCjC4 On3GlurWJ/4xocaFPL2cpIQyc4F4qeZ1eMu8b/KlCF3tSpQtwN3UQ0fp1dJXklpgZoVXVpnro YXmh3JuI2rflfDC9bDWjIBb4BkMcatVLYQemfr9ph/qMj//Jh81YAtAC5TKQs9LnT1zz1Xyvb lYsFyHkgB6yoqu7CUzwSGJSx0i6SwzoaLh47h1MFu9wh5yiXd/7KQOcGeWiagkhCDaa8Pn24n ary00BZO2oD4esSqblfuR6poUs2xFLDvVudhaSprOK4QOfgzL/d/MMSyjIHrVjfQoH6ZKOcXq 9Gps8eWE4lxrH7+1amd18D/BANpK/srVJ7QZ9gXQN9uW2KFGjeyeQ/o81lEJvfNZJmeuMVDQ4 JHMsaLUa8RCAAoMLVKWnXMGc3VoLxGqHMFFfcrWywF7GLNiRnrWPC5j9dmtquU36BhkoKTGz6 YfkFVga+kqF6/87sRbUNidH9KAVNULjCqOctrvd3+Lzb5I5SHEWyn1EqvXYotMNgjuOXgWymA wwn+JVrRwHwbH65LXQY7mslmtlJfBeYX5EzUnHvpIekfH54Z5NOjZ Cc: Arnd Bergmann , Jiri Slaby , Amit Shah , gregkh , Linux Kernel Mailing List , "open list:DRM DRIVER FOR QEMU'S CIRRUS DEVICE" , Guo Ren , linuxppc-dev , Omar Sandoval X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" 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 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization