Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2762686ybt; Fri, 3 Jul 2020 18:57:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz83hefUlfX/qtPlb8xWYEuXdPezM2vK+c37vX9BzNveBkHKQZEHpvlFblILBhkN7ZL6AP4 X-Received: by 2002:a50:e047:: with SMTP id g7mr42674723edl.290.1593827838570; Fri, 03 Jul 2020 18:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593827838; cv=none; d=google.com; s=arc-20160816; b=YnCbOAOn85KMUH7EdaKSNE+l9md1JLaN7te03JYrsAgaRSOtEoeU8baxov0nv0LSDE aVAEm2emp3abyW8POLb96zOg4Avqf2hCq33uS17hiKsEYSOJpRsCEnx4DLp5ci2D4c5n tbmO1nF8N3ZMebcKpBUbhD4p+N6ljZnra0w6eXuGeJbGUNzNfc2GIbzEKE2JWvRYERkX Dt3x/hYM2KJRJ1ggUbTp4T13claxZ4VxwZVaitblPDlc4keMe4WG87RsoiRr3xp+3wAI tcAoSWtHGBgVBpZgBEjo4OiGMxwWGBKoEwfoCGsD0HU4Li0TXi319flE3HtXzN7g6EtW kxPQ== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=mpcWk+5OkZGUFQEfldhdVGvgXSOVGFFQsLdygOxAwrY=; b=gyamATGOGlb4f1iH6pN4W0jwonocfJGtYRW3gNL6CRU6Q7GHzCgGqbi4ZoV89cIi4A It2P4zWUrzsjA6692UZjqlM0jaDRqW+1Luab4Arsg7sjqOTDXyoW/fmmRAHE5sVRpcKi yRnDa4y7U3MlilXyb7zxcHLt9fOkEQDk6Bw/OayVXjeCl8+X3ZGFCH8JB3OLFDx9oXDs 4BquNFFvL7xAvXkxX+II3VF1FdbWm6zcnZFQiSoL8E7YljHITJvQ3ObYP16a7ujiKfer 722eDDUj72HR8+Lx+0kp2OEJCQu7iBd2phdzvIfWpxoDTChD3SNQM7BCFBQlUAd14St/ dBIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=gn1Dn9Mw; 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 ch2si9075589edb.80.2020.07.03.18.56.43; Fri, 03 Jul 2020 18:57:18 -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=gn1Dn9Mw; 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 S1726621AbgGDByg (ORCPT + 99 others); Fri, 3 Jul 2020 21:54:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbgGDByg (ORCPT ); Fri, 3 Jul 2020 21:54:36 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB678C061794 for ; Fri, 3 Jul 2020 18:54:35 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id h22so31809583lji.9 for ; Fri, 03 Jul 2020 18:54:35 -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:content-transfer-encoding; bh=mpcWk+5OkZGUFQEfldhdVGvgXSOVGFFQsLdygOxAwrY=; b=gn1Dn9MwuijYg9hGiJ1noFDalMK96iWLsnzgYP1Znj7R+uTEHyOqguwcsKuLPNZJTf 30mV18sitzdW1usE7U3wlKEVDlXFVpqgVlR2l1MQKpeVUttajlwQ9F5febky4j3rqUwA PiQkHRBzrRp3QUke+f6samrVTfE7DsdHNiU/c= 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:content-transfer-encoding; bh=mpcWk+5OkZGUFQEfldhdVGvgXSOVGFFQsLdygOxAwrY=; b=IxYWVaXLyLmacmVwVC854csCB/Nh/c5qArWHAs00NEVhDQ6X1oApdsk6D5eHQnoVC4 97JfF6nE30XIab/OWxYAkoIDgs9RCndm3ybADdv9NFRDs5MYcCtvYr9HAWGiNDXnXra7 2TDY1QEZEI3X+a1Zjol2w+1AOlQDZE2I8LkXTt2qkS9jRFIlF3AOFiwT/VBxJsnSdWeK o7Xi8AkM6wV3vakIvFgRb7SoidWGUlGrUjQf6Q5T6rjMSv2njytYCVwonazcR1AYx5xA nNUgiQwBSgna19OhWdJBc3XW3ZU+M2lK+PsgA1m91JtkHTnMVcnLoAAz0pa6sxUSbcnC qA/g== X-Gm-Message-State: AOAM530fDn1ZmtPgXeFoXrT8so5BtnqkFt+oU0I9bfzPX1FPcAx92oWy oGx02JC77YzMTHzumD2/oOQyWqYNL2c= X-Received: by 2002:a2e:6f14:: with SMTP id k20mr21793233ljc.224.1593827673752; Fri, 03 Jul 2020 18:54:33 -0700 (PDT) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id m10sm1646497lji.72.2020.07.03.18.54.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jul 2020 18:54:32 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id e4so39001630ljn.4 for ; Fri, 03 Jul 2020 18:54:32 -0700 (PDT) X-Received: by 2002:a2e:760b:: with SMTP id r11mr6758558ljc.285.1593827671608; Fri, 03 Jul 2020 18:54:31 -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> <20200704004959.GY2786714@ZenIV.linux.org.uk> In-Reply-To: <20200704004959.GY2786714@ZenIV.linux.org.uk> From: Linus Torvalds Date: Fri, 3 Jul 2020 18:54:15 -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" Content-Transfer-Encoding: quoted-printable 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 5:50 PM Al Viro wrote: > > How could prefetcht0 possibly > raise an exception? Intel manual says that the only exception is #UD if > LOCK PREFETCHT0 is encountered; not here, obviously. AMD manual simply > says "no exceptions". Confused... Several CPU bugs in this area. I think they may all have been AMD. But we've definitely had "prefetch causes page faults" errata. Google for it. One pdf (AMD errata) I found had this: "Software Prefetches May Report A Page Fault Description Software prefetch instructions are defined to ignore page faults. Under highly specific and detailed internal circumstances, a prefetch instruction may report a page fault if both of the following conditions are true: =E2=80=A2 The target address of the prefetch would cause a page fault if the address was accessed by an actual memory load or store instruction under the current privilege mode; =E2=80=A2 The prefetch instruction is followed in execution-order by an actual or speculative byte-sized memory access of the same modify-intent to the same address. PREFETCH and PREFETCHNTA/0/1/2 have the same modify-intent as a memory load access. PREFETCHW has the same modify-intent as a memory store access. The page fault exception error code bits for the faulting prefetch will be identical to that for a bytesized memory access of the same-modify intent to the same address. Note that some misaligned accesses can be broken up by the processor into multiple accesses where at least one of the accesses is a byte-sized access. If the target address of the subsequent memory access of the same modify-intent is aligned and not byte-sized, this errata does not occur and no workaround is needed. Potential Effect on System An unexpected page fault may occur infrequently on a prefetch instruction." So sadly the architecture manuals do not reflect reality. That said, software prefetch instructions very seldom actually work. They are only useful if you have one _very_ specific load and run one one _very_ specific micrcoarchiecture. Ir's almost always a mistake to have them in the first place. Linus