Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4230887imm; Mon, 18 Jun 2018 11:17:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL8GoAGI3+m/LOBUNKrB5vFsveeSJFtbRe/LjSZV9c5DX+A0G3+5YmPrLZFytyGDdpUYkxC X-Received: by 2002:a62:c0cb:: with SMTP id g72-v6mr14554364pfk.226.1529345856018; Mon, 18 Jun 2018 11:17:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529345855; cv=none; d=google.com; s=arc-20160816; b=nUOw+eq7FBs0hZgJj36MKhjv/6HkGr9cdBZz1P53jN4iC6Vig/QEb5RaNF2iuhPmkc lLZyCKzilFuAlpdDly/bDAYgAATk+OC9htXbqQKttnjk2nuqvT1DCWLo1eJ4fIFe9Ehj xeT0N8HQMMm8nDkIy9j8Q8Hn+kKDq2Ffd8S1ITISMmeF+ow4G1zkNoxOrapsjVVdUXfc rMgiBdfKh8WgKA/qlnKGMVyLtlGAn821/CwRoRHohDU8wupWfU85CRcN4QaiiZTsrPZ9 +JIqJZ+t3eLPQ+7FeTUaOJbMKeQse86e1uZNido113cmfUIjitTDkTwTfIHsILn4CbJb aJyA== 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=VRpLW9SuN56Yw+NLzQXnYQDllLxPkFTwXJooYhx92lw=; b=Q07a/I3RadwRGMxuwLGRndUpa/6UKmZWTtP9RRdimkxFcUmWDZs2Fh3A25FKT4DN1I GjVzuDNuqMsjcJTjXBal191B912wCrIhtjdkkmzeSZJz/1YweiAVkJXMoyHqFrfv0XFv B8lxXydxO3FFFIg1ob7/MBEXFS6YG9AbEbFuKOhAVE2rTcn39drWkOdZGLzlYV72uoeu qWbFC8es87EyJirQ31HlSjrwnh/mrO/plEst1TzVOlbeSqnyGTsbkIqsW2FjHhSzf1F2 HtmzyYxMFtyIwG83VN/70JvPRIgNvIXn0mZrlt0w79kUFaXntyiT1aT4UPPrDti/cYzD NUog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@juliacomputing-com.20150623.gappssmtp.com header.s=20150623 header.b=WgXppqci; 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 c83-v6si15494417pfl.319.2018.06.18.11.17.21; Mon, 18 Jun 2018 11:17:35 -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=WgXppqci; 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 S935816AbeFRSQm (ORCPT + 99 others); Mon, 18 Jun 2018 14:16:42 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:37734 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935585AbeFRSQl (ORCPT ); Mon, 18 Jun 2018 14:16:41 -0400 Received: by mail-it0-f68.google.com with SMTP id l6-v6so13362102iti.2 for ; Mon, 18 Jun 2018 11:16:41 -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=VRpLW9SuN56Yw+NLzQXnYQDllLxPkFTwXJooYhx92lw=; b=WgXppqciBc6HDrsrncwIAw5Q3Qt/CjxK9s2V8xan756+dOmVPhUHoDVSaQzKfPUKiE Aoyf6ZeGG7Gt28jLONlIJucwqQZTQsL2MRWjHsQI2ZBVMb/cGS6kPhKX50fMG0VXRAnV E66d2bFWypykBcGywgk4xg8yBviCvU1yyvNs+8nmhB+992SJhsRO6xzCaSEMTGSR5Otw RTFluu++zXs1/I4pORgYe7s+jdvHgq+NIrCev6UqTD4E5Zhi8zCtlPKhhnuAL4EW7qTk 2Sk2FMkE/qrowI/eY5RBg3StAvp/5DLNi+rtQVLFi6DEwh3LHqok6ZJwIyb3+55SiD6S irzw== 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=VRpLW9SuN56Yw+NLzQXnYQDllLxPkFTwXJooYhx92lw=; b=lKOFov47Ug/KjyB7e2sE0ZtR41sInk9LuREj8xWPctmsTuiUopi3nVAIgOnB7pkeM4 3nlrDBVYWUBiUBYoYa/fbz6KpZQ5Q57HI7VRiJnOKywT4b4Rfv4Th1LA5yWfmbLMPuD4 14OhWB9yCNqE98Vlvj7Xvg6nSbLVNQNHw5MdBNgfs2pAsVW6F1TBzTRYmJGN1eAXmhA6 IQ7nZQD0m+PyIu7bc6uqWXdrVenIfXmFFnKYEoibabs6S7rIdAg6PjYKqvx0db+EtXO7 98o7mWeH5/qMteqZjOjbhSu3ETz+99Y016MKhulGfhInrK06Jij1A4c+zhIoMVewS2W5 eIPg== X-Gm-Message-State: APt69E3GuQ2BfH1lqnVCLMKadnEe2deVyXopdgvBSLgTJ6jNgiB5AbDQ mtngmFz0TIECYTk65p3Xf6jd7yzsa8KBq1IgPjZzGw== X-Received: by 2002:a24:2f12:: with SMTP id j18-v6mr10834602itj.28.1529345800541; Mon, 18 Jun 2018 11:16:40 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:494a:0:0:0:0:0 with HTTP; Mon, 18 Jun 2018 11:16:00 -0700 (PDT) In-Reply-To: <06f44447-54eb-4644-a905-349cfc82f602@linux.intel.com> References: <1529195582-64207-1-git-send-email-keno@alumni.harvard.edu> <06f44447-54eb-4644-a905-349cfc82f602@linux.intel.com> From: Keno Fischer Date: Mon, 18 Jun 2018 14:16:00 -0400 Message-ID: Subject: Re: [RFC PATCH] x86/arch_prctl: Add ARCH_SET_XCR0 to mask XCR0 per-thread To: Dave Hansen Cc: Linux Kernel Mailing List , Thomas Gleixner , Ingo Molnar , x86@kernel.org, "H. Peter Anvin" , Borislav Petkov , Andi Kleen , 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 > So, to be useful, this interface needs to be called before an > application can run XGETBV or XSAVE for the first time and caches a > "bad" value. I think that means that it might not be feasible to use > outside of cases where you ptrace() something and inject things before > it has a chance to run any real instructions. > > Fundamentally, I think that makes _this_ interface pretty useless in > practice. The only practical option is to have a _future_ XCR0 value > set by the prctl() and then have it get made active by the kernel at > execve(). Fair enough, but it don't see this as really fundamentally different from the cpuid masking use case, which has the same problem and the same interface. I'm also not convinced that there is *no* use case where one may want to turn on certain XCR0 features while the process is running and then turn them off again. To give a concrete example in this context, it can useful to write a small program into the memory space of the replayed program and use it to analyze the memory state of the program (e.g. to checksum the memory - or in our case to perform a GC state validation). Such implants may want to use the AVX512 registers for performance, so it would be nice if that was possible. > IMNHO, if you haven't guessed yet, I think this whole exercise is a dead > end. Just boot an identical XCR0 VM on your new hardware and do replay > there. Done. I had a hunch ;). However, there are a couple considerations that make me still want this in the kernel proper: 1. The recording side application of this feature - getting our users to do everything in a VM to send us a recording is not easy. Part of the appeal of rr over VM-based record/replay techniques is that it "just works" on basically any linux hosts. 2. Starting a VM generally requires root permissions, which may not be available. 3. And probably the biggest from my perspective is performance. rr needs to do a lot twiddling with the performance counters, which I've seen have significant performance overhead in a virtualized environment. There's of course also a per-VM resource consumption, but presumably we could keep one VM per-XCR0 value and replay multiple traces per VM.