From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1T1g0Y-0003mb-3a for mharc-qemu-trivial@gnu.org; Wed, 15 Aug 2012 11:59:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1g0U-0003aG-IM for qemu-trivial@nongnu.org; Wed, 15 Aug 2012 11:59:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1g0T-0007eA-F4 for qemu-trivial@nongnu.org; Wed, 15 Aug 2012 11:59:42 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:39238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1g0Q-0007dm-V0; Wed, 15 Aug 2012 11:59:39 -0400 Received: from localhost (v220110690675601.yourvserver.net.local [127.0.0.1]) by v220110690675601.yourvserver.net (Postfix) with ESMTP id C2619728002B; Wed, 15 Aug 2012 17:59:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at weilnetz.de Received: from v220110690675601.yourvserver.net ([127.0.0.1]) by localhost (v220110690675601.yourvserver.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gpnzFIqZ9-OQ; Wed, 15 Aug 2012 17:59:37 +0200 (CEST) Received: from [192.168.3.38] (p548B8CDB.dip0.t-ipconnect.de [84.139.140.219]) by v220110690675601.yourvserver.net (Postfix) with ESMTPSA id 3BCEF7280027; Wed, 15 Aug 2012 17:59:35 +0200 (CEST) Message-ID: <502BC75E.8060404@weilnetz.de> Date: Wed, 15 Aug 2012 17:59:26 +0200 From: Stefan Weil User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Stefan Hajnoczi References: <1344629007-23311-1-git-send-email-sw@weilnetz.de> <1344629007-23311-3-git-send-email-sw@weilnetz.de> <20120815141608.GJ10742@stefanha-thinkpad.localdomain> In-Reply-To: <20120815141608.GJ10742@stefanha-thinkpad.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 78.47.199.172 Cc: qemu-trivial@nongnu.org, Benjamin Herrenschmidt , qemu-devel@nongnu.org Subject: Re: [Qemu-trivial] [PATCH] srp: Don't use QEMU_PACKED for single elements of a structured type X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Aug 2012 15:59:43 -0000 Am 15.08.2012 16:16, schrieb Stefan Hajnoczi: > On Fri, Aug 10, 2012 at 10:03:27PM +0200, Stefan Weil wrote: >> QEMU_PACKED results in a MinGW compiler warning when it is >> used for single structure elements: >> >> warning: 'gcc_struct' attribute ignored >> >> Using QEMU_PACKED for the whole structure avoids the compiler warning >> without changing the memory layout. > Quick link for other reviewers: > http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Type-Attributes.html#Type-Attributes > >> Signed-off-by: Stefan Weil >> --- >> hw/srp.h | 8 ++++---- >> 1 files changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/hw/srp.h b/hw/srp.h >> index 3009bd5..5e0cad5 100644 >> --- a/hw/srp.h >> +++ b/hw/srp.h >> @@ -177,13 +177,13 @@ struct srp_tsk_mgmt { >> uint8_t reserved1[6]; >> uint64_t tag; >> uint8_t reserved2[4]; >> - uint64_t lun QEMU_PACKED; >> + uint64_t lun; >> uint8_t reserved3[2]; >> uint8_t tsk_mgmt_func; >> uint8_t reserved4; >> uint64_t task_tag; >> uint8_t reserved5[8]; >> -}; >> +} QEMU_PACKED; > Here I actually see a difference for the uint64_t task_tag field. > Previously it was not packed, now it is packed and because it has 4 * > uint8_t before it there will be a difference in layout. > > Looking at how QEMU accesses srp_tsk_mgmt, I think we're safe because we > never actually access task_tag? > > Ben: Any thoughts on this patch? > > Stefan 4 * uint8_t + 4 bytes from the packed lun, so there is no change for task_tag, it's always on a 8 byte boundary! Regards, Stefan From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1g0S-0003Y0-AE for qemu-devel@nongnu.org; Wed, 15 Aug 2012 11:59:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1g0R-0007ds-5S for qemu-devel@nongnu.org; Wed, 15 Aug 2012 11:59:40 -0400 Message-ID: <502BC75E.8060404@weilnetz.de> Date: Wed, 15 Aug 2012 17:59:26 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1344629007-23311-1-git-send-email-sw@weilnetz.de> <1344629007-23311-3-git-send-email-sw@weilnetz.de> <20120815141608.GJ10742@stefanha-thinkpad.localdomain> In-Reply-To: <20120815141608.GJ10742@stefanha-thinkpad.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] srp: Don't use QEMU_PACKED for single elements of a structured type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org Am 15.08.2012 16:16, schrieb Stefan Hajnoczi: > On Fri, Aug 10, 2012 at 10:03:27PM +0200, Stefan Weil wrote: >> QEMU_PACKED results in a MinGW compiler warning when it is >> used for single structure elements: >> >> warning: 'gcc_struct' attribute ignored >> >> Using QEMU_PACKED for the whole structure avoids the compiler warning >> without changing the memory layout. > Quick link for other reviewers: > http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Type-Attributes.html#Type-Attributes > >> Signed-off-by: Stefan Weil >> --- >> hw/srp.h | 8 ++++---- >> 1 files changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/hw/srp.h b/hw/srp.h >> index 3009bd5..5e0cad5 100644 >> --- a/hw/srp.h >> +++ b/hw/srp.h >> @@ -177,13 +177,13 @@ struct srp_tsk_mgmt { >> uint8_t reserved1[6]; >> uint64_t tag; >> uint8_t reserved2[4]; >> - uint64_t lun QEMU_PACKED; >> + uint64_t lun; >> uint8_t reserved3[2]; >> uint8_t tsk_mgmt_func; >> uint8_t reserved4; >> uint64_t task_tag; >> uint8_t reserved5[8]; >> -}; >> +} QEMU_PACKED; > Here I actually see a difference for the uint64_t task_tag field. > Previously it was not packed, now it is packed and because it has 4 * > uint8_t before it there will be a difference in layout. > > Looking at how QEMU accesses srp_tsk_mgmt, I think we're safe because we > never actually access task_tag? > > Ben: Any thoughts on this patch? > > Stefan 4 * uint8_t + 4 bytes from the packed lun, so there is no change for task_tag, it's always on a 8 byte boundary! Regards, Stefan