From nobody Thu Sep 11 14:12:07 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4930C636D6 for ; Fri, 17 Feb 2023 19:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbjBQTbe (ORCPT ); Fri, 17 Feb 2023 14:31:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbjBQTbZ (ORCPT ); Fri, 17 Feb 2023 14:31:25 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1349B5DE14 for ; Fri, 17 Feb 2023 11:31:21 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id m21-20020a05600c3b1500b003e1f5f2a29cso1734742wms.4 for ; Fri, 17 Feb 2023 11:31:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=grsecurity.net; s=grsec; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h3qVJ0bF2LOwR9FYE4JKJYonbraLFt3EzjvQr+HEt5I=; b=dDJnTYwngnWaEMzbUx4jZ16owZ0sQuT5enltrUeDwvsRnZTa0ZqUFeznb/4baviObx t+mRuQUNzNKeXtRe6pvoANi8rM4kQ1odHY5y1ACKAT+zWtZg1GxPJ9SsvSdrd2Bs3cVo kDmttHlvLfsqIbJnP3hg9dd7/QuOc/Kuz/qnGqK0bFNL7941EHNQvJmPy7y1fs9wHlTX 5QvSWkqXB3S5gJWtQpNUDA0cb2n4FIAKZhGtB9j0JrS/VVVCORkenW0VV/qAPT08cQKC BVPZn/LC+cnMNSfeAJCYI1xsgmJz3h24QGAileaI9c17I7NU66LYjfXA3IYX49EWP0LI Jzmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h3qVJ0bF2LOwR9FYE4JKJYonbraLFt3EzjvQr+HEt5I=; b=5i/t2971i3MRS22L03ptfSCfzbE9x2cTo6o+XHWV3Byf1cwYkMxFRJyN6KE+bUkDuo dVe6CLk5rZtwCptWX8OairbLYiJR/OYe2uin3/vH6PQVkq8Hs3uC41uFALADsp1gpaeE c7ufBrq5rqzvjupHqd+sMMhPzm810ubSAWTr6o4C2EAzPWfu1ZIMJkLpAAPFaTpBeGMv wHDgpsyJwqIaKu7FBQXYINoPdw6RGIg9LnjNmFhMH5afUQKbEIdGvC7dPLoUd/QxXmkz kRdH7mKcI4HNv2IALdWGbo0c0DpL1u5jG+E6rjXLgOIhXjsK6xAsOZjDsy2vn3drMKgJ nT1g== X-Gm-Message-State: AO0yUKXdLSiFYanBMJcxDj9kUQU6t/gqxYwU10QmrIGE+e/KA1EjUuNy sWnjthksz868/pkugQu3kNqbYg== X-Google-Smtp-Source: AK7set9FnlK5idA3iZnITZZN8lHm8p4XAS8BntZScEnhgNS2QLM37gJ5WgbduUThKUAlYlTQOqBLSg== X-Received: by 2002:a05:600c:180a:b0:3db:1434:c51a with SMTP id n10-20020a05600c180a00b003db1434c51amr1329698wmp.40.1676662279691; Fri, 17 Feb 2023 11:31:19 -0800 (PST) Received: from nuc.fritz.box (p200300f6af465a00bfa0a0965e5e0d85.dip0.t-ipconnect.de. [2003:f6:af46:5a00:bfa0:a096:5e5e:d85]) by smtp.gmail.com with ESMTPSA id u9-20020a05600c4d0900b003e1f2e43a1csm5393618wmp.48.2023.02.17.11.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Feb 2023 11:31:19 -0800 (PST) From: Mathias Krause To: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Mathias Krause Subject: [PATCH v2 1/2] KVM: x86: Shrink struct kvm_pmu Date: Fri, 17 Feb 2023 20:33:35 +0100 Message-Id: <20230217193336.15278-2-minipli@grsecurity.net> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230217193336.15278-1-minipli@grsecurity.net> References: <20230217193336.15278-1-minipli@grsecurity.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Move the 'version' member to the beginning of the structure to reuse an existing hole instead of introducing another one. This allows us to save 8 bytes for 64 bit builds. Signed-off-by: Mathias Krause --- arch/x86/include/asm/kvm_host.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_hos= t.h index 6aaae18f1854..43329c60a6b5 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -516,6 +516,7 @@ struct kvm_pmc { #define KVM_PMC_MAX_FIXED 3 #define KVM_AMD_PMC_MAX_GENERIC 6 struct kvm_pmu { + u8 version; unsigned nr_arch_gp_counters; unsigned nr_arch_fixed_counters; unsigned available_event_types; @@ -528,7 +529,6 @@ struct kvm_pmu { u64 global_ovf_ctrl_mask; u64 reserved_bits; u64 raw_event_mask; - u8 version; struct kvm_pmc gp_counters[KVM_INTEL_PMC_MAX_GENERIC]; struct kvm_pmc fixed_counters[KVM_PMC_MAX_FIXED]; struct irq_work irq_work; --=20 2.39.1 From nobody Thu Sep 11 14:12:07 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF250C05027 for ; Fri, 17 Feb 2023 19:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229843AbjBQTbg (ORCPT ); Fri, 17 Feb 2023 14:31:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229830AbjBQTbZ (ORCPT ); Fri, 17 Feb 2023 14:31:25 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46F275970E for ; Fri, 17 Feb 2023 11:31:21 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id x12-20020a05600c21cc00b003e00c739ce4so1577232wmj.5 for ; Fri, 17 Feb 2023 11:31:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=grsecurity.net; s=grsec; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8WSi6Yx8V8miujoCWlAIYCoROXEDMV4nQFAEHjGFqXc=; b=XaN+ZS6Q0gwXJELjlZ+dXx1Lg5XiD31tdHIYvcm2zbyWkJvBP6Ke7uBtdkGFnsTbh7 uRcsX3lNYZlv1u4Emwj1XXhlPVVh/hs6HYrmhqgJUnLDsd0OyJ2gzXuErd8uu4c4T8I7 XXuTyeEn7ps1KYwLMWmYjdQrX4nCDDqsHL1hduYTD7w7sZYe1Ynb/A6NxvmS1lPXxf8A SXGlJR9OJ0+cZJmvRLpAcn5lo4EQUV1hfQjWsmqRo9jQKIhYAyKsVjm1k8q4PJwYnrwX iAQxLB4LckyhDXZGQ2Koxo9W0W8g0A4xMLJdbYxqVbqU5xuJ0YpAG6eJ7q7AP3n+BBxN a/tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8WSi6Yx8V8miujoCWlAIYCoROXEDMV4nQFAEHjGFqXc=; b=y+yfnoOumrMap4l8SfvJIHIm0CxC9cEU4WJYPNLWNtHgXkWmRcVaOurX0KtQRyEHVh J+LeecQ8UkREchsoiqoLeUJBUK25pWI1EA0OztxsDV861E3F+Pr3DwRnfHjWkSSY5eW5 /6wZ+Ilak6pQvroUKB//UC8cwn+Ir4gI5fdjJBPUTW/ahSFlQl1F7JkeUi8GpGdCCMu1 IoovXuUyTZHicXJsT4o1K4J2bosKE3816RBDgvOgSo45PSi/wr8Kx4Y6rFQ9LUKyspza eifT+vsF0dwj0lwLI/rERSNyRAHx25KhdIkCMNHVMpm5gcu2BZ2XnQvWhEj1Yo9vB49z Khxg== X-Gm-Message-State: AO0yUKWOdlWYoez+YE9IXo6Y6lNemWUS15m0ZmEV90NxTpqWOdg/oA+y xRigLfcSh48Ht2PtPfP2I3KezQ== X-Google-Smtp-Source: AK7set9mBhbjWBQbVXwnRMh3ycSCnEMS4xykCEJmmL33SAA6mM/Q6hcBqqlF1TY/TdH9naEH7RQ2/w== X-Received: by 2002:a05:600c:3297:b0:3e2:1368:e395 with SMTP id t23-20020a05600c329700b003e21368e395mr5115275wmp.33.1676662280398; Fri, 17 Feb 2023 11:31:20 -0800 (PST) Received: from nuc.fritz.box (p200300f6af465a00bfa0a0965e5e0d85.dip0.t-ipconnect.de. [2003:f6:af46:5a00:bfa0:a096:5e5e:d85]) by smtp.gmail.com with ESMTPSA id u9-20020a05600c4d0900b003e1f2e43a1csm5393618wmp.48.2023.02.17.11.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Feb 2023 11:31:20 -0800 (PST) From: Mathias Krause To: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Mathias Krause Subject: [PATCH v2 2/2] KVM: Shrink struct kvm_mmu_memory_cache Date: Fri, 17 Feb 2023 20:33:36 +0100 Message-Id: <20230217193336.15278-3-minipli@grsecurity.net> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230217193336.15278-1-minipli@grsecurity.net> References: <20230217193336.15278-1-minipli@grsecurity.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Move the 'capacity' member around to make use of the padding hole on 64 bit systems instead of introducing yet another one. This allows us to save 8 bytes per instance for 64 bit builds of which, e.g., x86's struct kvm_vcpu_arch has a few. Signed-off-by: Mathias Krause --- v2: use order as suggested by Sean include/linux/kvm_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h index 76de36e56cdf..0b2ddce47f11 100644 --- a/include/linux/kvm_types.h +++ b/include/linux/kvm_types.h @@ -91,11 +91,11 @@ struct gfn_to_pfn_cache { * is topped up (__kvm_mmu_topup_memory_cache()). */ struct kvm_mmu_memory_cache { - int nobjs; gfp_t gfp_zero; gfp_t gfp_custom; struct kmem_cache *kmem_cache; int capacity; + int nobjs; void **objects; }; #endif --=20 2.39.1