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=-8.3 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no 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 1E4D4C433E0 for ; Wed, 27 May 2020 20:15:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F0FF82073B for ; Wed, 27 May 2020 20:15:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="iOS01wcS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728337AbgE0UPC (ORCPT ); Wed, 27 May 2020 16:15:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726946AbgE0UPA (ORCPT ); Wed, 27 May 2020 16:15:00 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0FB5C05BD1E for ; Wed, 27 May 2020 13:15:00 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id y11so2310258plt.12 for ; Wed, 27 May 2020 13:15:00 -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=FfdtyyVLKdq4NOXXZJIyNw3sD+oufFVMDv2SJ2Qrq/A=; b=iOS01wcS1koYPOrmLcJdGte4hEdREZewrFPmwl/ApUOoPSbaa6h1EGPT+K5AzRcK0q 1IwXjAPfTKsALyRr4GzqzFCVp+xdSFzkrIzwgiSbVtTJsCrxvqHPVVzZcM/NAp6PU3Vb dHxxD1ZX+D45FuEy6e3b2MV3QvQEDGYnfyfF0dmosVnDcQn4kqwk6Ea2HjPYVf/2VVnv J1spBnWL7rCAOGDrnPQ+F1Q7dL2kCiEp1hB94bxNcc8WiUysLnCVr8BR9ee++3la2qUl RwqF89loSOdPVzMUkoJZAM2EtcxsvAUn2GssB5F7zLAEsMkiWm6+hQJyqq3MAtMLmYUS K0lA== 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=FfdtyyVLKdq4NOXXZJIyNw3sD+oufFVMDv2SJ2Qrq/A=; b=Za+1G/mO7VMeUKWjTJ+ds/sh3ercg/LzuBSKqqN90IU2cqq0uSOM2PaIwjCEe7avW0 9IynM7ET8BR015Nu8BVO05AVQujTaZbk34shYPgffRxsrkznkI80+6MqWA2COW0/8Zh0 LlvpOLBDikgMl4XsOxe9yHReGu2x4tFKbK4cYjsM5fWjyVPozBWJ3lZu9863odeKzLai 9EsDus+5KzCZVH2srYvjnZ8K5oIkL0v1fqXW2Zjw/RYVFKMtpw6xjGC89PZrXasPhebX FdFLtFgfb8yKtFFCU8qmJpEwc41UPfl74yIvu6H9b/ebKA2O2gfKBr0ndu/8kydI1Ifw XCGA== X-Gm-Message-State: AOAM533zUM8F5ug3Ou9YKtIXpOhoBvQxpZF+UUpy8TGPhEhC9Y4Tg59+ lVR3DHRUnppbl8yJt/PZogGM0hhPXwmpm0f/9WXr3g== X-Google-Smtp-Source: ABdhPJxkmmUDLdBND/oo7tPsXbQ7K5srOsr7qRUdoa5Z7H024vJyqnQlLqDUWZ9ULjMDKkGRQvhC0J39xq0J1s/D86s= X-Received: by 2002:a17:90a:4e8c:: with SMTP id o12mr89158pjh.25.1590610499964; Wed, 27 May 2020 13:14:59 -0700 (PDT) MIME-Version: 1.0 References: <20200526173117.155339-1-ndesaulniers@google.com> <2f58c2a4-0f37-d507-7767-00161c6b5d98@arm.com> <34f261f7-c4b5-a628-9a4c-eb97b75fba52@arm.com> In-Reply-To: <34f261f7-c4b5-a628-9a4c-eb97b75fba52@arm.com> From: Nick Desaulniers Date: Wed, 27 May 2020 13:14:48 -0700 Message-ID: Subject: Re: [PATCH] arm64: vdso32: force vdso32 to be compiled as -marm To: Robin Murphy Cc: Catalin Marinas , Will Deacon , Naohiro Aota , Stephen Boyd , Masahiro Yamada , LKML , Manoj Gupta , Luis Lozano , Nathan Chancellor , Vincenzo Frascino , Linux ARM , Kristof Beyls , victor.campos@arm.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 27, 2020 at 12:28 PM Robin Murphy wrote: > > On 2020-05-27 18:55, Nick Desaulniers wrote: > > On Wed, May 27, 2020 at 6:45 AM Robin Murphy wrote: > >> > >> On 2020-05-26 18:31, Nick Desaulniers wrote: > >>> Custom toolchains that modify the default target to -mthumb cannot > >>> compile the arm64 compat vdso32, as > >>> arch/arm64/include/asm/vdso/compat_gettimeofday.h > >>> contains assembly that's invalid in -mthumb. Force the use of -marm, > >>> always. > >> > >> FWIW, this seems suspicious - the only assembly instructions I see there > >> are SWI(SVC), MRRC, and a MOV, all of which exist in Thumb for the > >> -march=armv7a baseline that we set. > >> > >> On a hunch, I've just bodged "VDSO_CFLAGS += -mthumb" into my tree and > >> built a Thumb VDSO quite happily with Ubuntu 19.04's > >> gcc-arm-linux-gnueabihf. What was the actual failure you saw? > > > > From the link in the commit message: `write to reserved register 'R7'` > > https://godbolt.org/z/zwr7iZ > > IIUC r7 is reserved for the frame pointer in THUMB? > > It can be, if you choose to build with frame pointers and the common > frame pointer ABI for Thumb code that uses r7. However it can also be > for other things like the syscall number in the Arm syscall ABI too. Ah, right, with -fomit-frame-pointer, this error also goes away. Not sure if we prefer either: - build the compat vdso as -marm always or - disable frame pointers for the vdso (does this have unwinding implications?) - other? > I > take it Clang has decided that writing syscall wrappers with minimal > inline asm is not a thing people deserve to do without arbitrary other > restrictions? Was the intent not obvious? We would have gotten away with it, too, if wasn't for you meddling kids and your stupid dog! /s https://www.youtube.com/watch?v=hXUqwuzcGeU Anyways, this seems to explain more the intentions: https://reviews.llvm.org/D76848#1945810 + Victor, Kristof (ARM) -- Thanks, ~Nick Desaulniers 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=-0.7 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 957B7C433E0 for ; Wed, 27 May 2020 20:15:07 +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 4817A2089D for ; Wed, 27 May 2020 20:15:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BVbtwlYS"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="iOS01wcS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4817A2089D 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=3jOE4wwHwwWMXATXaoh6J916n6hV/h+bo3kdNvhzp1Y=; b=BVbtwlYSo+b97k Zf9p4s0KunuBxYoSvpXxoMiweCcT7dVDfTb/12K4wlF/U7tFMAp9PaMpVN4n3lJWmiuC0r/fgwL9G T8KLSnYwpI12W8NL5wdgiLXlLdPOEQUbc7GOGm8okqoQUYxgs7sotU8JPLxqqCnubHFadNPn9x0Tm EEqQVnkLpS05h5ritMZ4LAEFYlU1jgOvVmNvJ/B5+5CfdGbkJH3z6yk/IRdAv2jMlkbx76TOwLFJc ffidXo86SaRaNmWLa3F/TAxvbs7qWx+m1RQS/ifPPotuDLabwvR2dzN3z5XIJ/qut1BDjyTvNZ+mR cjKnenBR3VV4cZlYhIRg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1je2SA-00020B-0W; Wed, 27 May 2020 20:15:06 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1je2S5-0001FA-Jq for linux-arm-kernel@lists.infradead.org; Wed, 27 May 2020 20:15:03 +0000 Received: by mail-pj1-x1041.google.com with SMTP id nu7so2098664pjb.0 for ; Wed, 27 May 2020 13:15:00 -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=FfdtyyVLKdq4NOXXZJIyNw3sD+oufFVMDv2SJ2Qrq/A=; b=iOS01wcS1koYPOrmLcJdGte4hEdREZewrFPmwl/ApUOoPSbaa6h1EGPT+K5AzRcK0q 1IwXjAPfTKsALyRr4GzqzFCVp+xdSFzkrIzwgiSbVtTJsCrxvqHPVVzZcM/NAp6PU3Vb dHxxD1ZX+D45FuEy6e3b2MV3QvQEDGYnfyfF0dmosVnDcQn4kqwk6Ea2HjPYVf/2VVnv J1spBnWL7rCAOGDrnPQ+F1Q7dL2kCiEp1hB94bxNcc8WiUysLnCVr8BR9ee++3la2qUl RwqF89loSOdPVzMUkoJZAM2EtcxsvAUn2GssB5F7zLAEsMkiWm6+hQJyqq3MAtMLmYUS K0lA== 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=FfdtyyVLKdq4NOXXZJIyNw3sD+oufFVMDv2SJ2Qrq/A=; b=RQLkrZfo3DuKaoDnZvJCiJQgiJaONal4XVh0yG6+NREn+zjez9dYlQQEtYR8IC9ex2 kFhaAjk1AqkW/lRPwIQyit+s7kFaTvruZJtQI6SFLBzMbdnZDmlpXgtFlQfSM/fGLZjp TCTiBR7ttHlBFThWvSsIwBUtFwLGMPXct6IHAlrnkKh1MMxqasq1y45eMPKcsxqz5PyO yqjbPAhGtRFnf6ziObC0gbdlcm44O30tzt4zFgGZIdx3yM+IhWlA53pKSmZxDafU3EDa Lcdp+bKjen1BPICYEQ2CIs4r1ZTAQMYBZO7VLJ1Hy1/PpijQs5nCd36nCGNa1dKOASNt zfjg== X-Gm-Message-State: AOAM5306Gpfn5AAkdPzU9bponFUO26jXQXrNEXsrMplXQN28CjZd0xOv MUsUTzBqhakE4u/esjUsrdda9HeIRbS2jhsmk7DtxA== X-Google-Smtp-Source: ABdhPJxkmmUDLdBND/oo7tPsXbQ7K5srOsr7qRUdoa5Z7H024vJyqnQlLqDUWZ9ULjMDKkGRQvhC0J39xq0J1s/D86s= X-Received: by 2002:a17:90a:4e8c:: with SMTP id o12mr89158pjh.25.1590610499964; Wed, 27 May 2020 13:14:59 -0700 (PDT) MIME-Version: 1.0 References: <20200526173117.155339-1-ndesaulniers@google.com> <2f58c2a4-0f37-d507-7767-00161c6b5d98@arm.com> <34f261f7-c4b5-a628-9a4c-eb97b75fba52@arm.com> In-Reply-To: <34f261f7-c4b5-a628-9a4c-eb97b75fba52@arm.com> From: Nick Desaulniers Date: Wed, 27 May 2020 13:14:48 -0700 Message-ID: Subject: Re: [PATCH] arm64: vdso32: force vdso32 to be compiled as -marm To: Robin Murphy X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200527_131501_678499_B4B4A91E X-CRM114-Status: GOOD ( 18.67 ) 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: Naohiro Aota , Stephen Boyd , Catalin Marinas , Masahiro Yamada , LKML , Manoj Gupta , Kristof Beyls , Luis Lozano , Nathan Chancellor , Vincenzo Frascino , Will Deacon , victor.campos@arm.com, Linux ARM 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 Wed, May 27, 2020 at 12:28 PM Robin Murphy wrote: > > On 2020-05-27 18:55, Nick Desaulniers wrote: > > On Wed, May 27, 2020 at 6:45 AM Robin Murphy wrote: > >> > >> On 2020-05-26 18:31, Nick Desaulniers wrote: > >>> Custom toolchains that modify the default target to -mthumb cannot > >>> compile the arm64 compat vdso32, as > >>> arch/arm64/include/asm/vdso/compat_gettimeofday.h > >>> contains assembly that's invalid in -mthumb. Force the use of -marm, > >>> always. > >> > >> FWIW, this seems suspicious - the only assembly instructions I see there > >> are SWI(SVC), MRRC, and a MOV, all of which exist in Thumb for the > >> -march=armv7a baseline that we set. > >> > >> On a hunch, I've just bodged "VDSO_CFLAGS += -mthumb" into my tree and > >> built a Thumb VDSO quite happily with Ubuntu 19.04's > >> gcc-arm-linux-gnueabihf. What was the actual failure you saw? > > > > From the link in the commit message: `write to reserved register 'R7'` > > https://godbolt.org/z/zwr7iZ > > IIUC r7 is reserved for the frame pointer in THUMB? > > It can be, if you choose to build with frame pointers and the common > frame pointer ABI for Thumb code that uses r7. However it can also be > for other things like the syscall number in the Arm syscall ABI too. Ah, right, with -fomit-frame-pointer, this error also goes away. Not sure if we prefer either: - build the compat vdso as -marm always or - disable frame pointers for the vdso (does this have unwinding implications?) - other? > I > take it Clang has decided that writing syscall wrappers with minimal > inline asm is not a thing people deserve to do without arbitrary other > restrictions? Was the intent not obvious? We would have gotten away with it, too, if wasn't for you meddling kids and your stupid dog! /s https://www.youtube.com/watch?v=hXUqwuzcGeU Anyways, this seems to explain more the intentions: https://reviews.llvm.org/D76848#1945810 + Victor, Kristof (ARM) -- Thanks, ~Nick Desaulniers _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel