Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp964318pxj; Sat, 8 May 2021 04:05:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy86C1ByW8tahXOFhl58dKiYCiXMtSwR74TkyvFH852oa/fs98u/MJX7JE9aosk0qTvOpC0 X-Received: by 2002:a65:6a49:: with SMTP id o9mr10818118pgu.165.1620471936817; Sat, 08 May 2021 04:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620471936; cv=none; d=google.com; s=arc-20160816; b=OraSEswrztLgXbQCRYjTeOLu06ollKFKxyy7crFpV46DRsQMK5gGIn5MrO4UgSHJpP iI/0mYLg0o5AdR+XzMgknXoFFy9QuzM0X/Wu3jJfFpqt9AdvC4wFwFzGVjmB8WH1v1h0 PFO+GB+Zpc2OJKLluDonZppev05ScZekJgAJJ7Ck1VymLOwCWz51ps7vXKd1F02Y9+Mf XFIJN/61Sr4LLJRw80psOymJ1HNaN6i/3zp0EVS+kdej3vWLfXXXjTkFSToiarZdQm0q UGVW6ucOi6g3Kr9hjQEXVlBGYnxnH6kbwWF4tPyi3rc4nj+LAcFM0ci+cnkDPYs8LJN5 /baw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=CDnrwz+QZgTSps6ogb1fHc8E4uPMipAwJkRyg79rXFc=; b=uNvHvU3f7jNrl7aGyb8DwuDneVfHEpdhGARgZnlRNDN6kwpwLuyDTSoKSMHyVOFObD /YM9QsGfTg385MhtrH4EfIAqrtW9oFFtOY7kohug55Sc8hENigU0l6Q5gcCzLdGzzcPI VSC7mLHYCIK7m6Iwd1rfeDA/6TbDgmMIicU/NEuHO71ux2Hex56hMzdMymK5nVKGcd9c Q4qvsoPI5+zfTwNK+P8xkCAlH40C10uHUQhJqFUW51eZx3BqD1uA98DOhDlQEHlQKpvp hNMsb1pnhewX1E2jFbwZkGRz7yojoDlMpatSkde1FRey8quC9VYFqJgxp7zHMlSHecBR INKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si10477073plx.348.2021.05.08.04.05.23; Sat, 08 May 2021 04:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230257AbhEHLEb convert rfc822-to-8bit (ORCPT + 99 others); Sat, 8 May 2021 07:04:31 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:24759 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230421AbhEHLEb (ORCPT ); Sat, 8 May 2021 07:04:31 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-191-OEKsvDw3MEKmKE6L22NZbQ-1; Sat, 08 May 2021 12:03:22 +0100 X-MC-Unique: OEKsvDw3MEKmKE6L22NZbQ-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 8 May 2021 12:03:20 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.015; Sat, 8 May 2021 12:03:20 +0100 From: David Laight To: 'Arnd Bergmann' , "linux-arch@vger.kernel.org" CC: Linus Torvalds , Vineet Gupta , Arnd Bergmann , "linux-kernel@vger.kernel.org" Subject: RE: [RFC 12/12] asm-generic: simplify asm/unaligned.h Thread-Topic: [RFC 12/12] asm-generic: simplify asm/unaligned.h Thread-Index: AQHXQ44THJRTTBSqUkSVDsewAlm13qrZaWdA Date: Sat, 8 May 2021 11:03:20 +0000 Message-ID: <0b599cc80612436bb8d688fa2ad1dc34@AcuMS.aculab.com> References: <20210507220813.365382-1-arnd@kernel.org> <20210507220813.365382-13-arnd@kernel.org> In-Reply-To: <20210507220813.365382-13-arnd@kernel.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann > Sent: 07 May 2021 23:08 > > The get_unaligned()/put_unaligned() implementations are much more complex > than necessary, now that all architectures use the same code. > ... > +#define __get_unaligned_t(type, ptr) ({ \ > + const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ > + __pptr->x; \ > +}) I thought gcc was likely to track through the alignment of the variable holding the source pointer (through any (void *) casts implied by inlined function calls) through to the pointer used for the actual access - so it would tend to issue a single instruction that assumed an aligned address. I know that has caused grief trying to copy unaligned data to an aligned structure. Possibly adding: asm ("" :: "+r" (__pptr)) ); in the middle stops that assumption without generating any code. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)