Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3047549imm; Sun, 17 Jun 2018 09:52:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIKoTwTw9qXPnnlumFMK4LiEBysNDbCzdhjXtdeoIL8x5i3STa9rtbECjIp0jSpw+QToLfU X-Received: by 2002:a65:5546:: with SMTP id t6-v6mr8270186pgr.363.1529254347651; Sun, 17 Jun 2018 09:52:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529254347; cv=none; d=google.com; s=arc-20160816; b=IK0zGZZuNLaL/kYlMTD8A6qemUKhZRncipeNWEESO//1qlq61f7eHzzhzFh2i4Dx4C zjNOXQPU3iw7huWEXQtBBmmU0+3RTGDVxNdvMZV5O4t2mldu63aS6JkUgNj9ZjOrhw7n VjWY1+9Dvcn+CVvxV+qGAjxTDeF4WF/lzdjb65BMN1vB3+I5QEKU3VFlFigto4gbUYg1 eSSlJ2pB7U8/uMDhFREUK/PJK1JyuIb+xY56NAFg4A9XzmhsOP0t+4FCqvwy3Tkm6+Nv TGshyuObVNiHYz29AoUvvn9ZUAz/8kHH9dCi2N3z4ml0AQ3B0BZeOeM5PeRvpe6gfcQD fFTw== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=qH2Xjve5YhaOSPUA80W94AgzgoRNT2ulp4Ibpbqyp18=; b=c/HBtMkivxPiqQ9oTITraV2Q2+dIRNQwbV//SQjnsU5SwT8m4djUitVJpc9+xJn7Nq 1LQDh2DtCsuftRJTYKdHwVARBUE08oe8TjY0ZbUicX/iHW31q+DarxyLLeONCCb/YmPE pi7jzUCnDaYR4AhrPWTGSCV/KucuzeA2se/Fa233BNWvf9MVoR3gwtjUKYkacr5b6aok yyCXb0WReV+pQ4FufoD9EqvD5brzhNpTU3uLEUG+sf8Ro9VsiRyWGRO4RyqRGQ/AhCJA uZ+BIe5mwhbKNnknVRuGHMNH73BkUGsTMDmWJdKYjaKA1E/gearBeqxS8PlGp0Pdm+PI bsmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@juliacomputing-com.20150623.gappssmtp.com header.s=20150623 header.b=CtO+JUDe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m37-v6si12848805plg.491.2018.06.17.09.52.13; Sun, 17 Jun 2018 09:52:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@juliacomputing-com.20150623.gappssmtp.com header.s=20150623 header.b=CtO+JUDe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934264AbeFQQtE (ORCPT + 99 others); Sun, 17 Jun 2018 12:49:04 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:51763 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933989AbeFQQtD (ORCPT ); Sun, 17 Jun 2018 12:49:03 -0400 Received: by mail-it0-f68.google.com with SMTP id n7-v6so8917879itn.1 for ; Sun, 17 Jun 2018 09:49:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=juliacomputing-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qH2Xjve5YhaOSPUA80W94AgzgoRNT2ulp4Ibpbqyp18=; b=CtO+JUDeUg0SCni/FFwtaaM5S6UA4WEgqN59qybzmXKfRhSXNNkaoo0jdJQvvggoUJ wOspM/A6oZAelmvS9qOf9inDnr4LparBpEN5ERLPgdr7Eu0GFzatNz+WQUiwMDttgAjl Ibn5U4ulA8MtV0LImr2LLG+lpixC1dYCk1XV2aGe6gIQQCAnUBpjmlFp6IsU+nuJs6cV hK3CQ3ewWH2L2/goX0ct2KOUVsN+106jFySNEaXG6MkcOP1stYgQlerIfUNdRoGoykpr KFu1harrQxu1E5MWObGieiUeX3w/dv0VR3mrT5PaktSX6iETPhguTHRlT5yGIbkGxkV8 Rb+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qH2Xjve5YhaOSPUA80W94AgzgoRNT2ulp4Ibpbqyp18=; b=Iu7cU1+fe/C0x9dHFS5NrZpRi7YBxqXB7yn6PrhXHegYV+w8XpEuDbtT9PkfQ1IdRr k91PeD0HQlQWa2whCwsBp66q3kBh8EaA+fnIBubip2cg+jtpYoVQw/kzojPLthi0v2N9 J6VlxGaq3y7PVbak4lNP6BcRXYBWtI3AyryVZDz45zsmtmex4rWlk82ejZb0g/M0gOJ+ 4XWlulp4tUVALe2az0KpfuxUNxfhfQ95fWWcWkKa95/PAwep34RumVTJ2huAh8GjVagk 3R2V1j0hqLkA04QOi7u+FZI3GF2AJHq2cMfI7geVpgXlls5RnRkqGB72evAVICxNG8Om ncVA== X-Gm-Message-State: APt69E1s8TnssQBFiBOcI+bzz8j+2rM11KvKtsal8ZFyol/fovUZjA3c d/qFzF48CegWZ6ZQU/V4V7VXBTWRTxgSH3ajXIZpbw== X-Received: by 2002:a24:e983:: with SMTP id f125-v6mr6865037ith.99.1529254142743; Sun, 17 Jun 2018 09:49:02 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:494a:0:0:0:0:0 with HTTP; Sun, 17 Jun 2018 09:48:22 -0700 (PDT) In-Reply-To: <20180617163530.rvwf7fcukmoletgo@two.firstfloor.org> References: <1529195582-64207-1-git-send-email-keno@alumni.harvard.edu> <20180617163530.rvwf7fcukmoletgo@two.firstfloor.org> From: Keno Fischer Date: Sun, 17 Jun 2018 12:48:22 -0400 Message-ID: Subject: Re: [RFC PATCH] x86/arch_prctl: Add ARCH_SET_XCR0 to mask XCR0 per-thread To: Andi Kleen Cc: Linux Kernel Mailing List , Thomas Gleixner , Ingo Molnar , x86@kernel.org, "H. Peter Anvin" , Borislav Petkov , Dave Hansen , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Kyle Huey , "Robert O'Callahan" 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 > Patch seems pointless if you can already control CPUID, which rr > supports. Just disable AVX512 in CPUID. All code using AVX should check > cpuid (or will fail anyways). Unfortunately, that is insufficient. Almost difference in CPU behavior between the replayer and the replayee. In particular, the problems for rr here are 1) xgetbv, which can introduce differing register contents (and if code branches on this, potentially differences in control flow). 2) xsave writing more memory than the trace expects, causing divergence in the memory contents of the process. Robert O'Callahan has a blog post that goes into some detail here: https://robert.ocallahan.org/2018/04/cpuid-features-xsave-and-rr-trace.html I hope that makes sense. Please let me know if you'd like me to explain the problem in more detail or give an example. FWIW, I do have a version of rr that uses the proposed feature in this patch and it does fix our problem with replaying AVX traces on skylake machines. Without this patch, rr does emulate the cpuid response of the recording machine, but the replay fails because of the mentioned issue.