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==--