From patchwork Fri Dec 13 21:06:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 850289 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1732242wry; Fri, 13 Dec 2024 13:07:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUwbLxg8K6D3Sr7S3rOjlwnkAIRzjXJVJvCfXHQ9azAqZt1IBs0aGpcMCiRiYD6FeZm+RVz/A==@linaro.org X-Google-Smtp-Source: AGHT+IEza8NWoG2pfoKynSGu/N7aXnPJnwqm5YTcd3CCG+sRt5PFoACgh2xAc5ubfYoauZxcSN0o X-Received: by 2002:a05:6214:3002:b0:6d9:429:ab4b with SMTP id 6a1803df08f44-6db0f241e68mr106838696d6.0.1734124066583; Fri, 13 Dec 2024 13:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734124066; cv=none; d=google.com; s=arc-20240605; b=Y6dPQO69MBT2GTCsQEsdusQdm30agrgPBixQWNS7ZzJcAIdHOmIMKoXw6uKNx8nIkw RWldoeYQHaixstzDa3etHyv8fDlcym1C7RDmh8UvSvOS4tG0yif3VMRISOsQynJ5UWQh oVBa7Wmf63ipyptpyGXFZDb8u2fWQxt2raDWy/UzSMWbd4Acu6iOUMPodDCFlwqxsqm+ yYSC00yBeetqd3vEPoO0hOm6xQiqUOnW1JSiaY4EJB5mC0TSUcesDEl8aSogxpOkco+E ch3cUlr8+lKTPjFURJdikMhIxmB1+3er+m8pELNqtmxzSKcjrMnv+ufIdvg2d0vwCEsB ScDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=A2kbupBtdaf8sZ/EHMZkFvb/iOEYsdgwFCiDb5bgoRo=; fh=5Zxh8ftkOfDJj4mOTO4wsqqTQTjNzePoZT5UHqAmZaY=; b=iZ79Q4tHm20FQLTby/fGuWCHu6EUzKncw64hlHyTpQlfjlX+MwCR4MRLEcwrMTZ1Wt y4/JSRW6VXzWzA50rzkv9GaVGiyH2Su80/X7toHSUjteBGPaRR6mzHlk7DJYn7r1Ipu6 Ui8sGyBVmxeK5JqhXtMxAbOUyvoeyYTmmsIPqrfDetZS3vpIFUT5cKEnbm531J8Sc6MG 66oMGNnjDDAni3u7lhNWWU+iL6tTvAEx0V88EuhLxwUmjQswScj130kI4WENp67BkHuT fRoj8RpXaJxFF/7v408jIhiK971EpO1DHKRPDnR/zw48cJB/2RzyPJ0KZNJ1MJkO8QXb A3kA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aymCnmrH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6dccd34b507si2903716d6.209.2024.12.13.13.07.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Dec 2024 13:07:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aymCnmrH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tMCs4-00070W-MZ; Fri, 13 Dec 2024 16:06:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tMCry-00070F-7t for qemu-devel@nongnu.org; Fri, 13 Dec 2024 16:06:42 -0500 Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tMCrw-0004vJ-CQ for qemu-devel@nongnu.org; Fri, 13 Dec 2024 16:06:42 -0500 Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-6d89a727a19so31798896d6.0 for ; Fri, 13 Dec 2024 13:06:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734123998; x=1734728798; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=A2kbupBtdaf8sZ/EHMZkFvb/iOEYsdgwFCiDb5bgoRo=; b=aymCnmrH+KqxRRyfjrnF3snlVigb6qqkeLnKxXFll6eiinauhOwhd4L1yDIoL9Sk+q 50Z9bBzNE9JON4F+eNRYBgBbKVvDc0itMOSeSfyExZlyl4nyVPwDoLsA+7+NmiTKqfqW KvN/768CaGMDBD82zvQphlpDFgjHT8ZcaHdwm64KUH4/hi6/c8OzLaLSOjG/x7YqIiaH oEIcH918S15DOBS5JR4p2smzZilNVV5GsMDC7r7Cg1RBjKkwIey1Zo/RCSw69+rgIDFx VoAq53vi64cqeqeucYh9Z1mOBzFDDM9xZOh8ZZZfePWXGEWhlKE2Ccvol4faq2IWtdu1 wVPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734123998; x=1734728798; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=A2kbupBtdaf8sZ/EHMZkFvb/iOEYsdgwFCiDb5bgoRo=; b=gfIsmEbMk/mCpedtSLhfZVMN0+UW6H06+wGdorUILXy4+fVYx1FchPTeRlhpVDDwjF BnRSS/z3XqVTUC0I0LkQ573S3lwFW3cmXEuPKq2FYxAeLeUh8YHHiEDmgD/ENpkXZBSg PxAjlfh6oHY76SgITkiQQ/67sGs2QqyD3pMW9UnaFXERbMXSC3ncDeCRoGF1ql5pUMZ1 c+5RyMbSxWD4UII23nmenFBCzBSAkUqdncT697ue2Cwwgyv0LuHArK78uUs8RQanPClV EaWlJkRHjMkXNCdXE9OlR8KRfl9JoSBBLaMdiuuoe1kuMZexm3mvnY2wWxkaxz6+jYvR VkWg== X-Gm-Message-State: AOJu0Ywh2ucmK7ssTjIUjoDZxb13KrpBxF+qK1CpNENOL2DY/B+qpT26 9/SA4XWInUcXOQCQarGrdLcPR/pvajI0T2dQ+8zLQrQjQxGlfzi970sakUpbtSv1J8DVU9hYBfW hKWZdS/tI X-Gm-Gg: ASbGnctLYsuRpAxVTGrrUCaJ/wuBAgNhwOFfGbYZENPn1opUSLpHZpkvBQAUV3WGPk9 yIIeQfoBYhXmWVztBY4vAz6nYBfyP6fbQADpZrUQmYOgXAduGJrVTbuKw1rpW7wTW5GY+aQOFtO EqQkh74KoFJ5cJBbJd5hnbkD8+B1Kr/dZZ/RKBJ2cHu9FizctEjtUJmDA7YlVF52Yc7C/P/2GCL x9NaZABnoulnuZg6A8BjZyJzcUpL5t+wCU3NVwWqFugur2UAGsOIQ/7l4ac/PYl X-Received: by 2002:a05:6214:f03:b0:6d8:f50e:8036 with SMTP id 6a1803df08f44-6db0f4e049cmr99111536d6.20.1734123997908; Fri, 13 Dec 2024 13:06:37 -0800 (PST) Received: from stoup.. ([187.217.227.247]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dccd257d49sm1256026d6.38.2024.12.13.13.06.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 13:06:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost Subject: [PATCH] include/hw/qdev-properties: Shrink struct Property by 8 bytes Date: Fri, 13 Dec 2024 15:06:29 -0600 Message-ID: <20241213210629.2525655-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f29; envelope-from=richard.henderson@linaro.org; helo=mail-qv1-xf29.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Before, via pahole: arm32, a 32-bit host which aligns uint64_t: struct Property { const char * name; /* 0 4 */ const PropertyInfo * info; /* 4 4 */ ptrdiff_t offset; /* 8 4 */ uint8_t bitnr; /* 12 1 */ /* XXX 3 bytes hole, try to pack */ uint64_t bitmask; /* 16 8 */ _Bool set_default; /* 24 1 */ /* XXX 7 bytes hole, try to pack */ union { int64_t i; /* 32 8 */ uint64_t u; /* 32 8 */ } defval; /* 32 8 */ int arrayoffset; /* 40 4 */ const PropertyInfo * arrayinfo; /* 44 4 */ int arrayfieldsize; /* 48 4 */ const char * link_type; /* 52 4 */ /* size: 56, cachelines: 1, members: 11 */ /* sum members: 46, holes: 2, sum holes: 10 */ }; arm64, an arbitrary 64-bit host: struct Property { const char * name; /* 0 8 */ const PropertyInfo * info; /* 8 8 */ ptrdiff_t offset; /* 16 8 */ uint8_t bitnr; /* 24 1 */ /* XXX 7 bytes hole, try to pack */ uint64_t bitmask; /* 32 8 */ _Bool set_default; /* 40 1 */ /* XXX 7 bytes hole, try to pack */ union { int64_t i; /* 48 8 */ uint64_t u; /* 48 8 */ } defval; /* 48 8 */ int arrayoffset; /* 56 4 */ /* XXX 4 bytes hole, try to pack */ const PropertyInfo * arrayinfo; /* 64 8 */ int arrayfieldsize; /* 72 4 */ /* XXX 4 bytes hole, try to pack */ const char * link_type; /* 80 8 */ /* size: 88, cachelines: 2, members: 11 */ /* sum members: 66, holes: 4, sum holes: 22 */ }; Afterward there are no holes in either structure. For arm32, size 48, padding 2, saved 8 bytes. For arm64, size 72, padding 6, saved 16 bytes. Signed-off-by: Richard Henderson --- include/hw/qdev-properties.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 26ebd23068..1d154c1f23 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -16,17 +16,17 @@ struct Property { const char *name; const PropertyInfo *info; ptrdiff_t offset; - uint8_t bitnr; + const char *link_type; uint64_t bitmask; - bool set_default; union { int64_t i; uint64_t u; } defval; - int arrayoffset; const PropertyInfo *arrayinfo; + int arrayoffset; int arrayfieldsize; - const char *link_type; + uint8_t bitnr; + bool set_default; }; struct PropertyInfo {