Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6679475ybi; Sun, 21 Jul 2019 23:32:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYaxLWmVe4v8nCOJh5CvueS8Fuy1t7bnsmRkCo/jZX9eB8OkyqPePFvhO/xDk8o8GBYZSe X-Received: by 2002:a17:902:9a04:: with SMTP id v4mr71541781plp.95.1563777130846; Sun, 21 Jul 2019 23:32:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563777130; cv=none; d=google.com; s=arc-20160816; b=USGTBBoiJOkO87VuRDPw0NM+nvLzzQaQ9lFoqOYH8ZwpLxqIPc3X2ZqTznvTOSaSUB KCZ8DjVRFfuWv7EykmTkgQ/1bzEgMXpICrrADL8mt/0Mxy5NC0DUz9PD5zAEBBzvO8jd gyWPnuGinO9bVNklFVVq6l9kath/HBtH39xfcDHyLSm3VB0Nr9LVHZ1iztE5NvMapu+a NdcqXxsT+efW/loWsZOeQ1YN6wp5RZoOxXbLv0dlomrtIvMRhyxoDdWc1QUM5DkYW7lh FpeSUf6K0RRVoBVrO4NOgY248k9fUcKvhCPqwvhFlVHpNqxKUbNhtUWwh15aR8Gx+vCc YCrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:dkim-signature; bh=65rbVI16xIdegJgwDcVu/UItkGEyabAWPfuMZFZ+8wM=; b=qIn4vfeO7ZgcyBRBjO35UK8IYlfFvmfHg+oabx/nYPvWPbpbD+Oea9Li5m8DRNoISL t1+76XWhGyHj5gAoq8KqaGY0lKM4udITK3pJfzmJdYxx9DJ6IIgyqT8aKJcPHDRTpAhl nLcr0ImMD5P6Ax6Yu8K4y149kPfLi95FJflL8tsXyR1E+xs9l4Z+ci8BssrpJzAHvqvO BNUOd3rZTHao0zaIfXCLAgQrlnoTMOVrsg2o2HyNm6l9UQGFIIRToMTRgdYadI75gQg8 xRVcuMO6oRMPSSdRv7JpcuYD03Avunj5e9FmEeePR66a/dHCBT7cLPUslptDt6wa5yLK H+GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=R4wzPPxb; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=WIsdSVMi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15si11489104pfg.87.2019.07.21.23.31.55; Sun, 21 Jul 2019 23:32:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=R4wzPPxb; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=WIsdSVMi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727540AbfGVGUu (ORCPT + 99 others); Mon, 22 Jul 2019 02:20:50 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:34776 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbfGVGUt (ORCPT ); Mon, 22 Jul 2019 02:20:49 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 2D5E28EE105; Sun, 21 Jul 2019 23:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1563776449; bh=ahMuxoX/qvj/gfm0bQ5fQvzg5E5oU/xYIVqpIcBDCbg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=R4wzPPxbwVDdAKgJuk+xSOQOJYBS35ViR5TiZjoGokzR1qWFh740jvzZEPFOvR1Q8 NqvCoahnv3hVPR4YIdIRRkZHjE66ASzKYmKOA6Xm4W40Bob/1KSrBzG/3EmRCQbLYc 7WOlk8LNxALetFppsp5vlafFIQRcGlLI/0qgVYEc= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fEakGxXLJvLk; Sun, 21 Jul 2019 23:20:49 -0700 (PDT) Received: from [192.168.222.208] (skyclub2.st.wakwak.ne.jp [61.115.125.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id F17BE8EE104; Sun, 21 Jul 2019 23:20:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1563776448; bh=ahMuxoX/qvj/gfm0bQ5fQvzg5E5oU/xYIVqpIcBDCbg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=WIsdSVMickE44AbsE0SlZWgi9YJxpmlVd7GFGR/sDSpSUnOvqr0eZEDK8OD+lbazO GSwddgIHat0j10QXufKHpqH5DVecVqvYGDx7i8ZwZzjp9mY6pLMdRVoWGyfjTNYcBt ZspD3PYlqATUvVSH5w23TGJGz+LpEYK6JkraDgd0= Message-ID: <1563776443.3223.8.camel@HansenPartnership.com> Subject: Re: [PATCH] unaligned: delete 1-byte accessors From: James Bottomley To: Alexey Dobriyan Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, axboe@kernel.dk, kvalo@codeaurora.org, john.johansen@canonical.com, linux-arch@vger.kernel.org Date: Mon, 22 Jul 2019 15:20:43 +0900 In-Reply-To: <20190722060744.GA24253@avx2> References: <20190721215253.GA18177@avx2> <1563750513.2898.4.camel@HansenPartnership.com> <20190722052244.GA4235@avx2> <1563774526.3223.2.camel@HansenPartnership.com> <20190722060744.GA24253@avx2> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-07-22 at 09:07 +0300, Alexey Dobriyan wrote: > On Mon, Jul 22, 2019 at 02:48:46PM +0900, James Bottomley wrote: > > On Mon, 2019-07-22 at 08:22 +0300, Alexey Dobriyan wrote: > > > On Mon, Jul 22, 2019 at 08:08:33AM +0900, James Bottomley wrote: > > > > On Mon, 2019-07-22 at 00:52 +0300, Alexey Dobriyan wrote: > > > > > Each and every 1-byte access is aligned! > > > > > > > > The design idea of this is for parsing descriptors. We simply > > > > chunk up the describing structure using get_unaligned for > > > > everything. The reason is because a lot of these structures > > > > come > > > > with reserved areas which we may make use of later. If we're > > > > using > > > > get_unaligned for everything we can simply change a u8 to a u16 > > > > in > > > > the structure absorbing the reserved padding. With your change > > > > now > > > > I'd have to chase down every byte access and replace it with > > > > get_unaligned instead of simply changing the structure. > > > > > > > > What's the significant advantage of this change that > > > > compensates > > > > for the problems the above causes? > > > > > > HW descriptors have fixed endianness, you're supposed to use > > > get_unaligned_be32() and friends. > > > > Not if this is an internal descriptor format, which is what this is > > mostly used for. > > Maybe, but developer is supposed to look at all struct member usages > while changing types, right? > > > > For that matter, drivers/scsi/ has exactly 2 get_unaligned() > > > calls > > > one of which can be changed to get_unaligned_be32(). > > > > You haven't answered the "what is the benefit of this change" > > question. > > I mean sure we can do it, but it won't make anything more > > efficient > > and it does help with the descriptor format to treat every > > structure > > field the same. > > The benefit is less code, come on. > > Another benefit is that typoing > > get_unaligned((u16*)p) > > for > get_unaligned((u8*)p) > > will get detected. Well, that's not the way it's supposed to be used. It's supposed to be used as struct desc { u8 something; u8 pad 1; u16 another; } __packed; something = get_unaligned[_le/be](&struct.something); So that the sizes are encoded in the descriptor structure. If you think it's badly documented, then please update that, I just don't see a benefit to a coding change that removes the u8 version of this because it makes our descriptor structure handling inconsistent. Even if we allow people are hard coding the typedef, then making u8 not work just looks inconsistent ... you could easily have typoed u32 for u16 in the example above and there would be no detection. James