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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 B454FC19759 for ; Fri, 2 Aug 2019 02:15:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 8052E2080C for ; Fri, 2 Aug 2019 02:15:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BxGQwaos"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=brainfault-org.20150623.gappssmtp.com header.i=@brainfault-org.20150623.gappssmtp.com header.b="dkfm3YUW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8052E2080C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=brainfault.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LQ636zgZVHWxVAi0eLNRhoevw94UiCysfdYbR2uySUo=; b=BxGQwaosepVnkN ttPB7aOsA9K4AFfEFCb8bEwEBJ0YKYLFXzIghsRmYi3nH0qmqh1eOqRrXA77ZBm/CFeiAaRfBL5QP X72oAaxXCccESedtJ09CDjMA3pW6eZgo0W6hZmnTkdlOodwe0ukTl1Z+SxCvglj6Yp9rAqj3xE9QJ av2HGTlmYzhxYnjNZ4ALgm7GwE281CEbayQ76x+pLCNPJ+hkmmTGpPiACJMYyfFB2EE7Hq5FqjN8k fdokTrM4HvVFW376LvIw7hqBQ3hFjxjVmOiWxzHF8ZGEsve5g8uQ94Ii5KTDDvmkYczIRlG80Qzr2 ujD7+SbEkmZo9RFJ+XgA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1htN6e-0007lb-Jw; Fri, 02 Aug 2019 02:15:44 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1htN6a-0007ki-VH for linux-riscv@lists.infradead.org; Fri, 02 Aug 2019 02:15:42 +0000 Received: by mail-wr1-x442.google.com with SMTP id r1so75494871wrl.7 for ; Thu, 01 Aug 2019 19:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=/75YpogZ7MavM1rM5AwCI4fwCcwz0rXx/M91/3Zlk4w=; b=dkfm3YUWpIbKcmnDtOBnwc5tJm4Q/9z1ESvx9FnBhj68sSauXIhFEa3StTpyTQeMD9 5uwuhfCAgo3H9EET+EiQINbSeT98V9CZjgvlmsyEgx1m32FIQSh62sIZNANW0NWDCLSw 0m1aRb1HCKPASUmrTlnkC7y6ICBgTfxZFzbPsUmOt6GR7K7E/f2v9L3lilmWSQmRsl6N KGEMerFnfS5GF22Dtv4K28p2nww+1NyCDd2jawhylvRXc2EaRBUH+mPYyWyKrGXGerS0 lrbOtoEXN/is0G0zUU/l6ERrg1Zr2/z7QJfruQqqGnr/QNLsoQZQZOYV+t1TgfeBzkQn g2Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=/75YpogZ7MavM1rM5AwCI4fwCcwz0rXx/M91/3Zlk4w=; b=H+LAI3ZjYfbRtNC4vweFcSe21PAvKVurs/HYkl52uNuj4xlAvwMWymxKrcZk8HjvxM k4veANbDhApMSi90Xr4v6saOKjGzW7FAQj9OjwpaiQwvjRLyx5I54Ys44BL/Vg4VnDie yi+AweUZxJ23dstsa0qI38WF0KAz9cNnP+IwQ6K8Kn3MSi+TJZm5UtfelLQpf+7lQdDY y4cPfNP8ev7JkVmZRbsPGGaOu57tYPFiIoybeh6Y4+8EP7az/0v4HT2l5oCYOWrjACIc 9Wo+FaFJ7HSd1IgCw2XfSnbjljTigUngV2/XSS2Rl1RTPKD5mp8xx1kSBH8DpNu4ar4G bs1Q== X-Gm-Message-State: APjAAAVi2Zo32FistQ258e15PV9itz4XxsgJnlmnO73jhf0R1Pgi3PNE 6P9E7BEDe+zAe7j2iDioJpF+VQ8m6p8k+f+dObk= X-Google-Smtp-Source: APXvYqyyoyWJ7ZhC7D/LbbQRKxQeIkWUHjdQzvCoUtAuJHjio2QmUYXSO9VgrmM6UkPjx0HbvLKuNAtx48Wj76rWJBc= X-Received: by 2002:a5d:6b11:: with SMTP id v17mr65936769wrw.323.1564712138571; Thu, 01 Aug 2019 19:15:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Anup Patel Date: Fri, 2 Aug 2019 07:45:27 +0530 Message-ID: Subject: Re: Random memory corruption with v5.2 To: Andreas Schwab X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190801_191541_149944_467218C3 X-CRM114-Status: GOOD ( 13.35 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-riscv , David Abdurachmanov , OpenSBI , Paul Walmsley Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, Aug 2, 2019 at 12:02 AM Andreas Schwab wrote: > > On Jul 30 2019, Paul Walmsley wrote: > > > On Tue, 30 Jul 2019, Andreas Schwab wrote: > > > >> On Jul 30 2019, David Abdurachmanov wrote: > >> > >> > On Mon, Jul 29, 2019 at 1:51 PM Andreas Schwab wrote: > >> >> > >> >> Since switching to 5.2 kernels I'm seeing random crashes and > >> >> misbehaviors on the HiFive, for example while building gcc or glibc. > >> >> Perhaps missing TLB flushes? > >> > > >> > Do you have some examples of crashes? > >> > >> While building glibc: > >> > >> an_ES.UTF-8...realloc(): invalid pointer > >> /bin/sh: line 1: 7841 Aborted (core dumped) I18NPATH=. GCONV_PATH=/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/iconvdata LC_ALL=C /home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/elf/ld-linux-riscv64-lp64d.so.1 --library-path /home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base:/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/math:/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/elf:/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/dlfcn:/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/nss:/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/nis:/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/rt:/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/resolv:/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/mathvec:/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/support:/home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/nptl /home/abuild/rpmbuild/BUILD/glibc-2.29/cc-base/locale/localedef $flags --alias-file=../intl/locale.alias -i locales/$input -f charmaps/$charset --prefix=/home/abuild/rpmbuild/BUIL DROOT/glibc-2.29-0.riscv64 $locale > >> make[2]: *** [Makefile:422: install-archive-an_ES.UTF-8/UTF-8] Error 134 > >> > >> While building gcc: > >> > >> ../../gcc/ada/exp_aggr.adb: In function 'Exp_Aggr.Expand_N_Aggregate': > >> ../../gcc/ada/exp_aggr.adb:5311:21: warning: 'Csiz' may be used uninitialized in this function [-Wmaybe-uninitialized] > >> ../../gcc/ada/exp_aggr.adb:5220:10: note: 'Csiz' was declared here > >> +===========================GNAT BUG DETECTED==============================+ > >> | 10.0.0 20190727 (experimental) [trunk revision 273844] (riscv64-suse-linux) | > >> | Storage_Error stack overflow or erroneous memory access | > >> | Error detected at output.ads:39:8 | > >> realloc(): invalid pointer > > > > I personally haven't seen these issues; but then again, I haven't done any > > glibc or gcc builds on v5.2. Will take a closer look. > > I think there is some fundamental problem with SBI_REMOTE_SFENCE_VMA or > the kernel interface to it. > > For exmaple, flush_tlb_page is defined as: > > #define flush_tlb_page(vma, addr) flush_tlb_range(vma, addr, 0) > > But the third argument of flush_tlb_range is supposed to be the end > address, so this should actually be: > > #define flush_tlb_page(vma, addr) flush_tlb_range(vma, addr, (addr) + PAGE_SIZE) Instead of this can you try -1UL as the size: #define flush_tlb_page(vma, addr) flush_tlb_range(vma, addr, -1UL) If above works for you then there is some issue with range of virtual memory we flush. Regards, Anup _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv