Received: by 10.223.176.5 with SMTP id f5csp1110467wra; Wed, 7 Feb 2018 12:53:43 -0800 (PST) X-Google-Smtp-Source: AH8x225lOSA3wqqDhQp/XAAOcwn7e6d9YfeAIkBhfmcIV+tyxtNRQOqhwth/w8HOMbws0DykYnsS X-Received: by 10.99.117.18 with SMTP id q18mr5947523pgc.211.1518036823749; Wed, 07 Feb 2018 12:53:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518036823; cv=none; d=google.com; s=arc-20160816; b=U2QxiMkuXcl1bv62QjoKE+/KNL+w7pPEPafZ5hEb64bT2yhAsCEwII11hAART4gxo0 LVEfbk5s9owW1fDY+aSFv4hwssomQN5+lmeIk3kHyB8TPUuWSDNrBBKmlh/E/HL9mxU9 07/cIm9EgiE/urUhTBwEDiE8CD+bg77g/RGHwi+pGYlnNoWJ/GDGyskjIGhW9ogupHHU TPaD9GQpPdoCbpgGYKnKp3FAJksV2/4YuziXdMdIS86bcASlPluymP/8gp4gLelTw0VS FzRqedZbUpknuccEL5f2Rhbaka27AjfIKlej4mILfligGdbInV4y9vwA9cklPtZeu9o3 MP6g== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:arc-authentication-results; bh=7iuJKwEkYom6gCBZ0Za3L+3oFmhT+ZHJf2UaITc/NSY=; b=0JvVo49nbTtsVM7xTrYDHQPK7mMpYVS4q2kQUWqdBnO0/X7UCDx/Zh0yqtAM9uFhBN eAPHdr/46cX0pHJqG/j0wprCW2ILPEoEHCSeRLUua7oeyDp5M16EImI6E1s1NwZrKD8l pstM628iImynhRc9RPMZYJg7Bo0uAOW2is8RAx6WhFYsaCYDzrQjtagBRL5ioVXylcgY 2wQMc16HAOZ2vuSBbr4zMOUK4BOykdjfYlqF5H6s3yNmW5GCG3ioySVrflDSIxgbA/Q7 gn0lyYbh068OrYkNwWAqGsXBuOv/533jP/spHGFbwWYSkWVnCL/MROVnildHMEm5Uqzo wCTA== ARC-Authentication-Results: i=1; mx.google.com; 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 d4-v6si1606615plo.502.2018.02.07.12.53.29; Wed, 07 Feb 2018 12:53:43 -0800 (PST) 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; 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 S1754705AbeBGUwk (ORCPT + 99 others); Wed, 7 Feb 2018 15:52:40 -0500 Received: from terminus.zytor.com ([65.50.211.136]:52529 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754127AbeBGUwj (ORCPT ); Wed, 7 Feb 2018 15:52:39 -0500 Received: from hanvin-desk.amr.corp.intel.com ([134.134.139.76]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id w17KhXaR000926 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 7 Feb 2018 12:43:34 -0800 Subject: Re: [RFC 0/3] x86: Patchable constants From: "H. Peter Anvin" To: Linus Torvalds , "Kirill A. Shutemov" Cc: the arch/x86 maintainers , Tom Lendacky , Peter Zijlstra , Dave Hansen , Andy Lutomirski , Borislav Petkov , linux-mm , Linux Kernel Mailing List References: <20180207145913.2703-1-kirill.shutemov@linux.intel.com> <8fea57cc-8772-f8b4-3298-91b0de126358@zytor.com> Message-ID: <83ddad10-936f-9848-e3d1-8c6e73ab2969@zytor.com> Date: Wed, 7 Feb 2018 12:43:33 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <8fea57cc-8772-f8b4-3298-91b0de126358@zytor.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org FYI: the interface I'm implementing looks like this: [output =] const_op(data, variable); ... where variable can be any variable with a static address, although in any sane scenario it should be __ro_after_init. During initialization, it kicks out to an out-of-line (.alternatives_aux) handler which accesses the variable in normal fashion, but at alternatives-patching time it inlines the relevant opcodes. Some of the assembly infrastructure for this is indeed hairy, especially when the out-of-line hander needs temp registers. -hpa