RE: [PATCH v2 03/39] megaraid_sas: raid 1 fast path code optimize

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

 



> > +static inline void
> > +megasas_complete_r1_command(struct megasas_instance *instance,
> > +			    struct megasas_cmd_fusion *cmd) {
> > +	u8 *sense, status, ex_status;
> > +	u32 data_length;
> > +	u16 peer_smid;
> > +	struct fusion_context *fusion;
> > +	struct megasas_cmd_fusion *r1_cmd = NULL;
> > +	struct scsi_cmnd *scmd_local = NULL;
> > +	struct RAID_CONTEXT_G35 *rctx_g35;
> > +
> > +	rctx_g35 = &cmd->io_request->RaidContext.raid_context_g35;
> > +	fusion = instance->ctrl_context;
> > +	peer_smid = le16_to_cpu(rctx_g35->smid.peer_smid);
> > +
> > +	r1_cmd = fusion->cmd_list[peer_smid - 1];
> > +	scmd_local = cmd->scmd;
> > +	status = rctx_g35->status;
> > +	ex_status = rctx_g35->ex_status;
> > +	data_length = cmd->io_request->DataLength;
> > +	sense = cmd->sense;
> > +
> > +	cmd->cmd_completed = true;
>
> Please help me understand how this works
> - there are two peer commands sent to the controller
> - both are completed and the later calls scsi_done and returns both
r1_cmd
> + cmd
> - if both commands can be completed at the same time, is it possible
that
> the
>   above line is executed at the same moment for both completions ?
> How is the code  protected against a double completion when both
> completed commands see the peer cmd_completed as set ?


Tomas,  cmd and r1_cmd (part of  same Raid 1 FP) will be always completed
on same reply queue by firmware. That is one of the key requirement here
for raid 1 fast path.
What you ask is possible if FW completes cmd and r1_cmd on different reply
queue. If you notice when we clone r1_cmd, we also clone MSI-x index from
parent command.
So eventually, FW is aware of binding of both cmd and r1_cmd w.r.t reply
queue index.

` Kashyap

>
> > +



[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