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=-6.7 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 6BC76C4360C for ; Thu, 26 Sep 2019 16:24:14 +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 3EF4621D56 for ; Thu, 26 Sep 2019 16:24:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ndAfPpl+"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="AWRrGdXH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EF4621D56 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=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=FaOHku+iIT6jZeZOxLik//ztFNILJVr3hunLLZUMZ80=; b=ndAfPpl+3wOq4d CHjLglxdOJ0XaHKdTqdKdV+q+Oa99nhRIVQm2az94m/SoeWt88rpt3wIvdDG9/GsDQaIzJIQINl0F tff0zpkMbYB3SxqVV82+RRrEyTc2DE1kbWbN/cAxWHIQqsKZXZCE48uDTln1IxHoLSXDDZRd7u+Vo 4/zXkFyYkC7Lle3Iqx/m6irGdDARrOVMq4NQqQdGGRzETP8XeVFppY4VvyBQ5140BpdMEs8XmYR2Z 7h1OVnIDEDgmWGB/Le46xUZZbdcBAKedsBycTyqiNhJwpy2qhFARzOhe5ywkNB3R46Q5t1k1/Vbd6 cDFKRX9N9+VIxsDamBQg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iDWYo-0007qY-Tm; Thu, 26 Sep 2019 16:24:07 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iDWYl-0007o3-Ck for linux-arm-kernel@lists.infradead.org; Thu, 26 Sep 2019 16:24:04 +0000 Received: by mail-pf1-x441.google.com with SMTP id q7so2115296pfh.8 for ; Thu, 26 Sep 2019 09:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=o1tbaMq7T/ukWk3mtjnMcOjC8Q34znuuWkXOuJc+ANU=; b=AWRrGdXHoLy0Riqb0073AS7eedCai2Vnf+L0NuZ5iUtSvW8Ll3ne2bpW8y1u4ICN+X s3VLuNyuv9ndPU4+1ae57GO1aBwlS3nn7m9Jbm3ya9iIhG9cNmSIHrzg0nJlFr1ag9wS uJkGkEdyJqhM045BLt4HcFR8hsI4s2aiZMFJGFgvMa09Yb+2VKIPl1F3lCJjmtvWlMsr vN9VlYiGjx4O8QnB7QbzdIWHyqmry0R4eO2Ucyt+VWxVs1/8blxniD9L9blmDUttJNe4 2gtKDqHFrmuH61sDeKi34kA0nIIfxe623LuGsOyH/TuQb9GPQljJNHVR7p5pN3d0Z2QZ rLBQ== 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; bh=o1tbaMq7T/ukWk3mtjnMcOjC8Q34znuuWkXOuJc+ANU=; b=CvykWxEuF5kU+xACD3THPhEZhfzCqz+JuGbt6Vf6Uraa+ldf5e2Ejc8pwsXmN8aZyc X9fX7OGLML+45kAxI0Epv13ozhgHvQOhNR5enLzkQoJIhysqc4R9Qzn1sTUPi0z5BepT Tm712z1D2uyopkiXcs82fEqb2mToXfl5PRVcrX6Wq56kdNwu3iPalC13Eqae7Hk5n8MN L49dJOuCBP797Hntf+tOfWeICUrvTE3O/IU6SU/2RXjp4WAs/bkzHI6Hg4crCcHNoKvL 9ioEfSXtpcVACpuQ7FwUKvqFJNROienjwazLvx12OUZY4dnPo/LcGnbdGFo0iPK2vArP R/dw== X-Gm-Message-State: APjAAAUn74xOA8XotWmAFcsIBGhLwKHc92AEiU/MRz2rPq2bQgyFEWs/ K+ZXUJONzWEBgpkjOgIKMQTY9P3TR5Na2SUFqeI+4w== X-Google-Smtp-Source: APXvYqyBhJTcbx4Xt1FhYrPpeBs0GWYkzqvVM6fIDAS309M5Y+7Qirq8NKvhlgW2LRzB9wDxw7sc9ZgsUvCOO8QhaXg= X-Received: by 2002:a63:d909:: with SMTP id r9mr4150357pgg.381.1569515042255; Thu, 26 Sep 2019 09:24:02 -0700 (PDT) MIME-Version: 1.0 References: <20190920142738.qlsjwguc6bpnez63@willie-the-truck> <20190926133805.52348-1-vincenzo.frascino@arm.com> <20190926133805.52348-3-vincenzo.frascino@arm.com> In-Reply-To: <20190926133805.52348-3-vincenzo.frascino@arm.com> From: Nick Desaulniers Date: Thu, 26 Sep 2019 09:23:51 -0700 Message-ID: Subject: Re: [PATCH v2 2/4] arm64: vdso32: Detect binutils support for dmb ishld To: Vincenzo Frascino , Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190926_092403_488667_6FBD5824 X-CRM114-Status: GOOD ( 17.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Catalin Marinas , Thomas Gleixner , LKML , Linux ARM , Ard Biesheuvel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 26, 2019 at 6:38 AM Vincenzo Frascino wrote: > > As reported by Will Deacon, older versions of binutils that do not > support certain types of memory barriers can cause build failure of the > vdso32 library. Do we know which specific version of binutils has this problem? Documentation/process/changes.rst lists 2.21+ as the supported versions. If it's older than that, it's unsupported. I triple checked android's 2.27 seems ok. $ cat bar.s .text .globl foo dmb ish dmb ishld dmb ishst $ aarch64-linux-gnu-as bar.s $ echo $? 0 $ llvm-objdump -d a.out a.out: file format ELF64-aarch64-little Disassembly of section .text: 0000000000000000 $x: 0: bf 3b 03 d5 dmb ish 4: bf 39 03 d5 dmb ishld 8: bf 3a 03 d5 dmb ishst > > Add a compilation time mechanism that detects if binutils supports those > instructions and configure the kernel accordingly. > > Cc: Will Deacon > Cc: Catalin Marinas > Signed-off-by: Vincenzo Frascino > --- > arch/arm64/Kbuild | 6 ++++++ > arch/arm64/include/asm/vdso/compat_barrier.h | 2 +- > arch/arm64/kernel/vdso32/Makefile | 9 +++++++++ > 3 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/Kbuild b/arch/arm64/Kbuild > index d6465823b281..75cf8c796d0e 100644 > --- a/arch/arm64/Kbuild > +++ b/arch/arm64/Kbuild > @@ -4,3 +4,9 @@ obj-$(CONFIG_NET) += net/ > obj-$(CONFIG_KVM) += kvm/ > obj-$(CONFIG_XEN) += xen/ > obj-$(CONFIG_CRYPTO) += crypto/ > + > +# as-instr-compat > +# Usage: cflags-y += $(call as-instr-compat,instr,option1,option2) > + > +as-instr-compat = $(call try-run,\ > + printf "%b\n" "$(1)" | $(COMPATCC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) > diff --git a/arch/arm64/include/asm/vdso/compat_barrier.h b/arch/arm64/include/asm/vdso/compat_barrier.h > index fb60a88b5ed4..3fd8fd6d8fc2 100644 > --- a/arch/arm64/include/asm/vdso/compat_barrier.h > +++ b/arch/arm64/include/asm/vdso/compat_barrier.h > @@ -20,7 +20,7 @@ > > #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory") > > -#if __LINUX_ARM_ARCH__ >= 8 > +#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD) > #define aarch32_smp_mb() dmb(ish) > #define aarch32_smp_rmb() dmb(ishld) > #define aarch32_smp_wmb() dmb(ishst) > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile > index 1fba0776ed40..22f0d31ea528 100644 > --- a/arch/arm64/kernel/vdso32/Makefile > +++ b/arch/arm64/kernel/vdso32/Makefile > @@ -17,6 +17,8 @@ cc32-disable-warning = $(call try-run,\ > $(COMPATCC) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) > cc32-ldoption = $(call try-run,\ > $(COMPATCC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) > +cc32-as-instr = $(call try-run,\ > + printf "%b\n" "$(1)" | $(COMPATCC) $(VDSO_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) > > # We cannot use the global flags to compile the vDSO files, the main reason > # being that the 32-bit compiler may be older than the main (64-bit) compiler > @@ -55,6 +57,7 @@ endif > VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector > VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING > > + > # Try to compile for ARMv8. If the compiler is too old and doesn't support it, > # fall back to v7. There is no easy way to check for what architecture the code > # is being compiled, so define a macro specifying that (see arch/arm/Makefile). > @@ -91,6 +94,12 @@ VDSO_CFLAGS += -Wno-int-to-pointer-cast > VDSO_AFLAGS := $(VDSO_CAFLAGS) > VDSO_AFLAGS += -D__ASSEMBLY__ > > +# Check for binutils support for dmb ishld > +dmbinstr := $(call cc32-as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1) > + > +VDSO_CFLAGS += $(dmbinstr) > +VDSO_AFLAGS += $(dmbinstr) > + > VDSO_LDFLAGS := $(VDSO_CPPFLAGS) > # From arm vDSO Makefile > VDSO_LDFLAGS += -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 > -- > 2.23.0 > -- Thanks, ~Nick Desaulniers _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel