diff mbox

[v7,1/5] arm64: Enable EDAC on ARM64

Message ID 1430259045-19012-2-git-send-email-lho@apm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Loc Ho April 28, 2015, 10:10 p.m. UTC
Add an stub atomic_scrub and enable EDAC for arm64.

Signed-off-by: Loc Ho <lho@apm.com>
---
 arch/arm64/Kconfig            |    1 +
 arch/arm64/include/asm/edac.h |   31 +++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm64/include/asm/edac.h

Comments

Catalin Marinas April 29, 2015, 2:40 p.m. UTC | #1
On Tue, Apr 28, 2015 at 04:10:41PM -0600, Loc Ho wrote:
> --- /dev/null
> +++ b/arch/arm64/include/asm/edac.h
> @@ -0,0 +1,31 @@
> +/*
> + * ARM64 EDAC Header File 
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +#ifndef ASM_EDAC_H
> +#define ASM_EDAC_H

For consistency, please use __ASM_EDAC_H.

> +/*
> + * ECC atomic, DMA, SMP and interrupt safe scrub function.
> + * Implements the per arch atomic_scrub() that EDAC use for software
> + * ECC scrubbing.  It reads memory and then writes back the original
> + * value, allowing the hardware to detect and correct memory errors.
> + */

The comment here is misleading since the function doesn't do anything.

> +static inline void atomic_scrub(void *va, u32 size)
> +{
> +	/* Stub function for now until an ARM64 HW has a way to test it. */
> +}

Can we have a WARN_ONCE() here?

We had some discussions last year, restarted this year and the
conclusion was to leave this function as a no-op since it is not safe in
the presence of KVM or non-coherent DMA:

http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/326986.html
Jon Masters April 29, 2015, 2:46 p.m. UTC | #2
On 04/29/2015 10:40 AM, Catalin Marinas wrote:
> On Tue, Apr 28, 2015 at 04:10:41PM -0600, Loc Ho wrote:

>> +/*
>> + * ECC atomic, DMA, SMP and interrupt safe scrub function.
>> + * Implements the per arch atomic_scrub() that EDAC use for software
>> + * ECC scrubbing.  It reads memory and then writes back the original
>> + * value, allowing the hardware to detect and correct memory errors.
>> + */
> 
> The comment here is misleading since the function doesn't do anything.

Well, on the other hand, it is "safe" (joke) ;)

Suggest a documented few line summary of the status from earlier this
year/last year be there instead. Essentially atomic scrubbing is only
safe when you're dealing with a fully coherent system. We captured
various examples of things that could go wrong in the thread link.

> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/326986.html

Thanks Loc and team.

Jon.
Loc Ho April 29, 2015, 9:39 p.m. UTC | #3
Hi,

>> +/*
>> + * ECC atomic, DMA, SMP and interrupt safe scrub function.
>> + * Implements the per arch atomic_scrub() that EDAC use for software
>> + * ECC scrubbing.  It reads memory and then writes back the original
>> + * value, allowing the hardware to detect and correct memory errors.
>> + */
>
> The comment here is misleading since the function doesn't do anything.

Okay.. I will leave only this line:

ECC atomic, DMA, SMP and interrupt safe scrub function.

>> +static inline void atomic_scrub(void *va, u32 size)
>> +{
>> +     /* Stub function for now until an ARM64 HW has a way to test it. */
>> +}
>
> Can we have a WARN_ONCE() here?
>
> We had some discussions last year, restarted this year and the
> conclusion was to leave this function as a no-op since it is not safe in
> the presence of KVM or non-coherent DMA:
>
> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/326986.html

I will leave WARN_ONCE.

-Loc
diff mbox

Patch

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 4269dba..577078f 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -22,6 +22,7 @@  config ARM64
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select EDAC_SUPPORT
 	select CPU_PM if (SUSPEND || CPU_IDLE)
 	select DCACHE_WORD_ACCESS
 	select GENERIC_ALLOCATOR
diff --git a/arch/arm64/include/asm/edac.h b/arch/arm64/include/asm/edac.h
new file mode 100644
index 0000000..1cedba6
--- /dev/null
+++ b/arch/arm64/include/asm/edac.h
@@ -0,0 +1,31 @@ 
+/*
+ * ARM64 EDAC Header File 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef ASM_EDAC_H
+#define ASM_EDAC_H
+
+/*
+ * ECC atomic, DMA, SMP and interrupt safe scrub function.
+ * Implements the per arch atomic_scrub() that EDAC use for software
+ * ECC scrubbing.  It reads memory and then writes back the original
+ * value, allowing the hardware to detect and correct memory errors.
+ */
+static inline void atomic_scrub(void *va, u32 size)
+{
+	/* Stub function for now until an ARM64 HW has a way to test it. */
+}
+
+#endif
+