Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2747066rwd; Fri, 2 Jun 2023 14:11:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7xl+4H1W8rsBcdgucT/E/lEDkl/3dTDtRpU5nNWyyI80h/RhrQsdVGVcy5WtSt/2xqNYoH X-Received: by 2002:a05:6a20:a58c:b0:10d:3134:10d7 with SMTP id bc12-20020a056a20a58c00b0010d313410d7mr14851135pzb.27.1685740296631; Fri, 02 Jun 2023 14:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685740296; cv=none; d=google.com; s=arc-20160816; b=Ycxd4MX+cgqxA+aADUN3WUECD9sh4rwBcMcPcezuc/0WtRY6OG85JK7fQ2H7q93/NV 1C3mXhVaHzYaahlJ8PWZDoNDQFZKbwRqEE8CMZrcuwczmxjeA/1tLrcfOOYbPGNvwSe4 NAp02SYQbwjcJXIj2y9zrLYm1CY0QuhjSPkYZIUpaG3JdDzcBMb8gXLgQY/APhrya0AX 4Ik2btHgevjvYvHAZz/si/aUuICZ6V2NEHR3UojJEzMR6MhMdpikxORm7P0qSOwtlwpH tH38+aVRphNqZy6ZuIqkPb/AabWdVIDWTTFAS3/Wu1/4LISGknKAge2uQSjaNGrI9p4W dpyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=lEOehxHolb8X5C6iXhr+EWaD62m3RLxWc7FOFaBtkZ8=; b=TQhVAkhZ1iQ6/VklobxTtP+FNbW6Fi6HHAyY6GAbt64CLnLklTpu/ieWNNCVtpVfXt nJhTeD9ZnsdH8+9lX9WjAfqjXnJiBg+qk4F1AlOR1Ti9Sum6K/pWAJP8wUF/4vO1XzQq Zh6JiHVpv5JfR/4ib+LpQUeagoSpI9rnrXn6UIPFEGSj/SBF6TD6Xh0azEEB9HnEuct2 h/+yxEGB2cKYel6VE6gr9t2iIbHsPwMHv9aDDieyTKGCQlCAO/fM9ufJamJ/sKnFuyeM iGVEDXkn+0hM7vYVIbeT48EjLgKBPCmUcIOfxpa/5wN/0PdPRb1aGpPDaWrQnJGtYP/L 5ztQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=dHoGUlGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a18-20020aa78e92000000b0063b68fa0807si1290431pfr.263.2023.06.02.14.11.24; Fri, 02 Jun 2023 14:11:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=dHoGUlGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236364AbjFBU6p (ORCPT + 99 others); Fri, 2 Jun 2023 16:58:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236351AbjFBU6o (ORCPT ); Fri, 2 Jun 2023 16:58:44 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54CADE44 for ; Fri, 2 Jun 2023 13:58:43 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-51491b87565so3680815a12.1 for ; Fri, 02 Jun 2023 13:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685739522; x=1688331522; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=lEOehxHolb8X5C6iXhr+EWaD62m3RLxWc7FOFaBtkZ8=; b=dHoGUlGb6XDm2/Otv+ZRHMw+mt1C/1deZYgmb1PbQDWcaUrmU2KmSAc2kc2BTjcEz2 NVc7Xgvx3W/QvWW+44JfAtHoxd1VbKB7KChHIbhaEnSuiSn2NptrvubUZkLhtXF0Z3N/ pLFeC99wzH7h4avZxAHDNCaTWNG66rdKwJospxaGXQ66eg+eDbMAFnTfW6PhYM5bIhR+ bFc1eqdXjHS0/bbevi0iBBmuyG5m+Yg1Sjkc5eXPPCP0MIAziQzo5OPzx7bnJLMuPmAH C3m7/33P7BTRIEzOnELysCS3xEzRJY7vIPqDf24y+JQiYVE9kG0cs39LHmSxDbcqGFKO JWdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685739522; x=1688331522; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lEOehxHolb8X5C6iXhr+EWaD62m3RLxWc7FOFaBtkZ8=; b=ZBoBtm9bmN95Gs/B3RQjbQgm3+ZQjPbOcvdhGIHoz/giW3paErdLlbdf/l5HtWyXkF LPNKXuiP0WGo9vcZLC7LZ+7Iy0Cr4pYPFa05mdZVcTXnlO4xwQsurH9Yj/PDGiegt/k2 4+GJCl7G5So4RcP2BMHhlPPbuQCaH5w8PEMVWSA09m1HzkbuxCp2GMqgKX4pjP1uhjDs rWiNRrNNKo8hguD3L/VI8AuOpfcovpADd9rAIBcT8ZBoyVKHUDCCEDftjwZSEc+tHPYd zGU03u6qpYcnD9LM1xKl/aSAvP+uHJhxMIIYjxX/38LmD0LWWuajHLCEwc71qQI66IH0 I0Rw== X-Gm-Message-State: AC+VfDxy4NMPC4d0JElYOO+rVMMixKZx1LXmzFQKZWfiFv0SKx6Pugw2 PDirVqermBjREJJPX4/QsYcnsS49QJt0mwn1yzCJkQ== X-Received: by 2002:a17:907:9449:b0:96f:608c:5bdf with SMTP id dl9-20020a170907944900b0096f608c5bdfmr11859960ejc.64.1685739521701; Fri, 02 Jun 2023 13:58:41 -0700 (PDT) MIME-Version: 1.0 References: <20230602010550.785722-1-seanjc@google.com> In-Reply-To: From: Mingwei Zhang Date: Fri, 2 Jun 2023 13:58:05 -0700 Message-ID: Subject: Re: [PATCH] KVM: x86: Use cpu_feature_enabled() for PKU instead of #ifdef To: Jim Mattson Cc: Jon Kohler , Sean Christopherson , Paolo Bonzini , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > As we move towards enabling PKRU on the host, due to some customer > requests, I have to wonder if PKRU-disabled is the norm. > > In other words, is this a likely() or unlikely() optimization? I think it should be likely() as PKU was introduced very early in the Skylake-SP server cores many years ago. Today I think all recent client CPUs should have PKU on default if I am not mistaken. So yeah, adding a likely() probably should help prevent the compiler from evicting this code chunk to the end of function. Thanks. -Mingwei