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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no 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 92CDBC4338F for ; Fri, 13 Aug 2021 16:07:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76FF560FC4 for ; Fri, 13 Aug 2021 16:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241431AbhHMQHf (ORCPT ); Fri, 13 Aug 2021 12:07:35 -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 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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no 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 DAF87C4338F for ; Fri, 13 Aug 2021 16:07:40 +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 3D0AB60FBF for ; Fri, 13 Aug 2021 16:07:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3D0AB60FBF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com 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 4GmT3Z4TdRz3cQr for ; Sat, 14 Aug 2021 02:07:38 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.130; helo=out30-130.freemail.mail.aliyun.com; envelope-from=xianting.tian@linux.alibaba.com; receiver=) Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4GmT354tDYz2yLg for ; Sat, 14 Aug 2021 02:07:10 +1000 (AEST) 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 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 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: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 在 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============5493839010941228890==" MIME-Version: 1.0 From: Xianting TIan To: kbuild-all@lists.01.org Subject: Re: [PATCH v6 1/2] tty: hvc: pass DMA capable memory to put_chars() Date: Sat, 14 Aug 2021 00:07:03 +0800 Message-ID: <9f6b0b31-b2fd-0706-b40f-d7ffc5c48737@linux.alibaba.com> In-Reply-To: <0c808001-7643-fdcf-66ba-738654ec0c21@kernel.org> List-Id: --===============5493839010941228890== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable =E5=9C=A8 2021/8/13 =E4=B8=8B=E5=8D=881:53, Jiri Slaby =E5=86=99=E9=81=93: > 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] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 spin_= unlock_irqrestore(&hp->c_lock, flags); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^~ >> =C2=A0=C2=A0=C2=A0 drivers/tty/hvc/hvc_console.c:149:23: note: initializ= e the = >> variable 'hp' to silence this warning >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struc= t hvc_struct *hp; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =3D 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: =E2=80=A8 #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-----|=C2=A0=C2=A0=C2=A0 PAGE_1 ..........................|-----------16----------| c[16]=E2=80=A8 .........................................|-----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?=C2=A0 thanks --===============5493839010941228890==--