From patchwork Sun Aug 7 20:57:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 108851 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BC654B6F75 for ; Mon, 8 Aug 2011 13:13:30 +1000 (EST) Received: from localhost ([::1]:40357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqAPo-0005vd-NO for incoming@patchwork.ozlabs.org; Sun, 07 Aug 2011 16:57:44 -0400 Received: from eggs.gnu.org ([140.186.70.92]:35848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqAPg-0005vV-QQ for qemu-devel@nongnu.org; Sun, 07 Aug 2011 16:57:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqAPf-00016z-Sy for qemu-devel@nongnu.org; Sun, 07 Aug 2011 16:57:36 -0400 Received: from mail-qy0-f173.google.com ([209.85.216.173]:57643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqAPf-00016v-MI for qemu-devel@nongnu.org; Sun, 07 Aug 2011 16:57:35 -0400 Received: by qyk31 with SMTP id 31so1381096qyk.4 for ; Sun, 07 Aug 2011 13:57:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=xmBGwUgzw8Z9YZ56lSEoLM2mkRebR7wmGTy1jZ1ADd4=; b=k3FBeK/vQ8w5KdLKF3ESIB8jZT/bDWozTirNnTQ4s3qz/LvoFVWGQmKw62VCS/qsjj rxsTe4N/CDl4ZBngFVs+zFoQy9WtunVG67+hSXkoWu9dgVWbm25+m89oAvxgAB3LRQyQ YgsndeE2Gbk724YrtpzctO8uvZhAnjGdmNtkE= Received: by 10.224.190.6 with SMTP id dg6mr1333654qab.332.1312750655182; Sun, 07 Aug 2011 13:57:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.37.82 with HTTP; Sun, 7 Aug 2011 13:57:15 -0700 (PDT) From: Blue Swirl Date: Sun, 7 Aug 2011 20:57:15 +0000 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.216.173 Subject: [Qemu-devel] [PATCH 01/11] slavio_timer: avoid structure holes spotted by pahole X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Report from pahole on amd64 host: struct SLAVIO_TIMERState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ uint32_t num_cpus; /* 5648 4 */ /* XXX 4 bytes hole, try to pack */ CPUTimerState cputimer[17]; /* 5656 816 */ /* --- cacheline 101 boundary (6464 bytes) was 8 bytes ago --- */ uint32_t cputimer_mode; /* 6472 4 */ /* size: 6480, cachelines: 102 */ /* sum members: 6472, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 16 bytes */ }; /* definitions: 1 */ struct CPUTimerState { qemu_irq irq; /* 0 8 */ ptimer_state * timer; /* 8 8 */ uint32_t count; /* 16 4 */ uint32_t counthigh; /* 20 4 */ uint32_t reached; /* 24 4 */ /* XXX 4 bytes hole, try to pack */ uint64_t limit; /* 32 8 */ uint32_t running; /* 40 4 */ /* size: 48, cachelines: 1 */ /* sum members: 40, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 48 bytes */ }; /* definitions: 1 */ Fix by rearranging the structures to avoid padding. Signed-off-by: Blue Swirl --- hw/slavio_timer.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) From 54eae070f9056790fa41b468360d23cdd17503f4 Mon Sep 17 00:00:00 2001 Message-Id: <54eae070f9056790fa41b468360d23cdd17503f4.1312750600.git.blauwirbel@gmail.com> From: Blue Swirl Date: Sun, 7 Aug 2011 19:00:23 +0000 Subject: [PATCH 01/11] slavio_timer: avoid structure holes spotted by pahole Report from pahole on amd64 host: struct SLAVIO_TIMERState { SysBusDevice busdev; /* 0 5648 */ /* --- cacheline 88 boundary (5632 bytes) was 16 bytes ago --- */ uint32_t num_cpus; /* 5648 4 */ /* XXX 4 bytes hole, try to pack */ CPUTimerState cputimer[17]; /* 5656 816 */ /* --- cacheline 101 boundary (6464 bytes) was 8 bytes ago --- */ uint32_t cputimer_mode; /* 6472 4 */ /* size: 6480, cachelines: 102 */ /* sum members: 6472, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 16 bytes */ }; /* definitions: 1 */ struct CPUTimerState { qemu_irq irq; /* 0 8 */ ptimer_state * timer; /* 8 8 */ uint32_t count; /* 16 4 */ uint32_t counthigh; /* 20 4 */ uint32_t reached; /* 24 4 */ /* XXX 4 bytes hole, try to pack */ uint64_t limit; /* 32 8 */ uint32_t running; /* 40 4 */ /* size: 48, cachelines: 1 */ /* sum members: 40, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 48 bytes */ }; /* definitions: 1 */ Fix by rearranging structures to avoid padding. Signed-off-by: Blue Swirl --- hw/slavio_timer.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c index 5511313..f18c8d7 100644 --- a/hw/slavio_timer.c +++ b/hw/slavio_timer.c @@ -48,16 +48,16 @@ typedef struct CPUTimerState { qemu_irq irq; ptimer_state *timer; uint32_t count, counthigh, reached; - uint64_t limit; - // processor only + /* processor only */ uint32_t running; + uint64_t limit; } CPUTimerState; typedef struct SLAVIO_TIMERState { SysBusDevice busdev; uint32_t num_cpus; - CPUTimerState cputimer[MAX_CPUS + 1]; uint32_t cputimer_mode; + CPUTimerState cputimer[MAX_CPUS + 1]; } SLAVIO_TIMERState; typedef struct TimerContext { -- 1.7.2.5