Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp1344275pxt; Sat, 7 Aug 2021 08:01:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzioub4sGhGzdevECtF8Ai0yap09vIhaWvzskO5X1zIdJfN7MNLOyN30TsTzGSeZdJIzcOK X-Received: by 2002:a05:6638:1251:: with SMTP id o17mr14902770jas.15.1628348486527; Sat, 07 Aug 2021 08:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628348486; cv=none; d=google.com; s=arc-20160816; b=ssvufqJUtLVsqeOllZ/zmK2cOJNe3HKGwJcWMlSHsDx7XJUkQ5JcV+GEuk1Ax42aaE SZdbZXzfYprj1DJKfBLl3OOmD1u8decCc3NSDCpCFRQ6FovxRrxyM8WFYicptaTbAAyG 2farsL15cAIqDANJIs4zIpDGJLWEAaGGufqWBhCLPifWIottaZtkVO6zYrwOIHedrp8A 0NgtZR+0BQr9QmvB0pwkZfQPQEwMeE7oEabTqqMPBzYdQJdi2iIFpoPjvU50M8VbhAVG YYl6i+CgqxFAIcf6iwWw2jCDkuh8Wx1epwdBG4rnRQTorkiMZNN/eEyFt/+uwav+y3jI 4nsg== 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=KoL5GdGNWIOJ7hek/HYzsmNpGleRT3zme3Y+AiAwnYA=; b=FMW33okaDrBPW2ccI9dHdo4lp3tjtLvAeqBPHDUqT/Vldmqok35D67CMrCna8JPpsi 67FL+YIar8vG+k8Y99juGEG8mk2sWP0c+4e+G3HZtEM8lUy3HImCM5jWEfJxHcasmxZF oFfZd2prLUmjUU6IUfuEgfDodQ7ZhFn27CROmSdCJp8rpTA/iiVztjSMltx6prgiHI1Y OXqi9DvOqxU/Z2oD2egxK+w6XbOEDl8Aa3jRYl2cn5xVUTW5GHm9JZpOzIfl1vCFlFvX pd1N8hui3x2plNjGYKt8iNHLtzkDw6PqmrX1a5rvphXjv+0JwsoPYIYa7pA+8u8RtvR7 WL/w== 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 o22si14967903jat.46.2021.08.07.08.01.15; Sat, 07 Aug 2021 08:01:26 -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 S230371AbhHGPAy (ORCPT + 99 others); Sat, 7 Aug 2021 11:00:54 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:50886 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbhHGPAx (ORCPT ); Sat, 7 Aug 2021 11:00:53 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R821e4;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=9;SR=0;TI=SMTPD_---0UiE-spl_1628348428; Received: from B-LB6YLVDL-0141.local(mailfrom:xianting.tian@linux.alibaba.com fp:SMTPD_---0UiE-spl_1628348428) by smtp.aliyun-inc.com(127.0.0.1); Sat, 07 Aug 2021 23:00:32 +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: <0b689760-6da4-f796-633a-059fa758bbf3@linux.alibaba.com> Date: Sat, 7 Aug 2021 23:00:27 +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. I will make the change in v5, thanks. > >> +/* >> + * 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. thanks, I will fix it in v5: #define __ALIGNED__ __attribute__((__aligned__(ARCH_DMA_MINALIGN))) > > Arnd