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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D09EEE14DB for ; Thu, 7 Sep 2023 10:50:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A8664440186; Thu, 7 Sep 2023 06:50:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A38648E000F; Thu, 7 Sep 2023 06:50:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8FDF3440186; Thu, 7 Sep 2023 06:50:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7AC268E000F for ; Thu, 7 Sep 2023 06:50:08 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 32689C11A6 for ; Thu, 7 Sep 2023 10:50:08 +0000 (UTC) X-FDA: 81209481696.21.1C66EA4 Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) by imf09.hostedemail.com (Postfix) with ESMTP id 6996A14000A for ; Thu, 7 Sep 2023 10:50:06 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=EVYmNiAz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of prabhakar.csengg@gmail.com designates 209.85.166.49 as permitted sender) smtp.mailfrom=prabhakar.csengg@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694083806; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=brKbRdx1kpGoO2Y9NjS4SFjuuPU0IFk1738Z4hW7QPE=; b=v17jKd0V4yDqc+r5DxXLLuwFOZz3+SdG7Q9lW50lxQ4IspFpk2xWtH6IJyuEch2uPyAADn 0CZWcAdq6wttzAZ18XqIT4EVN7u0cK9RvZjOyJ4bKln3xzXaR8Fth6sv4+FOsHl5kdgRO9 OcpBSuRnv22snY/kcEA2VZQ4MCm3VWk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=EVYmNiAz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of prabhakar.csengg@gmail.com designates 209.85.166.49 as permitted sender) smtp.mailfrom=prabhakar.csengg@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694083806; a=rsa-sha256; cv=none; b=n+Nr6oVmq7nAY+OPnVavbgFjAc4mnqgIzKG4fTlihRMLS8nnwcbpt0sJC6IfgAKj1xArqM /ZFhpp+41Z7volDw1yy/Gzx6KP36UY149lf70+PGu2aoH+WB8z4RvuWzpp/xfIXnJbZeNc EnfhjHNQZdfd+g9LV3eQNOakoF1rqiE= Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-79329a8f78bso34697939f.3 for ; Thu, 07 Sep 2023 03:50:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694083805; x=1694688605; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=brKbRdx1kpGoO2Y9NjS4SFjuuPU0IFk1738Z4hW7QPE=; b=EVYmNiAziitNV5+s8Io4NM44c9N7l0MXyT3RJxnJE2quzDVOV1LOVsxUqOQwUV0DhF ajN1A8b25NPAr0GuBBNjsq53KdgvgjOtlM04C+46sDeyCtXrPIAd/eJoKEvohyDXZoaF vJaA2+nPBUgz0B8F0WXStn00NpT5YT24KMF4nmExcRSjcdyapAKFDkQqQQ4FuiTIAEQ7 3gYGuEAG2bfpJoJ0Nfpsa9kgqRWFTjtXwadlTG/JgJ8fcnh74VAEiYmS8MLW7QtDRgv4 Sv2sN8KcOWRvYmwV2wC5rQ99E6HUHZsuLFQ9ocVcDF9pePbRnMN7MDrFuY3klS5NNyK8 yzgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694083805; x=1694688605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=brKbRdx1kpGoO2Y9NjS4SFjuuPU0IFk1738Z4hW7QPE=; b=g4cqVRgx1GOKRqnurEIukfAKCiUzHlwKxhzhQ6feFUVtsgEbXdZkueaFr/gUB9PvpA z8Et9NFCMQ1m7STmIfkz05GZJcEu0lumtdbBUEmOEN7wNm6NyCgMOoIwCLkOJeZZLUQ3 sj53xXgr5xgSzTj7hw6AkG15Fq7r4wfjImmbZ05oD8wc2zlADmeYC/ChnOjg/5k7jHl9 T5nVSk8wAqR4jbTg2hQJx9y8N4hgfZx7lZY/RrBoVzsDzvJGefDGoL5ScG3dzg19lpvp KUWvA3/gPJZRyfbuqo4OVTjNcQSjillgNwkJqNWbp+bBNfWbm6iQeMUx6P7iIf/Jv78Y 5Tpg== X-Gm-Message-State: AOJu0YzRBQpjr57M/p3jXgimzSxmJ05O/vWNOfdULWaLwugayv8e6GjQ f2I3pVIBIbaYISeWuIY4jvqNvmc9j14mIhWFyFc= X-Google-Smtp-Source: AGHT+IEB2hO+TGGIAGO65G3+5LgFgJwUd0dqMX6Dw9arpoFxlY11pB1Z3e5xVZisoM3mAw7p9kKP6mypD/66ucf4p3s= X-Received: by 2002:a6b:d315:0:b0:787:ff98:c38c with SMTP id s21-20020a6bd315000000b00787ff98c38cmr21570759iob.10.1694083805330; Thu, 07 Sep 2023 03:50:05 -0700 (PDT) MIME-Version: 1.0 References: <20230801085402.1168351-1-alexghiti@rivosinc.com> <20230801085402.1168351-5-alexghiti@rivosinc.com> In-Reply-To: From: "Lad, Prabhakar" Date: Thu, 7 Sep 2023 11:49:03 +0100 Message-ID: Subject: Re: [PATCH v3 4/4] riscv: Improve flush_tlb_kernel_range() To: Alexandre Ghiti Cc: Geert Uytterhoeven , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , Mayuresh Chitale , Vincent Chen , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Stat-Signature: 6ex4caz7d5apec5cggyybodftmx8qdo1 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6996A14000A X-HE-Tag: 1694083806-344340 X-HE-Meta: U2FsdGVkX18Myc0DGOYFApriqx6G1gCDVRMM+IvskA/VxLvhIXO6QepALh8oPokvgcCus/mdwygGbObzToHxMVkql2ldPX0THBhIBJPypZtACQGlhW+A0v2A9Q3PysUSwfmGSxrEVJ98MXchoOuztxIbOsPI7HdlQC7BJdOqDMeI3LvWk6cOi9AD6EIsAjz/CRwIIVkfSELeJHl9laOPwCObscc7W9+uO9AEbVB8hZvNQgEGJXVKUKTW+dy938CUG7+P/MTtMU7DP7JAiYAtza4PDfDLga/MthxE/WFvydf2+JrARLx/5Ddiq00auOyUSTGnyKUGO5QO7s4IMNgZ8U6MM9ABLFBNUtyrnPl9FBNGW3TqCLv5EgoSuvrbICZ1PeW4RUgOJKdPWddevmCZbyQMA3UL0hDVEjhA8Ec5/mmoEsAeSjXc+Sj/RcI1GRkuoStx5l5N0zaJcNS+WYQ5tJghDoDHjlBFDwJwCO05LE5gbaOOIG//P4aOUB+BwOL+dE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Wr/UU+MbXp1c5kr5xE/qNtSVsnYx5MzRPilnN6EsxlgRaPo39vEcMCQKJya9ZvpJVWrZB39RQhhZeH3vSxA2Ya1Rs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Alexandre, On Thu, Sep 7, 2023 at 10:06=E2=80=AFAM Alexandre Ghiti wrote: > > Hi Prabhakar, > > On Wed, Sep 6, 2023 at 3:55=E2=80=AFPM Lad, Prabhakar > wrote: > > > > Hi Alexandre, > > > > On Wed, Sep 6, 2023 at 1:43=E2=80=AFPM Alexandre Ghiti wrote: > > > > > > On Wed, Sep 6, 2023 at 2:24=E2=80=AFPM Lad, Prabhakar > > > wrote: > > > > > > > > Hi Alexandre, > > > > > > > > On Wed, Sep 6, 2023 at 1:18=E2=80=AFPM Alexandre Ghiti wrote: > > > > > > > > > > On Wed, Sep 6, 2023 at 2:09=E2=80=AFPM Lad, Prabhakar > > > > > wrote: > > > > > > > > > > > > Hi Alexandre, > > > > > > > > > > > > On Wed, Sep 6, 2023 at 1:01=E2=80=AFPM Alexandre Ghiti wrote: > > > > > > > > > > > > > > Hi Prabhakar, > > > > > > > > > > > > > > On Wed, Sep 6, 2023 at 1:49=E2=80=AFPM Lad, Prabhakar > > > > > > > wrote: > > > > > > > > > > > > > > > > Hi Alexandre, > > > > > > > > > > > > > > > > On Tue, Aug 1, 2023 at 9:58=E2=80=AFAM Alexandre Ghiti wrote: > > > > > > > > > > > > > > > > > > This function used to simply flush the whole tlb of all h= arts, be more > > > > > > > > > subtile and try to only flush the range. > > > > > > > > > > > > > > > > > > The problem is that we can only use PAGE_SIZE as stride s= ince we don't know > > > > > > > > > the size of the underlying mapping and then this function= will be improved > > > > > > > > > only if the size of the region to flush is < threshold * = PAGE_SIZE. > > > > > > > > > > > > > > > > > > Signed-off-by: Alexandre Ghiti > > > > > > > > > Reviewed-by: Andrew Jones > > > > > > > > > --- > > > > > > > > > arch/riscv/include/asm/tlbflush.h | 11 +++++----- > > > > > > > > > arch/riscv/mm/tlbflush.c | 34 +++++++++++++++++= ++++++-------- > > > > > > > > > 2 files changed, 31 insertions(+), 14 deletions(-) > > > > > > > > > > > > > > > > > After applying this patch, I am seeing module load issues o= n RZ/Five > > > > > > > > (complete log [0]). I am testing defconfig + [1] (rz/five r= elated > > > > > > > > configs). > > > > > > > > > > > > > > > > Any pointers on what could be an issue here? > > > > > > > > > > > > > > Can you give me the exact version of the kernel you use? The = trap > > > > > > > addresses are vmalloc addresses, and a fix for those landed v= ery late > > > > > > > in the release cycle. > > > > > > > > > > > > > I am using next-20230906, Ive pushed a branch [1] for you to ha= ve a look. > > > > > > > > > > > > [0] https://github.com/prabhakarlad/linux/tree/rzfive-debug > > > > > > > > > > Great, thanks, I had to get rid of this possibility :) > > > > > > > > > > As-is, I have no idea, can you try to "bisect" the problem? I mea= n > > > > > which patch in the series leads to those traps? > > > > > > > > > Oops sorry for not mentioning earlier, this is the offending patch > > > > which leads to the issues seen on rz/five. > > > > > > Ok, so at least I found the following problem, but I don't see how > > > that could fix your issue: can you give a try anyway? I keep looking > > > into this, thanks > > > > > > diff --git a/arch/riscv/mm/tlbflush.c b/arch/riscv/mm/tlbflush.c > > > index df2a0838c3a1..b5692bc6c76a 100644 > > > --- a/arch/riscv/mm/tlbflush.c > > > +++ b/arch/riscv/mm/tlbflush.c > > > @@ -239,7 +239,7 @@ void flush_tlb_range(struct vm_area_struct *vma, > > > unsigned long start, > > > > > > void flush_tlb_kernel_range(unsigned long start, unsigned long end) > > > { > > > - __flush_tlb_range(NULL, start, end, PAGE_SIZE); > > > + __flush_tlb_range(NULL, start, end - start, PAGE_SIZE); > > > } > > > > > I am able to reproduce the issue with the above change too. > > I can't reproduce the problem on my Unmatched or Qemu, so it is not > easy to debug. But I took another look at your traces and something is > weird to me. In the following trace (and there is another one), the > trap is taken at 0xffffffff015ca034, which is the beginning of > rz_ssi_probe(): that's a page fault, so no translation was found (or > an invalid one is cached). > > [ 16.586527] Unable to handle kernel paging request at virtual > address ffffffff015ca034 > [ 16.594750] Oops [#3] > ... > [ 16.622000] epc : rz_ssi_probe+0x0/0x52a [snd_soc_rz_ssi] > ... > [ 16.708697] status: 0000000200000120 badaddr: ffffffff015ca034 > cause: 000000000000000c > [ 16.716580] [] rz_ssi_probe+0x0/0x52a > [snd_soc_rz_ssi] > ... > > But then here we are able to read the code at this same address: > [ 16.821620] Code: 0109 6597 0000 8593 5f65 7097 7f34 80e7 7aa0 b7a9 > (7139) f822 > > So that looks like a "transient" error. Do you know if you uarch > caches invalid TLB entries? If you don't know, I have just written > some piece of code to determine if it does, let me know. > No I dont, can you please share the details so that I can pass on the information to you. > Do those errors always happen? > Yes they do. Cheers, Prabhakar