From: Daniel Wagner <dwagner@suse.de>
To: Bart Van Assche <bvanassche@acm.org>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
linux-scsi@vger.kernel.org,
Himanshu Madhani <hmadhani@marvell.com>,
Quinn Tran <qutran@marvell.com>, Martin Wilck <mwilck@suse.com>,
Roman Bolshakov <r.bolshakov@yadro.com>
Subject: Re: [PATCH 1/4] qla2xxx: Use raw_smp_processor_id() where appropriate
Date: Mon, 2 Mar 2020 17:22:44 +0100 [thread overview]
Message-ID: <20200302162244.uo52axk2kxipur6m@beryllium.lan> (raw)
In-Reply-To: <20200302033023.27718-2-bvanassche@acm.org>
Hi Bart,
On Sun, Mar 01, 2020 at 07:30:20PM -0800, Bart Van Assche wrote:
> This patch fixes e.g. the following kernel complaint:
[...]
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index 5b2deaa730bf..582fc5dcc98c 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -8992,7 +8992,7 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos,
> qpair->rsp->req = qpair->req;
> qpair->rsp->qpair = qpair;
> /* init qpair to this cpu. Will adjust at run time. */
> - qla_cpu_update(qpair, smp_processor_id());
> + qla_cpu_update(qpair, raw_smp_processor_id());
When this is updated later anway, why not inializing with a invalid id
from beginning? Because using raw_smp_processor_id() is just silencing
the report without addressing the problem.
> if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) {
> if (ha->fw_attributes & BIT_4)
> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
> index 8d7a905f6247..a5aae276fbb2 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -3217,8 +3217,8 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
> if (!ha->flags.fw_started)
> return;
>
> - if (rsp->qpair->cpuid != smp_processor_id())
> - qla_cpu_update(rsp->qpair, smp_processor_id());
> + if (rsp->qpair->cpuid != raw_smp_processor_id())
> + qla_cpu_update(rsp->qpair, raw_smp_processor_id());
If I read it correctly, qla24xx_processor_response_queue() can be
called from either IRQ context or from a threading context. So that
means complaint that smp_processor_id() is used in preemptable context
is correct. So again this is just silencing it.
>
> while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) {
> pkt = (struct sts_entry_24xx *)rsp->ring_ptr;
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index 622e7337affc..c4c6a8e1b46d 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -4368,7 +4368,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha,
> queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq, &cmd->work);
> } else if (ha->msix_count) {
> if (cmd->atio.u.isp24.fcp_cmnd.rddata)
> - queue_work_on(smp_processor_id(), qla_tgt_wq,
> + queue_work_on(raw_smp_processor_id(), qla_tgt_wq,
As I understand the code this is the main reason why the code tries to
figure out on which CPU it is running. The first part of the
processing happens either in IRQ context or in the threading context
in which qla24xx_process_response_queue() runs and now the second part
of the processing happens in the work queue. And this code tries to
stick the processing context on the same CPU to avoid cash trashing.
At creation time of the qpair queues, the CPU on which they should be
processed should be noted. And in this code path we just would look up
on which queue we are and which CPU should be used.
This would also avoid the qla_cpu_update() call in
qla24xx_process_response_queue().
So far the theory, I tried to figure out how to implement this scheme
but I'm still strungling with the code base.
Thanks,
Daniel
next prev parent reply other threads:[~2020-03-02 16:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-02 3:30 [PATCH 0/4] Fix qla2xxx endianness annotations Bart Van Assche
2020-03-02 3:30 ` [PATCH 1/4] qla2xxx: Use raw_smp_processor_id() where appropriate Bart Van Assche
2020-03-02 16:22 ` Daniel Wagner [this message]
2020-03-02 3:30 ` [PATCH 2/4] qla2xxx: Fix endianness annotations in header files Bart Van Assche
2020-03-02 16:50 ` Daniel Wagner
2020-03-02 3:30 ` [PATCH 3/4] qla2xxx: Fix endianness annotations in source files Bart Van Assche
2020-03-02 18:40 ` Daniel Wagner
2020-03-03 6:36 ` Bart Van Assche
2020-03-03 9:24 ` Daniel Wagner
2020-03-03 14:10 ` Himanshu Madhani
2020-03-04 5:16 ` Bart Van Assche
2020-03-02 3:30 ` [PATCH 4/4] qla2xxx: Fix the code that reads from mailbox registers Bart Van Assche
2020-03-02 18:43 ` Daniel Wagner
2020-03-03 6:37 ` Bart Van Assche
2020-03-03 8:31 ` Daniel Wagner
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=20200302162244.uo52axk2kxipur6m@beryllium.lan \
--to=dwagner@suse.de \
--cc=bvanassche@acm.org \
--cc=hmadhani@marvell.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mwilck@suse.com \
--cc=qutran@marvell.com \
--cc=r.bolshakov@yadro.com \
/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