Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp931485imm; Wed, 8 Aug 2018 08:04:13 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxMGwaQ2H0lZSlyIj14lvBO3XMR4Eh3R2P6pFXMG8Y4Cr9/kRz+dD5NMj00G7RasqcOsJH9 X-Received: by 2002:a17:902:1a2:: with SMTP id b31-v6mr2879773plb.279.1533740653172; Wed, 08 Aug 2018 08:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533740653; cv=none; d=google.com; s=arc-20160816; b=GwqCH3xvJEY/XS+S4BlPKbAJngQtqPyKVzzbceC3K6GbCg8JFm5vD0y84p59LlUWGm S0QsDkp7CXR3w+d0CMin6j0Qpx28cAnmr3wLVWwucgZs6gO/waDmaUfL1yf8uK9jkkcv 9G/Q4yHA8coiOgEsjcPPIEb8A3bbr1rO63L1sSwrhSvHIlfX5Dib57RJx9Thf77utLAO 94c2xSZNRHJ0bGJc7TG60Ad/07QrDVul33eB5tfQPXKsE7re4C2IyWxHzWlaDOD0jq7I P/V5GRVM85wJF725+j3Cl1lLkz1Mum7K9TDc7uP5mYE0k0nnI7sZ0M6xWfSSYhEpLL1d tEsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=IbEa25aDm4axjY1IVpWSpCMhVaxb10LgmLW+ldHAyyY=; b=HYxwJSxHF7DpiHUlZY/Oprm4sxMawQD8PBEUJ75ig7UCESWnhk6p6+o54wENfyTWUH PVjMQYGnRP74lwnrruXrWoTfo8q7X0xcHbZXFI5KzVedySKd9m8RzBn+o3UgSx9Qv4e1 gh38re73/0ErmwI9uIVdIxwxJFWqpcEFCFII4CbyUiIhnP6IuN7BRtWrsO69ncscIjqT VMudRBCUbs+rg5DTTPQ6EvjNX4jkq9edce6eg+tGn3SmYVsgSDdYKyYXU1/9tdcJIsNI t38nyt8seis/5LYOMgIzO7Ap3EHWwgYoPyCl3UZvHA8tftD4Z71/PZSom48SsNXBMjda vGsA== 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 x68-v6si4489286pfc.239.2018.08.08.08.03.56; Wed, 08 Aug 2018 08:04:13 -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 S1727472AbeHHRVT (ORCPT + 99 others); Wed, 8 Aug 2018 13:21:19 -0400 Received: from foss.arm.com ([217.140.101.70]:40342 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726954AbeHHRVT (ORCPT ); Wed, 8 Aug 2018 13:21:19 -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 6717D18A; Wed, 8 Aug 2018 08:01:16 -0700 (PDT) Received: from e120077-lin.cambridge.arm.com (e120077-lin.cambridge.arm.com [10.2.207.74]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5A8B3F5D4; Wed, 8 Aug 2018 08:01:13 -0700 (PDT) Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 To: Mikulas Patocka , 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 References: <20180803094129.GB17798@arm.com> <20180808113927.GA24736@iMac.local> From: "Richard Earnshaw (lists)" Openpgp: preference=signencrypt Message-ID: Date: Wed, 8 Aug 2018 16:01:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > Mikulas > 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? 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. R.