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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham 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 D15FFC4646D for ; Wed, 8 Aug 2018 14:12:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 922CE21990 for ; Wed, 8 Aug 2018 14:12:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 922CE21990 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727518AbeHHQcS (ORCPT ); Wed, 8 Aug 2018 12:32:18 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33140 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727109AbeHHQcS (ORCPT ); Wed, 8 Aug 2018 12:32:18 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B212E819701A; Wed, 8 Aug 2018 14:12:27 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A503B1C723; Wed, 8 Aug 2018 14:12:27 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id w78ECRiC010619; Wed, 8 Aug 2018 10:12:27 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w78ECREE010616; Wed, 8 Aug 2018 10:12:27 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 8 Aug 2018 10:12:27 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Catalin Marinas cc: Will Deacon , Jingoo Han , Joao Pinto , Thomas Petazzoni , libc-alpha@sourceware.org, Ard Biesheuvel , Russell King , Linux Kernel Mailing List , Matt Sealey , linux-pci@vger.kernel.org, linux-arm-kernel Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 In-Reply-To: <20180808113927.GA24736@iMac.local> Message-ID: References: <20180803094129.GB17798@arm.com> <20180808113927.GA24736@iMac.local> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 08 Aug 2018 14:12:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 08 Aug 2018 14:12:27 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mpatocka@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 8 Aug 2018, Catalin Marinas wrote: > On Fri, Aug 03, 2018 at 01:09:02PM -0400, Mikulas Patocka wrote: > > while (1) { > > start = (unsigned)random() % (LEN + 1); > > end = (unsigned)random() % (LEN + 1); > > if (start > end) > > continue; > > for (i = start; i < end; i++) > > data[i] = val++; > > memcpy(map + start, data + start, end - start); > > if (memcmp(map, data, LEN)) { > > It may be worth trying to do a memcmp(map+start, data+start, end-start) > here to see whether the hazard logic fails when the writes are unaligned > but the reads are not. > > This problem may as well appear if you do byte writes and read longs > back (and I consider this a hardware problem on this specific board). I triad to insert usleep(10000) between the memcpy and memcmp, but the same corruption occurs. So, it can't be read-after-write hazard. It is caused by the improper handling of hazard between the overlapping writes inside memcpy. Mikulas From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: Date: Wed, 8 Aug 2018 10:12:27 -0400 (EDT) From: Mikulas Patocka To: Catalin Marinas Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 In-Reply-To: <20180808113927.GA24736@iMac.local> Message-ID: References: <20180803094129.GB17798@arm.com> <20180808113927.GA24736@iMac.local> MIME-Version: 1.0 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Joao Pinto , libc-alpha@sourceware.org, Ard Biesheuvel , Jingoo Han , Will Deacon , Russell King , Linux Kernel Mailing List , Matt Sealey , linux-pci@vger.kernel.org, linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+bjorn=helgaas.com@lists.infradead.org List-ID: On Wed, 8 Aug 2018, Catalin Marinas wrote: > On Fri, Aug 03, 2018 at 01:09:02PM -0400, Mikulas Patocka wrote: > > while (1) { > > start = (unsigned)random() % (LEN + 1); > > end = (unsigned)random() % (LEN + 1); > > if (start > end) > > continue; > > for (i = start; i < end; i++) > > data[i] = val++; > > memcpy(map + start, data + start, end - start); > > if (memcmp(map, data, LEN)) { > > It may be worth trying to do a memcmp(map+start, data+start, end-start) > here to see whether the hazard logic fails when the writes are unaligned > but the reads are not. > > This problem may as well appear if you do byte writes and read longs > back (and I consider this a hardware problem on this specific board). I triad to insert usleep(10000) between the memcpy and memcmp, but the same corruption occurs. So, it can't be read-after-write hazard. It is caused by the improper handling of hazard between the overlapping writes inside memcpy. Mikulas _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: mpatocka@redhat.com (Mikulas Patocka) Date: Wed, 8 Aug 2018 10:12:27 -0400 (EDT) Subject: framebuffer corruption due to overlapping stp instructions on arm64 In-Reply-To: <20180808113927.GA24736@iMac.local> References: <20180803094129.GB17798@arm.com> <20180808113927.GA24736@iMac.local> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, 8 Aug 2018, Catalin Marinas wrote: > On Fri, Aug 03, 2018 at 01:09:02PM -0400, Mikulas Patocka wrote: > > while (1) { > > start = (unsigned)random() % (LEN + 1); > > end = (unsigned)random() % (LEN + 1); > > if (start > end) > > continue; > > for (i = start; i < end; i++) > > data[i] = val++; > > memcpy(map + start, data + start, end - start); > > if (memcmp(map, data, LEN)) { > > It may be worth trying to do a memcmp(map+start, data+start, end-start) > here to see whether the hazard logic fails when the writes are unaligned > but the reads are not. > > This problem may as well appear if you do byte writes and read longs > back (and I consider this a hardware problem on this specific board). I triad to insert usleep(10000) between the memcpy and memcmp, but the same corruption occurs. So, it can't be read-after-write hazard. It is caused by the improper handling of hazard between the overlapping writes inside memcpy. Mikulas