Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp947102imm; Wed, 8 Aug 2018 08:16:45 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx7YeWRnXq9eUGmzoQjveEY6isp/dMErrvtc3qLa71XiSO4rpUsNJC9JwTB1/LsH6ki+Ex3 X-Received: by 2002:a63:7558:: with SMTP id f24-v6mr3071964pgn.314.1533741405695; Wed, 08 Aug 2018 08:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533741405; cv=none; d=google.com; s=arc-20160816; b=eDM7A3FacnHRp/twVQ/ShjMXZJ8paaWWw7x+PiYG0bNhwJBN9DFoTfZ8RfnCLxqCK3 cf/ojrSmphc4VigkaMW6D6Prp7xeQIIEkjlX2/LNiGj9VjVb3swQrcNA+svV0ag2tjAR NaS6GhPkNCG0ogjnzNmGvMoUz2xoE4J68w7V+MKXEdG6YOHpV6vfLODzSmvSkBPn95HL PPiVB7CrHuhAGoMi9LUAFJUt8oK9cVhAPuWnwG+ztLEjcCiDQQPXKOHkdf3J9iQ6inW6 sIutNVFijYF1r6DF/L3nj+0/DONBPY2FMT06/Hus/JhZ+khqtEk/lcNG/9P0fCH0lnrE tn3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=2r5NoTNWCbpW00MVkF4qu8oxZq5csQR7H+mkVBntjTM=; b=oaU18rbvVcn4I7fP9OhVN+XaoNMXFQT8dKxHlo5B7TfBOQ2wQpwOsPJHvYfKo70Poy mO/mCOJtCuxzQ9rhqNkiZDORfTx08j2lm6m0NlpwO3k2up3Hz1WThGOguD282dDYGJ9M UsC/eNKo/DaeXkIgaesnhCTerxuS6drusPr8iZKMDAJZNAaX1hUL2AiFIijB8CIJRMqW GOchPCUg3VwOdeNOrqac29jXUpq5iElnQh/mZ6gamS1S5LaSEqTz5WC7KJEUu9PUqg+E Q+SzB9T+naROMr1jtZ1LYc/x7JIti7y+uUlO0EPYx91eAcIyDNjJxsR6aFHOUIq7I59o 2yNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o25-v6si4853630pfi.279.2018.08.08.08.16.30; Wed, 08 Aug 2018 08:16:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727472AbeHHRe4 (ORCPT + 99 others); Wed, 8 Aug 2018 13:34:56 -0400 Received: from foss.arm.com ([217.140.101.70]:40534 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726875AbeHHRe4 (ORCPT ); Wed, 8 Aug 2018 13:34:56 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 59A3C18A; Wed, 8 Aug 2018 08:14:50 -0700 (PDT) Received: from iMac.local (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 180543F5D4; Wed, 8 Aug 2018 08:14:47 -0700 (PDT) Date: Wed, 8 Aug 2018 16:14:45 +0100 From: Catalin Marinas To: "Richard Earnshaw (lists)" Cc: Mikulas Patocka , 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 Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 Message-ID: <20180808151444.GF24736@iMac.local> References: <20180803094129.GB17798@arm.com> <20180808113927.GA24736@iMac.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 08, 2018 at 04:01:12PM +0100, Richard Earnshaw wrote: > On 08/08/18 15:12, Mikulas Patocka wrote: > > 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. > > I don't think you've told us what form the corruption takes. Does it > lose some bytes? Modify values beyond the copy range? Write completely > arbitrary values? From this message: https://lore.kernel.org/lkml/alpine.LRH.2.02.1808060553130.30832@file01.intranet.prod.int.rdu2.redhat.com/ - failing to write a few bytes - writing a few bytes that were written 16 bytes before - writing a few bytes that were written 16 bytes after > The overlapping writes in memcpy never write different values to the > same location, so I still feel this must be some sort of HW issue, not a > SW one. So do I (my interpretation is that it combines or rather skips some of the writes to the same 16-byte address as it ignores the data strobes). -- Catalin