virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Juergen Gross <jgross@suse.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	Linux Virtualization <virtualization@lists.linux-foundation.org>
Subject: Re: Weird locking hierarchy in virtcrypto
Date: Fri, 22 Sep 2023 06:45:08 -0400	[thread overview]
Message-ID: <20230922064219-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <bdc81c97-ada4-41ef-89c4-7894201b46c2@suse.com>

On Fri, Sep 22, 2023 at 10:36:59AM +0200, Juergen Gross wrote:
> While backporting an upstream patch to one of our older distro kernels I've
> found a weird locking hierarchy in the virtio crypto driver:
> 
> virtio_config_changed():
>   spin_lock_irqsave()
>   ->__virtio_config_changed()
>       ->drv->config_changed()      <- assume drv == virtio_crypto_driver
>         virtcrypto_config_changed():
>           ->virtcrypto_update_status()
>               ->virtcrypto_dev_start()
>                   ->virtio_crypto_skcipher_algs_register()
>                       mutex_lock()
> 
> I don't think trying to take a mutex while holding a spinlock with interrupts
> disabled is a proper thing to do.
> 
> Am I overlooking something here?
> 
> 
> Juergen

Yes - this seems like a bug in virtcrypto - for example, virt blk
queues a work for this reason. It's so common that it might make
sense to move the config work into virtio core.
In any case, patches welcome.

-- 
MST

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

      reply	other threads:[~2023-09-22 10:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22  8:36 Weird locking hierarchy in virtcrypto Juergen Gross via Virtualization
2023-09-22 10:45 ` Michael S. Tsirkin [this message]

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=20230922064219-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jgross@suse.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xuanzhuo@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).