Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp413757pxt; Thu, 12 Aug 2021 01:09:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyLRxXtJ2lFyZ9Si8xoBtidsh8CN5styGCR5UKdJzK4O3U06EsXGtlP7nwUg1P5xvm+Tm2 X-Received: by 2002:a05:6e02:78d:: with SMTP id q13mr2014771ils.262.1628755743170; Thu, 12 Aug 2021 01:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628755743; cv=none; d=google.com; s=arc-20160816; b=a92MBe2X/Kix40ILASj0O3PiXo+dsOZLV4619kwnuKobHraIIslMA/FBwJMb/8jqti wPnScBaPspgNj3Ehgb8PcinpQqpxEkw9K2ikjoLtcTZOC67LhyN2C34Cbtu67vyHvtJu 452/s5dmNYXKY7Ow9cfgDOlFeJw84m+eaed8JP0+L0vEk/WKecP8Cm6MEXpgOFxcnYdN mc8w4Y7ONRA3f4ekpy5AheiAzBD+nKbN/msMAH3wG1fExBjtCf6EMZfsvQrJL9oYwjxr ZjNLmihA2KZHapMBBN6B6Pw1zAxQBq/BjTSMhkoIQ7jzj5KifYOayh8/hwxffDSixqNz bo8g== 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=5XoF2RoofMNkn9Beowp+VEOotFEMEb8G6/gr3PMriUY=; b=JGdQ9vDjlG/dk6ew1Coa+v1vLBcEmy3PXvMzoZEPeucX80HpiSrsGrIIBJMYOsM2S2 hGjKloqGSUUI2P0/fmBMdl/tNzJC3kK0aApOFPHQEUvDD5eQKig2yDth0mseQRadVbDD lUE3YYaxpjBvllznONgOjCde83OzRk698wx+AHKagvMrfiPXskueKl0ksVZRCFBN01kI C/qO96ZNXAb0vQ9UzxI495s+Lml4nqnJsB0FdzqnWr6i3rxzREct64pJdN9SgFZg7iUw iYPeXLEtjD5jFANCvtLgpY+1sETf8uyP0vC8n3HpwHEZ4VPHM5HxQ8XjeSzOqGyqPsJD 6vZA== 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 m12si2204615ilq.105.2021.08.12.01.08.51; Thu, 12 Aug 2021 01:09:03 -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 S234788AbhHLII1 (ORCPT + 99 others); Thu, 12 Aug 2021 04:08:27 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:58651 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231584AbhHLII0 (ORCPT ); Thu, 12 Aug 2021 04:08:26 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=xianting.tian@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0UiluUWC_1628755679; Received: from B-LB6YLVDL-0141.local(mailfrom:xianting.tian@linux.alibaba.com fp:SMTPD_---0UiluUWC_1628755679) by smtp.aliyun-inc.com(127.0.0.1); Thu, 12 Aug 2021 16:07:59 +0800 Subject: Re: [PATCH v4 1/2] tty: hvc: pass DMA capable memory to put_chars() To: Arnd Bergmann Cc: gregkh , Jiri Slaby , Amit Shah , Omar Sandoval , linuxppc-dev , "open list:DRM DRIVER FOR QEMU'S CIRRUS DEVICE" , Linux Kernel Mailing List , Guo Ren References: <20210806030138.123479-1-xianting.tian@linux.alibaba.com> <20210806030138.123479-2-xianting.tian@linux.alibaba.com> From: Xianting TIan Message-ID: Date: Thu, 12 Aug 2021 16:07:58 +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/6 下午10:51, Arnd Bergmann 写道: > 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. As some ARCH(eg, x86, riscv) doesn't define ARCH_DMA_MINALIG, so i think it 's better remain the code unchanged, I will send v5 patch soon. > > Arnd