From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932368AbdJPT5Q (ORCPT ); Mon, 16 Oct 2017 15:57:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60172 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752620AbdJPT5O (ORCPT ); Mon, 16 Oct 2017 15:57:14 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7D05D356F9 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=mst@redhat.com Date: Mon, 16 Oct 2017 22:57:13 +0300 From: "Michael S. Tsirkin" To: Bart Van Assche Cc: Linus Torvalds , linux-scsi@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Leon Romanovsky , Andrew Morton Subject: Re: [PATCH v2] linux/types.h: Restore the ability to disable sparse endianness checks Message-ID: <20171016224241-mutt-send-email-mst@kernel.org> References: <20171016172633.29290-1-bart.vanassche@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171016172633.29290-1-bart.vanassche@wdc.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 16 Oct 2017 19:57:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 16, 2017 at 10:26:33AM -0700, Bart Van Assche wrote: > The purpose of patch "linux/types.h: enable endian checks for all > sparse builds" was to encourage driver authors to annotate > endianness correctly in their drivers. However, since that patch > went upstream no endianness annotations in drivers have been fixed. I doubt that's true. What's the basis for this claim? > I think that this shows that the followed approach does not work, > probably because several driver authors do not use sparse. For > developers who are not the authors of these drivers it would take > a very significant effort to make these drivers endianness clean. I'm afraid I still don't see it. For developers endian-ness is really easy. Look at hardware spec make sure code matches. You can often do without looking at the spec too, if a given field is always used with cpu_to_le, mark it __le. If you don't want to change driver code, you don't really need to run sparse on it. > Examples are drivers/scsi/qla2xxx and drivers/infiniband/hw/nes. These seem to be actively maintained. So post a patch, maintainers can look at the spec to help make sure annotations are right. > Hence restore the ability to disable sparse endianness checks such > that it becomes again easy to review other sparse diagnostics for > people who want to analyze drivers they are not the author of. What are these diagnostics that are important to analyze for people unable to make even trivial driver changes? White-listing these as opposed to black-listing endian-ness might be a better idea. > References: commit 05de97003c77 ("linux/types.h: enable endian checks for all sparse builds") > Signed-off-by: Bart Van Assche > Cc: linux-scsi@vger.kernel.org > Cc: linux-rdma@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: Michael S. Tsirkin > Cc: Christoph Hellwig > Cc: Leon Romanovsky > Cc: Andrew Morton > --- > [v2]: Elaborated patch description > > include/uapi/linux/types.h | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h > index 41e5914f0a8e..d3dcb0764c45 100644 > --- a/include/uapi/linux/types.h > +++ b/include/uapi/linux/types.h > @@ -23,7 +23,11 @@ > #else > #define __bitwise__ > #endif > +#if !defined(__CHECK_ENDIAN__) || __CHECK_ENDIAN__ != 0 > #define __bitwise __bitwise__ > +#else > +#define __bitwise > +#endif > > typedef __u16 __bitwise __le16; > typedef __u16 __bitwise __be16; > -- > 2.14.2