Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp961794pxb; Fri, 13 Aug 2021 10:07:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw14qFm6//+27vH8IVPxWJSltsvCGehvLxpRxd3yWkrh0tex4+DFnCkIQalweKhlJeuQFTp X-Received: by 2002:a17:907:2d0f:: with SMTP id gs15mr3426300ejc.23.1628874445286; Fri, 13 Aug 2021 10:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628874445; cv=none; d=google.com; s=arc-20160816; b=cEmC2LDUzCkVfnPTE377JuOmu023Ch2tDnBHS7HwY18//gu5VqtiqA54+LfviBro0e XL4/KKDZYta2V4I4c4B1JRbMHFLBct3XRySScGg4iLLjWulWT8N6Uyvnd+SLo8v6u9J3 SQt66no0Xem6owVZEsvm5AWD/osQc1pF0jmf98ajyguxSctdPOeU6t52tJMk5RlP/d94 09qhiLBDgNw7w7jdgLCa3jkkN0RrRjgbpq1r/vvNHnA7pfD6ADfvYROcyVc7kr/KgaTE PAfSo30q6m4T9wdhyzmOaJ3nrCuWeQ1SGmHymydziQ7pNy3weDn2UIPSuBvVfvQXPDX6 9CEA== 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=ebAKl0jat3NaVD7XiTEhxvzBYKy4ch7+8DoQhpZ2Gfs=; b=n9zzgBwMkm/jQXjwlS+qtbfJTDnq7bFG2dTbs8dlIasf8jZ7NUA4pRKXQmyE7TMte4 Tlbil7+UAA9R/h4EKuqjJt1eDOz5W/NXem3JhdMZPfes9geabmuHvpfJq3oB3BDNJ7Nt 6j1W7bLSCEBxJpIgtYy2la+fZGTMe7Dj5oRtQjxooz/5SQlqnFWUUlrzN1ltO/mIC1O+ cqk1vjJYEEI4ZizZZCyFIpjI0bvK0/j4TNqi4XB8MjwAHHb+p/3RaLmGxHnejZFrIx2E 9hGCRaSLQutf9DzhEsl8KBAYig04U6sR04j54NYVrXn0GcPwv2b+YQY4OBYidY48eOQ+ QcWw== 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 dn6si2510692ejc.209.2021.08.13.10.07.00; Fri, 13 Aug 2021 10:07:25 -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 S241407AbhHMQHe (ORCPT + 99 others); Fri, 13 Aug 2021 12:07:34 -0400 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:44472 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241395AbhHMQHe (ORCPT ); Fri, 13 Aug 2021 12:07:34 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R441e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=xianting.tian@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0UiuMApe_1628870823; Received: from 30.212.146.149(mailfrom:xianting.tian@linux.alibaba.com fp:SMTPD_---0UiuMApe_1628870823) by smtp.aliyun-inc.com(127.0.0.1); Sat, 14 Aug 2021 00:07:05 +0800 Subject: Re: [PATCH v6 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: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org References: <20210812094532.145497-2-xianting.tian@linux.alibaba.com> <202108122040.lBf24DNp-lkp@intel.com> <0c808001-7643-fdcf-66ba-738654ec0c21@kernel.org> From: Xianting TIan Message-ID: <9f6b0b31-b2fd-0706-b40f-d7ffc5c48737@linux.alibaba.com> Date: Sat, 14 Aug 2021 00:07:03 +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: <0c808001-7643-fdcf-66ba-738654ec0c21@kernel.org> 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/13 下午1:53, Jiri Slaby 写道: > Hi, > > On 12. 08. 21, 14:26, kernel test robot wrote: >>>> drivers/tty/hvc/hvc_console.c:190:26: warning: variable 'hp' is >>>> uninitialized when used here [-Wuninitialized] >>             spin_unlock_irqrestore(&hp->c_lock, flags); >>                                     ^~ >>     drivers/tty/hvc/hvc_console.c:149:23: note: initialize the >> variable 'hp' to silence this warning >>             struct hvc_struct *hp; >>                                  ^ >>                                   = NULL > > So you clearly didn't test your change as it would crash quite > instantly. I wonder, where do you intend to get hp from in the > console::print() hook? > > thanks, According to analysis, this issue may can be solved just by adjust the alignment to L1_CACHE_BYTES: 
 #define __ALIGNED__ __attribute__((__aligned__(L1_CACHE_BYTES))) Our analysis as below, the original __ALIGNED__ is sizeof(long) which is 8 for 64bit cpu. char c[N_OUTBUF] __ALIGNED__; //c[16] __ALIGNED__; For 4K page, c[16] may cross the page when alignemnt is 8. In the case the physical address of c[16] is noncontiguous. |------8----|..........|-----8-----|    PAGE_1 ..........................|-----------16----------| c[16]
 .........................................|-----8-----|.............|-----8-----| PAGE_2 But when the alignment is L1_CACHE_BYTES(eg, 64), or at least N_OUTBUF(16), we have no dma issue as c[16] won't cross the page, the physical address of c[16] is contiguous. |--------64--------|.........|--------64---------| PAGE_3 ..................................|--c[16]--| Could you help comments this?  thanks