Re: [PATCH 4/4] scsi: Trace SCSI sense data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 02, 2023 at 01:31:10PM -0700, Bart Van Assche wrote:
> On 5/2/23 02:52, Niklas Cassel wrote:
> > i.e., something like:
> > 	if (cmd->sense_buffer && SCSI_SENSE_VALID(cmd) &&
> > 	    scsi_command_normalize_sense(cmd, &sshdr)) {
> > 
> > instead of cmd->result & 0xff.
> 
> Hmm ... doesn't the SCSI_SENSE_VALID() check above duplicate the
> scsi_sense_valid() check inside scsi_command_normalize_sense()?

scsi_command_normalize_sense() calls scsi_normalize_sense(),
so that is a function call.

scsi_normalize_sense() then performs a memset(),
a null pointer check on sense_buffer, and length check on sb_len,
then assigns sshdr->response_code, then calls scsi_sense_valid(),
and returns if not valid.


Considering that this tracepoint is called by scsi_done_internal(),
this tracepoint will be called for all SCSI commands (and not just
timed out commands).

I'm not sure how much overhead the function call, memset, and
assignment is, but I would guess that it is not free, and since
this is done for all commands, I would assume that we waste less
CPU cycles by simply checking SCSI_SENSE_VALID() beforehand.


Kind regards,
Niklas



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux