Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753841Ab1FTUj4 (ORCPT ); Mon, 20 Jun 2011 16:39:56 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:64981 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352Ab1FTUjz (ORCPT ); Mon, 20 Jun 2011 16:39:55 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] USB: ehci: use packed, aligned(4) instead of removing the packed attribute Date: Mon, 20 Jun 2011 22:39:31 +0200 User-Agent: KMail/1.13.6 (Linux/3.0.0-rc1nosema+; KDE/4.6.3; x86_64; ; ) Cc: Nicolas Pitre , gregkh@suse.de, linux-usb@vger.kernel.org, lkml , Rabin Vincent , Alan Stern , Alexander Holler References: <201106202207.23104.arnd@arndb.de> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201106202239.31997.arnd@arndb.de> X-Provags-ID: V02:K0:paOgCHTSdTz4UyuxgELeeNLLHK3Fl6dMO0RLQi6dLJs gdyhEf1pvxdWUZirYYPiSpU89m4H/EwF0BQ4Wm8GbXAPwBwzwz n2mgdXmFu3ZGHSzmFAoMJpAPAxCAcWB1YQeBQabS1h93RuYmuC 7PFf/6bGm3BcTDMjaZNxG5sVZ+I7unr8R+tSXL3lXrj8E+6EI+ TedSpUG1huQUENfWNHlbQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1790 Lines: 39 On Monday 20 June 2011 22:28:49 Nicolas Pitre wrote: > On Mon, 20 Jun 2011, Arnd Bergmann wrote: > > > On Monday 20 June 2011 19:39:34 Alexander Holler wrote: > > > That packed without an additional aligned() caused errors on ARM with > > > gcc 4.6 is another problem which got (currently) fixed by removing packed. > > > > Packed caused errors because it is *wrong*. The code as it was used undefined > > behavior in the language. > > I wouldn't call this issue as such, but this is a Red herring. > > Could you please provide a pointer to the structure definition so a > second opinion to the usefulness of __packed there could be provided? The structures in question are ehci_caps, ehci_regs and ehci_dbg_port. The patch that remove the __packed attribute was 139540170 "USB: ehci: remove structure packing from ehci_def". The reason why I consider it a bug is that an access to a register using readl/writel on the structure requires casting a pointer with byte alignment to a pointer with word alignment, which is undefined in C. Gcc just tries to be helpful and work around this by turning the access into bytewise load/store instructions. In older gcc versions, it would not do that if you happen to also case from non-volatile to volatile pointer, but according to Uli that was not an intentional feature of gcc but the ARM code just worked by pure coincidence. > If it is not matching any of the fairly limited cases where having > __packed is relevant then we can just confirm that it should go. It's already gone. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/