From: Halil Pasic <pasic@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
Marc Hartmayer <mhartmay@linux.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"pizhenwei@bytedance.com" <pizhenwei@bytedance.com>,
Halil Pasic <pasic@linux.ibm.com>
Subject: Re: [PATCH] crypto: virtio-crypto: call finalize with bh disabled
Date: Wed, 27 Sep 2023 13:25:36 +0200 [thread overview]
Message-ID: <20230927132536.4b19ab2f.pasic@linux.ibm.com> (raw)
In-Reply-To: <877coc2aj8.fsf@redhat.com>
On Wed, 27 Sep 2023 12:08:43 +0200
Cornelia Huck <cohuck@redhat.com> wrote:
> > On the other hand virtio_airq_handler() calls vring_interrupt() with
> > interrupts enabled. (While vring_interrupt() is called in a (read)
> > critical section in virtio_airq_handler() we use read_lock() and
> > not read_lock_irqsave() to grab the lock. Whether that is correct in
> > it self (i.e. disregarding the crypto problem) or not I'm not sure right
> > now. Will think some more about it tomorrow.) If the way to go forward
> > is disabling interrupts in virtio-ccw before vring_interrupt() is
> > called, I would be glad to spin a patch for that.
>
> virtio_airq_handler() is supposed to be an interrupt handler for an
> adapter interrupt -- as such I would expect it to always run with
> interrupts disabled (and I'd expect vring_interrupt() to be called
> with interrupts disabled as well; if that's not the case, I think it
> would need to run asynchronously.) At least that was my understanding at
> the time I wrote the code.
Thanks Connie! I don't quite understand what do you mean by "run with
interrupts disabled" in this context.
Do you mean that if I were to add the following warning:
diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index ac67576301bf..2a9c73f5964f 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -211,6 +211,8 @@ static void virtio_airq_handler(struct airq_struct *airq,
struct airq_info *info = container_of(airq, struct airq_info, airq);
unsigned long ai;
+ WARN_ONCE(in_irq(), "irqs are ought to be disabled but are not\n");
+
inc_irq_stat(IRQIO_VAI);
it would/should never trigger, or do you mean something different?
If yes, does that mean that you would expect the common airq code (i.e. something
like do_airq_interrupt()) to disable interrupts, or call virtio_airq_handler()?
asynchronously sort of as a bottom half (my understanding of bottom halves is currently
not complete).
If no what do you actually mean?
Regards,
Halil
Regards,
Halil
WARNING: multiple messages have this Message-ID (diff)
From: Halil Pasic <pasic@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"Michael S. Tsirkin" <mst@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"pizhenwei@bytedance.com" <pizhenwei@bytedance.com>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
Halil Pasic <pasic@linux.ibm.com>,
Marc Hartmayer <mhartmay@linux.ibm.com>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH] crypto: virtio-crypto: call finalize with bh disabled
Date: Wed, 27 Sep 2023 13:25:36 +0200 [thread overview]
Message-ID: <20230927132536.4b19ab2f.pasic@linux.ibm.com> (raw)
In-Reply-To: <877coc2aj8.fsf@redhat.com>
On Wed, 27 Sep 2023 12:08:43 +0200
Cornelia Huck <cohuck@redhat.com> wrote:
> > On the other hand virtio_airq_handler() calls vring_interrupt() with
> > interrupts enabled. (While vring_interrupt() is called in a (read)
> > critical section in virtio_airq_handler() we use read_lock() and
> > not read_lock_irqsave() to grab the lock. Whether that is correct in
> > it self (i.e. disregarding the crypto problem) or not I'm not sure right
> > now. Will think some more about it tomorrow.) If the way to go forward
> > is disabling interrupts in virtio-ccw before vring_interrupt() is
> > called, I would be glad to spin a patch for that.
>
> virtio_airq_handler() is supposed to be an interrupt handler for an
> adapter interrupt -- as such I would expect it to always run with
> interrupts disabled (and I'd expect vring_interrupt() to be called
> with interrupts disabled as well; if that's not the case, I think it
> would need to run asynchronously.) At least that was my understanding at
> the time I wrote the code.
Thanks Connie! I don't quite understand what do you mean by "run with
interrupts disabled" in this context.
Do you mean that if I were to add the following warning:
diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index ac67576301bf..2a9c73f5964f 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -211,6 +211,8 @@ static void virtio_airq_handler(struct airq_struct *airq,
struct airq_info *info = container_of(airq, struct airq_info, airq);
unsigned long ai;
+ WARN_ONCE(in_irq(), "irqs are ought to be disabled but are not\n");
+
inc_irq_stat(IRQIO_VAI);
it would/should never trigger, or do you mean something different?
If yes, does that mean that you would expect the common airq code (i.e. something
like do_airq_interrupt()) to disable interrupts, or call virtio_airq_handler()?
asynchronously sort of as a bottom half (my understanding of bottom halves is currently
not complete).
If no what do you actually mean?
Regards,
Halil
Regards,
Halil
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2023-09-27 11:26 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 15:07 [PATCH] crypto: virtio-crypto: call finalize with bh disabled Gonglei (Arei)
2023-09-25 15:07 ` Gonglei (Arei) via Virtualization
2023-09-26 16:41 ` Halil Pasic
2023-09-26 16:41 ` Halil Pasic
2023-09-26 17:13 ` Michael S. Tsirkin
2023-09-26 17:13 ` Michael S. Tsirkin
2023-09-27 9:24 ` Gonglei (Arei)
2023-09-27 9:24 ` Gonglei (Arei) via Virtualization
2023-09-27 13:25 ` Halil Pasic
2023-09-27 13:25 ` Halil Pasic
2023-09-28 1:24 ` zhenwei pi
2023-09-28 1:24 ` zhenwei pi via Virtualization
2023-09-28 2:03 ` Gonglei (Arei)
2023-09-28 2:03 ` Gonglei (Arei) via Virtualization
2023-09-27 9:36 ` Halil Pasic
2023-09-27 9:36 ` Halil Pasic
2023-09-27 9:17 ` Gonglei (Arei)
2023-09-27 9:17 ` Gonglei (Arei) via Virtualization
2023-09-27 10:08 ` Cornelia Huck
2023-09-27 10:08 ` Cornelia Huck
2023-09-27 11:25 ` Halil Pasic [this message]
2023-09-27 11:25 ` Halil Pasic
2023-09-27 12:12 ` Cornelia Huck
2023-09-27 12:12 ` Cornelia Huck
2023-09-27 13:11 ` Halil Pasic
2023-09-27 13:11 ` Halil Pasic
2023-09-27 17:11 ` Halil Pasic
2023-09-27 17:11 ` Halil Pasic
2023-11-02 13:01 ` Gonglei (Arei)
2023-11-02 13:01 ` Gonglei (Arei) via Virtualization
2023-11-06 10:08 ` Herbert Xu
2023-11-06 10:08 ` Herbert Xu
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=20230927132536.4b19ab2f.pasic@linux.ibm.com \
--to=pasic@linux.ibm.com \
--cc=arei.gonglei@huawei.com \
--cc=cohuck@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=jasowang@redhat.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhartmay@linux.ibm.com \
--cc=mst@redhat.com \
--cc=pizhenwei@bytedance.com \
--cc=virtualization@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.