Received: by 10.213.65.68 with SMTP id h4csp1602640imn; Mon, 26 Mar 2018 10:40:36 -0700 (PDT) X-Google-Smtp-Source: AG47ELvooQ2u9ZiqiwesafuSx4JTUhoIleCDkNQOq6X0cf4Ro4pl2L61jSH2tO+RzM88w7O/OGp2 X-Received: by 2002:a17:902:52c7:: with SMTP id a65-v6mr41495361pli.249.1522086036284; Mon, 26 Mar 2018 10:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522086036; cv=none; d=google.com; s=arc-20160816; b=cFRvNM15y+bl4KLqBRca4r2sKQSFOK83U6jKYO4MxeI7DmASurZh9nmDHzXzjYWH0K TL8qmldV66eAapWE6b1YwGj/PIKvzSIgmv5yGKETfPGmMc7PRBgpn1574ByWHiByFB0b qDBRMGBn4RruVlpkHI2AuQ+0zAWhBQ5NVITixYmM+iInsIRWkfC0tUYJAjBzQtg40sV7 1wYaUJZhI6rQMIcbmsIbR2YBEpQJ6G1Y7KsKo2luebC07KJhsD325i+wCWPo2bXHthyb YSGWgDBoA9OopytlDxlWaS4J/b3Rbksc9XI6NlOfaHyb2Sgm7p8S7f5SqRYRkY3pd9yd bgzg== 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:from:cc:references:to:subject:arc-authentication-results; bh=UwazmX5oZKLNsOsczXq53ssd4JJ5E7eI8ZChBCMeSJk=; b=zpx2IqvdgEtt22Bai1XXkNAGzQ15BbsTCRkcTB6ky7Xc+dOcG/+cdGGORsVfyBU416 vqHDx726fv+Y3CnLPSLrEtI3c9B3zNcsLNJk+vuCcUp73SzQ03vK2zDJRToadSLenLPx ZgtHf74S8TN87J4Vsu+IqSF3EXPNRA7NEf0/5vmvFKhLu7WBGNq0iUlKxYXVTCthmFuR ebPr0U4jS/Wm4yVkZZwXtPH6OQKTkyWxWpmrxTb/jQ+6FdStCOpepWZbSIt2rGdj9cK8 aJk7IIN66Be0D7C+HEfncNByBpX//U5Iap7izahNFtum0ukIjOLZZ+23I0FOnXqL2QoS cJow== 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 p184si10426452pga.700.2018.03.26.10.40.20; Mon, 26 Mar 2018 10:40:36 -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; 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 S1752704AbeCZRjP (ORCPT + 99 others); Mon, 26 Mar 2018 13:39:15 -0400 Received: from mga14.intel.com ([192.55.52.115]:58056 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751908AbeCZRjM (ORCPT ); Mon, 26 Mar 2018 13:39:12 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2018 10:39:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,365,1517904000"; d="scan'208";a="38264255" Received: from ray.jf.intel.com (HELO [10.7.201.16]) ([10.7.201.16]) by orsmga003.jf.intel.com with ESMTP; 26 Mar 2018 10:39:11 -0700 Subject: Re: [PATCH 1/9] x86, pkeys: do not special case protection key 0 To: Ram Pai , Dave Hansen References: <20180323180903.33B17168@viggo.jf.intel.com> <20180323180905.B40984E6@viggo.jf.intel.com> <20180326173522.GB5743@ram.oc3035372033.ibm.com> Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, mpe@ellerman.id.au, mingo@kernel.org, akpm@linux-foundation.org, shuah@kernel.org From: Dave Hansen Message-ID: Date: Mon, 26 Mar 2018 10:39:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180326173522.GB5743@ram.oc3035372033.ibm.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 On 03/26/2018 10:35 AM, Ram Pai wrote: >> #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS >> if (cpu_feature_enabled(X86_FEATURE_OSPKE)) { >> - /* pkey 0 is the default and always allocated */ >> + /* pkey 0 is the default and allocated implicitly */ >> mm->context.pkey_allocation_map = 0x1; > In the second patch, you introduce DEFAULT_KEY. Maybe you > should introduce here and express the above code as > > mm->context.pkey_allocation_map = (0x1 << DEFAULT_KEY); > > Incase your default key changes to something else, you are still good. That's a good cleanup, but I'd rather limit _this_ set to bug fixes.