LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Parav Pandit <parav@mellanox.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
kwankhede@nvidia.com, alex.williamson@redhat.com,
cjia@nvidia.com
Subject: Re: [PATCHv3 2/3] vfio/mdev: Avoid creating sysfs remove file on stale device removal
Date: Wed, 22 May 2019 11:55:04 +0200 [thread overview]
Message-ID: <20190522115504.2c440245.cohuck@redhat.com> (raw)
In-Reply-To: <20190516233034.16407-3-parav@mellanox.com>
On Thu, 16 May 2019 18:30:33 -0500
Parav Pandit <parav@mellanox.com> wrote:
> If device is removal is initiated by two threads as below, mdev core
> attempts to create a syfs remove file on stale device.
> During this flow, below [1] call trace is observed.
>
> cpu-0 cpu-1
> ----- -----
> mdev_unregister_device()
> device_for_each_child
> mdev_device_remove_cb
> mdev_device_remove
> user_syscall
> remove_store()
> mdev_device_remove()
> [..]
> unregister device();
> /* not found in list or
> * active=false.
> */
> sysfs_create_file()
> ..Call trace
>
> Now that mdev core follows correct device removal system of the linux
> bus model, remove shouldn't fail in normal cases. If it fails, there is
> no point of creating a stale file or checking for specific error status.
>
> kernel: WARNING: CPU: 2 PID: 9348 at fs/sysfs/file.c:327
> sysfs_create_file_ns+0x7f/0x90
> kernel: CPU: 2 PID: 9348 Comm: bash Kdump: loaded Not tainted
> 5.1.0-rc6-vdevbus+ #6
> kernel: Hardware name: Supermicro SYS-6028U-TR4+/X10DRU-i+, BIOS 2.0b
> 08/09/2016
> kernel: RIP: 0010:sysfs_create_file_ns+0x7f/0x90
> kernel: Call Trace:
> kernel: remove_store+0xdc/0x100 [mdev]
> kernel: kernfs_fop_write+0x113/0x1a0
> kernel: vfs_write+0xad/0x1b0
> kernel: ksys_write+0x5a/0xe0
> kernel: do_syscall_64+0x5a/0x210
> kernel: entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> Signed-off-by: Parav Pandit <parav@mellanox.com>
> ---
> drivers/vfio/mdev/mdev_sysfs.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c
> index 9f774b91d275..ffa3dcebf201 100644
> --- a/drivers/vfio/mdev/mdev_sysfs.c
> +++ b/drivers/vfio/mdev/mdev_sysfs.c
> @@ -237,10 +237,8 @@ static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
> int ret;
>
> ret = mdev_device_remove(dev);
> - if (ret) {
> - device_create_file(dev, attr);
> + if (ret)
> return ret;
> - }
> }
>
> return count;
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
next prev parent reply other threads:[~2019-05-22 9:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 23:30 [PATCHv3 0/3] vfio/mdev: Improve vfio/mdev core module Parav Pandit
2019-05-16 23:30 ` [PATCHv3 1/3] vfio/mdev: Improve the create/remove sequence Parav Pandit
2019-05-20 19:54 ` Parav Pandit
2019-05-22 9:57 ` Cornelia Huck
2019-05-22 9:54 ` Cornelia Huck
2019-05-24 18:45 ` Parav Pandit
2019-05-16 23:30 ` [PATCHv3 2/3] vfio/mdev: Avoid creating sysfs remove file on stale device removal Parav Pandit
2019-05-22 9:55 ` Cornelia Huck [this message]
2019-05-16 23:30 ` [PATCHv3 3/3] vfio/mdev: Synchronize device create/remove with parent removal Parav Pandit
2019-05-17 11:22 ` Cornelia Huck
2019-05-17 14:18 ` Parav Pandit
2019-05-20 11:29 ` Cornelia Huck
2019-05-20 19:15 ` Parav Pandit
2019-05-20 22:12 ` Alex Williamson
2019-05-24 9:11 ` Parav Pandit
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=20190522115504.2c440245.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=cjia@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=parav@mellanox.com \
--subject='Re: [PATCHv3 2/3] vfio/mdev: Avoid creating sysfs remove file on stale device removal' \
/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
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).