Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1580974imu; Wed, 16 Jan 2019 23:17:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN5c+j9UZb4HkgQmfNP6JGmunBriTfK1dvJ72vQ4E9u4WeTlUSXrxPsAz4S0A/Jxaf1cY56e X-Received: by 2002:a62:4d81:: with SMTP id a123mr14228475pfb.122.1547709426907; Wed, 16 Jan 2019 23:17:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547709426; cv=none; d=google.com; s=arc-20160816; b=WXYphNrRR7QeXDUm0NNx4XAbgHGDBiGLQKkb3AOxatxh6uiNNKyqA4AP31u806110E XAn3b5LOOwl0mLdZAgIv9nklYYuclVUd8vN1mEjTRbdWOys9EiVGm/bdH16NuCb/S/Pl T1Voi7jaDCUkt5mpJc6vcM7TYx1kCipB/6Su04sRmWsNyM5lVbrbIgNV9BBVtLNT0ACD mrdWTtP2E+W9XwfI6qWpXqwJOr6wf5O/DkBTPppSrzJz+O02yJyY/PlJsoG5VUrPKH/m lgMLjEU4lVY0F4SyicoRH8IqisnxMVVz7av/PTYTpObDWsmCow/KSrQMNyQippBvYP18 btOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=El3HgT9HkJBjsHbps3BuRPYtrEZbmoq2/xXWZh8CFXg=; b=cp4nEnYhzBgDiVsJI7k364v6JLaceMkKctRYqcZqJ8j3PyKAQsMEy4Vmsh52y6VZjP Ij3OkQ2JKo3TrLH1l/tvnnKRtYZnPZaMjMXLo829DYHbgR4yAL5wlzAJ2Doxm0TWbu/z C0ud7YJs9Gm52K9AbaWu7F08OEd+KBtsE2jjmrAXqtyMyhVMvfTk7VmQC52OR4Cv6m2E kvtu3hy1qAzKmKA9VIJ9QmGBw4Ahf2JI6l97W/VRu7spQGg5l7ojuTz5DsaDPEe/Stlj yslzDX9ps6a+Ni2JnThbKHNQHidvs/dD0w4onLgnTPyAvfndIYBVpKIaa1W8iwrprCof 1tiw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si987407pfm.37.2019.01.16.23.16.51; Wed, 16 Jan 2019 23:17:06 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729654AbfAPVYi (ORCPT + 99 others); Wed, 16 Jan 2019 16:24:38 -0500 Received: from mga11.intel.com ([192.55.52.93]:32307 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729505AbfAPVYf (ORCPT ); Wed, 16 Jan 2019 16:24:35 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jan 2019 13:24:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,487,1539673200"; d="scan'208";a="117269594" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga008.fm.intel.com with ESMTP; 16 Jan 2019 13:24:34 -0800 From: Fenghua Yu To: "Thomas Gleixner" , "Borislav Petkov" , "Ingo Molnar" , "H Peter Anvin" , "Andy Lutomirski" , "Andrew Cooper" , "Ashok Raj" , "Ravi V Shankar" Cc: "linux-kernel" , "x86" , Fenghua Yu Subject: [PATCH v2 0/3] x86/umwait: Enable user wait instructions Date: Wed, 16 Jan 2019 13:18:39 -0800 Message-Id: <1547673522-226408-5-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1547673522-226408-1-git-send-email-fenghua.yu@intel.com> References: <1547673522-226408-1-git-send-email-fenghua.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org User wait instructions (umwait, umonitor, and tpause) and IA32_MWAIT_CONTROL MSR to control umwait/umonitor/tpause behaviors will be available in Tremont and other future x86 processors. This patch set enumerates the instructions, adds a sysfs interface for user to configure the umwait/umonitor/tpause instructions. The sysfs interface files are in /sys/devices/system/cpu/umwait_control/ because it's hard to find an existing place to host the files. The instructions generates #GP if CR4.TSD=1 and CPL>0. If user worries security issues from the instructions, disabling TSC can prevent malicious code from executing the instructions. Detailed information on the instructions and the MSR can be found in the latest Intel Architecture Instruction Set Extensions and Future Features Programming Reference. Changelog: v2: - Address comments from Thomas Gleixner and Andy Lutomirski - Remove vDSO functions - Add sysfs control file for umwait max time v1: Based on comments from Thomas: - Change user APIs to vDSO functions - Change sysfs to positive logic and enable file name - Change patch descriptions etc Fenghua Yu (3): x86/cpufeatures: Enumerate user wait instructions x86/umwait: Setup umwait C0.2 state x86/umwait: Control umwait maximum time arch/x86/include/asm/cpufeatures.h | 1 + arch/x86/include/asm/msr-index.h | 6 ++ arch/x86/power/Makefile | 1 + arch/x86/power/umwait.c | 154 +++++++++++++++++++++++++++++ 4 files changed, 162 insertions(+) create mode 100644 arch/x86/power/umwait.c -- 2.19.1