* Re: [PATCH] linux/types.h: Restore the ability to disable sparse endianness checks
[not found] ` <1508162253.2728.1.camel@wdc.com>
@ 2017-10-16 15:27 ` Michael S. Tsirkin
2017-10-16 15:36 ` Bart Van Assche
0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2017-10-16 15:27 UTC (permalink / raw)
To: Bart Van Assche
Cc: hch@lst.de, linux-kernel@vger.kernel.org,
torvalds@linux-foundation.org, qla2xxx-upstream,
James E.J. Bottomley, Martin K. Petersen, linux-scsi
On Mon, Oct 16, 2017 at 01:57:35PM +0000, Bart Van Assche wrote:
> On Mon, 2017-10-16 at 16:34 +0300, Michael S. Tsirkin wrote:
> > I don't see how it'll help make things better. OTOH if the specific
> > drivers are tagged in the makefile, they can be gradually moved out to
> > staging or something to help trigger action.
>
> Do you really want to move drivers like qla2xxx to staging? That driver is
> important to multiple enterprise distro's.
>
> Bart.
Frankly I'm surprised this one has sparse issues.
Really e.g. drivers/scsi/qla2xxx/qla_nvme.h is new from June 2017.
It's not some ancient piece of code that no one understands so
we are afraid to touch it.
So if you care, why don't you just fix it up? I suspect it's a question
of just tagging structure fields properly.
Here's a patch fixing up one of the files in that driver.
--->
qla2xxx: make qla_nvme sparse clean
Without looking into what it actually does, just add annotations so
sparse does not complain. Separately, the handle field in cmd_nvme which
isn't tagged as LE should be examined for endian-ness by someone who
understands this hardware. If it actually needs to be native endian, a
comment explaining why would be a good idea.
Similarly for cur_dsd which seems to mix LE and native data.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index f3710a7..05ab549 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -442,7 +442,7 @@ static int qla2x00_start_nvme_mq(srb_t *sp)
req->ring_ptr++;
}
cont_pkt = (cont_a64_entry_t *)req->ring_ptr;
- *((uint32_t *)(&cont_pkt->entry_type)) =
+ *((__le32 *)(&cont_pkt->entry_type)) =
cpu_to_le32(CONTINUE_A64_TYPE);
cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
@@ -450,9 +450,9 @@ static int qla2x00_start_nvme_mq(srb_t *sp)
}
sle_dma = sg_dma_address(sg);
- *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
- *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
- *cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
+ *(__le32 __force *)cur_dsd++ = cpu_to_le32(LSD(sle_dma));
+ *(__le32 __force *)cur_dsd++ = cpu_to_le32(MSD(sle_dma));
+ *(__le32 __force *)cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
avail_dsds--;
}
diff --git a/drivers/scsi/qla2xxx/qla_nvme.h b/drivers/scsi/qla2xxx/qla_nvme.h
index dfe56f2..da58bd1 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.h
+++ b/drivers/scsi/qla2xxx/qla_nvme.h
@@ -39,32 +39,32 @@ struct cmd_nvme {
uint8_t entry_status; /* Entry Status. */
uint32_t handle; /* System handle. */
- uint16_t nport_handle; /* N_PORT handle. */
- uint16_t timeout; /* Command timeout. */
+ __le16 nport_handle; /* N_PORT handle. */
+ __le16 timeout; /* Command timeout. */
- uint16_t dseg_count; /* Data segment count. */
- uint16_t nvme_rsp_dsd_len; /* NVMe RSP DSD length */
+ __le16 dseg_count; /* Data segment count. */
+ __le16 nvme_rsp_dsd_len; /* NVMe RSP DSD length */
uint64_t rsvd;
- uint16_t control_flags; /* Control Flags */
+ __le16 control_flags; /* Control Flags */
#define CF_NVME_ENABLE BIT_9
#define CF_DIF_SEG_DESCR_ENABLE BIT_3
#define CF_DATA_SEG_DESCR_ENABLE BIT_2
#define CF_READ_DATA BIT_1
#define CF_WRITE_DATA BIT_0
- uint16_t nvme_cmnd_dseg_len; /* Data segment length. */
- uint32_t nvme_cmnd_dseg_address[2]; /* Data segment address. */
- uint32_t nvme_rsp_dseg_address[2]; /* Data segment address. */
+ __le16 nvme_cmnd_dseg_len; /* Data segment length. */
+ __le32 nvme_cmnd_dseg_address[2]; /* Data segment address. */
+ __le32 nvme_rsp_dseg_address[2]; /* Data segment address. */
- uint32_t byte_count; /* Total byte count. */
+ __le32 byte_count; /* Total byte count. */
uint8_t port_id[3]; /* PortID of destination port. */
uint8_t vp_index;
- uint32_t nvme_data_dseg_address[2]; /* Data segment address. */
- uint32_t nvme_data_dseg_len; /* Data segment length. */
+ __le32 nvme_data_dseg_address[2]; /* Data segment address. */
+ __le32 nvme_data_dseg_len; /* Data segment length. */
};
#define PT_LS4_REQUEST 0x89 /* Link Service pass-through IOCB (request) */
--
MST
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] linux/types.h: Restore the ability to disable sparse endianness checks
2017-10-16 15:27 ` [PATCH] linux/types.h: Restore the ability to disable sparse endianness checks Michael S. Tsirkin
@ 2017-10-16 15:36 ` Bart Van Assche
2017-10-16 16:50 ` Michael S. Tsirkin
0 siblings, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2017-10-16 15:36 UTC (permalink / raw)
To: mst@redhat.com
Cc: hch@lst.de, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org, torvalds@linux-foundation.org,
qla2xxx-upstream@qlogic.com, martin.petersen@oracle.com,
jejb@linux.vnet.ibm.com
On Mon, 2017-10-16 at 18:27 +0300, Michael S. Tsirkin wrote:
> On Mon, Oct 16, 2017 at 01:57:35PM +0000, Bart Van Assche wrote:
> > On Mon, 2017-10-16 at 16:34 +0300, Michael S. Tsirkin wrote:
> > > I don't see how it'll help make things better. OTOH if the specific
> > > drivers are tagged in the makefile, they can be gradually moved out to
> > > staging or something to help trigger action.
> >
> > Do you really want to move drivers like qla2xxx to staging? That driver is
> > important to multiple enterprise distro's.
>
> Frankly I'm surprised this one has sparse issues.
> Really e.g. drivers/scsi/qla2xxx/qla_nvme.h is new from June 2017.
>
> It's not some ancient piece of code that no one understands so
> we are afraid to touch it.
Sorry if I wasn't clear enough but I wasn't referring to the qla2xxx NVMe
code. I was referring to the qla2xxx FC initiator code. I think that code
went upstream in January 2004. See also
https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/log/drivers/scsi/qla2xxx?ofs=100
Bart.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] linux/types.h: Restore the ability to disable sparse endianness checks
2017-10-16 15:36 ` Bart Van Assche
@ 2017-10-16 16:50 ` Michael S. Tsirkin
2017-10-16 17:36 ` Bart Van Assche
0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2017-10-16 16:50 UTC (permalink / raw)
To: Bart Van Assche
Cc: hch@lst.de, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org, torvalds@linux-foundation.org,
qla2xxx-upstream@qlogic.com, martin.petersen@oracle.com,
jejb@linux.vnet.ibm.com
On Mon, Oct 16, 2017 at 03:36:50PM +0000, Bart Van Assche wrote:
> On Mon, 2017-10-16 at 18:27 +0300, Michael S. Tsirkin wrote:
> > On Mon, Oct 16, 2017 at 01:57:35PM +0000, Bart Van Assche wrote:
> > > On Mon, 2017-10-16 at 16:34 +0300, Michael S. Tsirkin wrote:
> > > > I don't see how it'll help make things better. OTOH if the specific
> > > > drivers are tagged in the makefile, they can be gradually moved out to
> > > > staging or something to help trigger action.
> > >
> > > Do you really want to move drivers like qla2xxx to staging? That driver is
> > > important to multiple enterprise distro's.
> >
> > Frankly I'm surprised this one has sparse issues.
> > Really e.g. drivers/scsi/qla2xxx/qla_nvme.h is new from June 2017.
> >
> > It's not some ancient piece of code that no one understands so
> > we are afraid to touch it.
>
> Sorry if I wasn't clear enough but I wasn't referring to the qla2xxx NVMe
> code. I was referring to the qla2xxx FC initiator code. I think that code
> went upstream in January 2004. See also
> https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/log/drivers/scsi/qla2xxx?ofs=100
>
> Bart.
Right but qla_nvme also triggers these warnings. That's the problem with
disabling them tree-wide. To me it looks like the time we are spending
arguing about work-arounds would be better spent just fixing the
majority of the code. If a couple of places aren't clean and
need more thought, that's not a big deal.
--
MST
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] linux/types.h: Restore the ability to disable sparse endianness checks
2017-10-16 16:50 ` Michael S. Tsirkin
@ 2017-10-16 17:36 ` Bart Van Assche
0 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2017-10-16 17:36 UTC (permalink / raw)
To: mst@redhat.com
Cc: hch@lst.de, linux-kernel@vger.kernel.org, jejb@linux.vnet.ibm.com,
linux-scsi@vger.kernel.org, qla2xxx-upstream@qlogic.com,
martin.petersen@oracle.com, torvalds@linux-foundation.org
On Mon, 2017-10-16 at 19:50 +0300, Michael S. Tsirkin wrote:
> Right but qla_nvme also triggers these warnings. That's the problem with
> disabling them tree-wide. To me it looks like the time we are spending
> arguing about work-arounds would be better spent just fixing the
> majority of the code. If a couple of places aren't clean and
> need more thought, that's not a big deal.
Making the drivers that are not endianness clean mostly clean is risky. Such
changes would most likely be done by someone who is not the driver author.
Anyone who tries to fix endianness annotations without having a firmware
manual available risks to introduce incorrect endianness annotations. Such
annotations can make code more confusing instead of less.
Bart.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-16 17:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20171006172353.16758-1-bart.vanassche@wdc.com>
[not found] ` <20171009162008-mutt-send-email-mst@kernel.org>
[not found] ` <1507561661.2674.3.camel@wdc.com>
[not found] ` <20171009204139-mutt-send-email-mst@kernel.org>
[not found] ` <1507653494.2815.27.camel@wdc.com>
[not found] ` <20171016160316-mutt-send-email-mst@kernel.org>
[not found] ` <1508162253.2728.1.camel@wdc.com>
2017-10-16 15:27 ` [PATCH] linux/types.h: Restore the ability to disable sparse endianness checks Michael S. Tsirkin
2017-10-16 15:36 ` Bart Van Assche
2017-10-16 16:50 ` Michael S. Tsirkin
2017-10-16 17:36 ` Bart Van Assche
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).