linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@wdc.com>
To: "mst@redhat.com" <mst@redhat.com>
Cc: "torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"hch@infradead.org" <hch@infradead.org>,
	"leon@kernel.org" <leon@kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] linux/types.h: Restore the ability to disable sparse endianness checks
Date: Mon, 16 Oct 2017 21:26:36 +0000	[thread overview]
Message-ID: <1508189195.2493.55.camel@wdc.com> (raw)
In-Reply-To: <20171016224241-mutt-send-email-mst@kernel.org>

On Mon, 2017-10-16 at 22:57 +0300, Michael S. Tsirkin wrote:
> On Mon, Oct 16, 2017 at 10:26:33AM -0700, Bart Van Assche wrote:
> > 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.

You seem to assume that all drivers that are not yet endianness clean do
not contain any endianness conversion bugs. I severely doubt that that
assumption is correct. It is likely that it is not possible to make several
kernel drivers endianness clean due to endianness conversion bugs in such
drivers.

> > 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.

I don't have the time to delve deep in these two and the many other kernel
drivers that are not endianness clean. So please stop telling *me* that *I*
have to fix the endianness annotations in these drivers.

BTW, I think it should be mentioned here that you have tried to fix the
endianness annotations in the qla2xxx driver but once you noticed how 
complicated that task was that you gave up half-way. See also Michael
Tsirkin, [PATCH] scsi/qla2xxx: label endian-ness for many fields, 9 Dec
2016 (https://www.spinics.net/lists/linux-scsi/msg102739.html).

> > 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?

E.g. a spin_unlock() that is missing from an error path. Sparse can detect
such errors.

> White-listing these as opposed to black-listing endian-ness might be a
> better idea.

As explained in a previous e-mail, any approach that suppresses endianness
error messages automatically makes it easier for driver authors to ignore
endianness error messages. This is why I prefer that if endianness error
messages are suppressed that this happens manually. Hence the patch at the
start of this e-mail thread that restores __CHECK_ENDIAN__.

Bart.

  reply	other threads:[~2017-10-16 21:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 17:26 [PATCH v2] linux/types.h: Restore the ability to disable sparse endianness checks Bart Van Assche
     [not found] ` <20171016172633.29290-1-bart.vanassche-Sjgp3cTcYWE@public.gmane.org>
2017-10-16 19:57   ` Michael S. Tsirkin
2017-10-16 21:26     ` Bart Van Assche [this message]
     [not found]       ` <1508189195.2493.55.camel-Sjgp3cTcYWE@public.gmane.org>
2017-10-23 18:22         ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1508189195.2493.55.camel@wdc.com \
    --to=bart.vanassche@wdc.com \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).