Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2624260ybt; Fri, 3 Jul 2020 14:12:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmRaFUaF1sK+69tV5zzYzaBvaw73zB5bNgfp1M7EwGbadd9MGPPpU9MiVZ9nk39tx8OKxw X-Received: by 2002:a17:906:1d1b:: with SMTP id n27mr35119449ejh.272.1593810724232; Fri, 03 Jul 2020 14:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593810724; cv=none; d=google.com; s=arc-20160816; b=sloMX5dvhuyPvIa6NR+skIHEprIssrqH+hPjLxhH/UqALab7OhzEFwmRuYIOg/HJhQ YZEuzugY6P8NUN/LZOWSxxdTX0P9J7eEyF1zlwPKWciWlyw/uGTDglVwyR4ZfdIKxAhV 5QxI1CZ74d4pv5xvLE+812tyMFbZXsFhUBHVDahnZgSGju+4gSWngd7K64ft6mUioXbC 8wXM/pKvp+zbH+b2YuCIGUa7c1tlnHODZ6j1EW1+ywhPLM1bmiWtKf8aSv9dlJVp79np 7oLcFYxpxEgBEBTHE95/Lbb4jFcm3m4w3UzBja7f+zqKA0IPLKcf1QXRCpuS352A+M2u GpFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=sgsjBBBVVhmo4cduLfFueoI3YSDE6SkDv8XCpwuHNSE=; b=SQCBMezwWrj1jDtM2/NButRG29z2sZMmQW9iJdg/Kph1VadFCeePqblYNINevQ+lEt y6ymVzUSbU4Ghyo5gqcG6bXyE7ZVXheUVytHBgz9MIecrR/Mo5md7wC8lbzTD0oS221L BkOCxsQMIQt5pnIfBlMTDUfFYcOgVSpcGo9D42SPFyZXKl4lyFwNWt2lLSKooPzImCR2 3UXk0WfAv1Rm2GHccB9sV7LA2XW/t4SZf100N0u1nfH2WQwpzLVHjE9HMRjdWQoQOTu2 QR/v2nIjGhimLibJTEV4Sis9wYIGLcUFx0EljrmJ7s3SIo5DkhUe9cE5oeOdDRjDRp8z IrRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=P71Y+HcG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r24si8552912edp.282.2020.07.03.14.11.39; Fri, 03 Jul 2020 14:12:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=P71Y+HcG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726669AbgGCVK3 (ORCPT + 99 others); Fri, 3 Jul 2020 17:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbgGCVK2 (ORCPT ); Fri, 3 Jul 2020 17:10:28 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D887C061794 for ; Fri, 3 Jul 2020 14:10:28 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id y18so19217988lfh.11 for ; Fri, 03 Jul 2020 14:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sgsjBBBVVhmo4cduLfFueoI3YSDE6SkDv8XCpwuHNSE=; b=P71Y+HcGmg4OROjroEwKHfDWFYbqWVoWHZVrwtaylpdbxcHpTYuyxe41LuxzgKmdhs 0FHNlgMfjdGKlIPmTamzTM/Ry0tNNM9gXk4EP1RBQtIgXoZvQd4duF3zzE7zZFJPJKI0 nayPMttQHgQ8V5oxZiD61iFL/Wm9KqKJGBV5Y= 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=sgsjBBBVVhmo4cduLfFueoI3YSDE6SkDv8XCpwuHNSE=; b=FG8iS/JEhN+op4lkex+umVAhhUDYeZzc6naMhljd/UOWrGjfSI4NkipOgqgjXbwNR/ tpOTg5w18xj8J6wqHsnxQuDYzqfxCPTHI57RiIe+NfCdGfr+VDtgeUdTWr9N8l/4kvr6 dNsQZu2IY1Vx4KzSDcpxHtMGd/R8NgFPHiVfxy6PIF7DBkhI3QMDqxHiVfYm38ZiqnW8 S0zOOu+m/S7nsJLFo08789uBx/hMLGL24Tc30aKs4leXEUK+KShPF1Q2cObFBojpMc9x DpwnoZqE/qULIqlV5PNERaY7lE0Lvr8Q349+BX/ZAeKxsB8S8w/GxjqH6SesMa5eioZV VH1Q== X-Gm-Message-State: AOAM530+/MQuxbHclM4RPtTCFttWLN0VcKGU+6sEwl5K1xM01msZuiUC BC65MOyYreMmnrzaROZtgc45i7lGdCU= X-Received: by 2002:a19:e61a:: with SMTP id d26mr17634546lfh.96.1593810625820; Fri, 03 Jul 2020 14:10:25 -0700 (PDT) Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com. [209.85.208.173]) by smtp.gmail.com with ESMTPSA id y69sm5060682lfa.86.2020.07.03.14.10.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jul 2020 14:10:24 -0700 (PDT) Received: by mail-lj1-f173.google.com with SMTP id t25so33867644lji.12 for ; Fri, 03 Jul 2020 14:10:24 -0700 (PDT) X-Received: by 2002:a05:651c:1b6:: with SMTP id c22mr17747719ljn.421.1593810624132; Fri, 03 Jul 2020 14:10:24 -0700 (PDT) MIME-Version: 1.0 References: <20200701195914.GK2786714@ZenIV.linux.org.uk> <87lfk26nx4.fsf@mpe.ellerman.id.au> <20200702201755.GO2786714@ZenIV.linux.org.uk> <20200702205902.GP2786714@ZenIV.linux.org.uk> <20200703013328.GQ2786714@ZenIV.linux.org.uk> <20200703210237.GS2786714@ZenIV.linux.org.uk> In-Reply-To: <20200703210237.GS2786714@ZenIV.linux.org.uk> From: Linus Torvalds Date: Fri, 3 Jul 2020 14:10:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: objtool clac/stac handling change.. To: Al Viro Cc: Michael Ellerman , Christophe Leroy , Josh Poimboeuf , Peter Zijlstra , "the arch/x86 maintainers" , Linux Kernel Mailing List 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 Fri, Jul 3, 2020 at 2:02 PM Al Viro wrote: > > Actually, for more serious problem consider arch/x86/lib/copy_user_64.S What? No. > In case of an unhandled fault on attempt to read an (unaligned) word, > the damn thing falls back to this: > SYM_CODE_START_LOCAL(.Lcopy_user_handle_tail) > movl %edx,%ecx > 1: rep movsb > 2: mov %ecx,%eax > ASM_CLAC > ret > > _ASM_EXTABLE_UA(1b, 2b) > SYM_CODE_END(.Lcopy_user_handle_tail) In the case of "we did an unaligned word at the end of a page, we took a fault, and now we have to start all over", the _least_ of our problems is that part of "starting over" would now imply doing a "stac" again. Yeah, the "stac" instruction isn't hugely fast, and serializes the pipeline, so it's a nasty 20 cycles or something. But for chissake, this (a) happens approximately never (b) is after a fault that took a thousand cycles so the trivial thing to do is to just say "yeah, you need to add the STAC when your optimistic thing failed and you have to fall back to the byte-at-a-time tail case". It's particularly trivial since objtool would statically find all these places, since it would warn about the ASM_CLAC without a STAC (that's assuming Josh's patch, of course). Linus