Re: [PATCH v3 1/2] vhost: Add rbtree vdpa_mem_tree to saved the counted mem

2022-06-27 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 11:54:27AM +0800, Jason Wang wrote: > On Mon, Jun 27, 2022 at 6:01 PM Michael S. Tsirkin wrote: > > > > On Mon, Jun 27, 2022 at 04:12:57PM +0800, Cindy Lu wrote: > > > On Sun, Jun 26, 2022 at 6:01 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Sun, Jun 26, 2022 at

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 11:50:37AM +0800, Jason Wang wrote: > On Mon, Jun 27, 2022 at 7:53 PM Michael S. Tsirkin wrote: > > > > On Mon, Jun 27, 2022 at 04:14:20PM +0800, Jason Wang wrote: > > > On Mon, Jun 27, 2022 at 3:58 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Mon, Jun 27, 2022

Re: [PATCH V3] virtio: disable notification hardening by default

2022-06-27 Thread Michael S. Tsirkin
On Tue, Jun 28, 2022 at 11:49:12AM +0800, Jason Wang wrote: > > Heh. Yea sure. But things work fine for people. What is the chance > > your review found and fixed all driver bugs? > > I don't/can't audit all bugs but the race between open/close against > ready/reset. It looks to me a good chance

Re: [PATCH] Bluetooth: virtio_bt: fix device removal

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 13, 2022 at 02:58:59AM -0400, Michael S. Tsirkin wrote: > On Fri, Jan 14, 2022 at 03:12:47PM -0500, Michael S. Tsirkin wrote: > > On Thu, Dec 16, 2021 at 08:58:31PM +0100, Marcel Holtmann wrote: > > > Hi Michael, > > > > > > > Device removal is clearly out of virtio spec: it

Re: [PATCH 2/3] vdpa_sim_blk: limit the number of request handled per batch

2022-06-27 Thread Jason Wang
On Thu, Jun 23, 2022 at 4:58 PM Stefano Garzarella wrote: > > On Thu, Jun 23, 2022 at 11:50:22AM +0800, Jason Wang wrote: > >On Wed, Jun 22, 2022 at 12:09 AM Stefano Garzarella > >wrote: > >> > >> Limit the number of requests (4 per queue as for vdpa_sim_net) handled > >> in a batch to prevent

Re: [PATCH v3 1/2] vhost: Add rbtree vdpa_mem_tree to saved the counted mem

2022-06-27 Thread Jason Wang
On Mon, Jun 27, 2022 at 6:01 PM Michael S. Tsirkin wrote: > > On Mon, Jun 27, 2022 at 04:12:57PM +0800, Cindy Lu wrote: > > On Sun, Jun 26, 2022 at 6:01 PM Michael S. Tsirkin wrote: > > > > > > On Sun, Jun 26, 2022 at 05:04:08PM +0800, Cindy Lu wrote: > > > > We count pinned_vm as follow in

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Jason Wang
On Mon, Jun 27, 2022 at 7:53 PM Michael S. Tsirkin wrote: > > On Mon, Jun 27, 2022 at 04:14:20PM +0800, Jason Wang wrote: > > On Mon, Jun 27, 2022 at 3:58 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Jun 27, 2022 at 03:45:30PM +0800, Jason Wang wrote: > > > > On Mon, Jun 27, 2022 at 2:39 PM

Re: [PATCH V3] virtio: disable notification hardening by default

2022-06-27 Thread Jason Wang
On Mon, Jun 27, 2022 at 5:52 PM Michael S. Tsirkin wrote: > > On Mon, Jun 27, 2022 at 04:11:18PM +0800, Jason Wang wrote: > > On Mon, Jun 27, 2022 at 3:33 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Jun 27, 2022 at 10:50:17AM +0800, Jason Wang wrote: > > > > On Fri, Jun 24, 2022 at 2:31 PM

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Jason Gunthorpe
On Mon, Jun 27, 2022 at 08:27:37PM +0200, Daniel Borkmann wrote: > On 6/27/22 8:04 PM, Gustavo A. R. Silva wrote: > > There is a regular need in the kernel to provide a way to declare > > having a dynamically sized set of trailing elements in a structure. > > Kernel code should always use

RE: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Dan Williams
Gustavo A. R. Silva wrote: > There is a regular need in the kernel to provide a way to declare > having a dynamically sized set of trailing elements in a structure. > Kernel code should always use “flexible array members”[1] for these > cases. The older style of one-element or zero-length arrays

Re: [PATCH 1/1] Create debugfs file with virtio balloon usage information

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 27, 2022 at 07:19:09PM +, Alexander Atanasov wrote: > Allow the guest to know how much it is ballooned by the host. > It is useful when debugging out of memory conditions. > > When host gets back memory from the guest it is accounted > as used memory in the guest but the guest

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Daniel Borkmann
On 6/27/22 8:04 PM, Gustavo A. R. Silva wrote: There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or

Re: [GIT PULL] virtio,vdpa: fixes

2022-06-27 Thread pr-tracker-bot
The pull request you sent on Mon, 27 Jun 2022 11:50:24 -0400: > https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/941e3e7912696b9fbe3586083a7c2e102cee7a87 Thank you! -- Deet-doot-dot, I am a

Re: [PATCH v4] x86/paravirt: useless assignment instructions cause Unixbench full core performance degradation

2022-06-27 Thread Waiman Long
On 6/27/22 10:27, Guo Hui wrote: The instructions assigned to the vcpu_is_preempted function parameter in the X86 architecture physical machine are redundant instructions, causing the multi-core performance of Unixbench to drop by about 4% to 5%. The C function is as follows: static bool

[GIT PULL] virtio,vdpa: fixes

2022-06-27 Thread Michael S. Tsirkin
The following changes since commit a111daf0c53ae91e71fd2bfe7497862d14132e3e: Linux 5.19-rc3 (2022-06-19 15:06:47 -0500) are available in the Git repository at: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus for you to fetch changes up to

Re: [PATCH v4] x86/paravirt: useless assignment instructions cause Unixbench full core performance degradation

2022-06-27 Thread Juergen Gross via Virtualization
On 27.06.22 16:27, Guo Hui wrote: The instructions assigned to the vcpu_is_preempted function parameter in the X86 architecture physical machine are redundant instructions, causing the multi-core performance of Unixbench to drop by about 4% to 5%. The C function is as follows: static bool

Re: [PATCH v2] x86/paravirt: useless assignment instructions cause Unixbench full core performance degradation

2022-06-27 Thread Waiman Long
On 6/27/22 01:54, Guo Hui wrote: Thank you very much Longman, my patch is as you said, only disable node_cpu on X86, enable node_cpu on arm64, powerpc, s390 architectures; the code is in file arch/x86/kernel/paravirt-spinlocks.c:     DECLARE_STATIC_KEY_FALSE(preemted_key);    

Re: [PATCH 1/1] Create debugfs file with virtio balloon usage information

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 27, 2022 at 12:20:38PM +, alexander.atana...@virtuozzo.com wrote: > From: Alexander Atanasov > > Allow the guest to know how much it is ballooned by the host. > It is useful when debugging out of memory conditions. > > When host gets back memory from the guest it is accounted >

Re: [PATCH net V2] virtio-net: fix race between ndo_open() and virtio_device_ready()

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 27, 2022 at 04:30:40PM +0800, Jason Wang wrote: > We currently call virtio_device_ready() after netdev > registration. Since ndo_open() can be called immediately > after register_netdev, this means there exists a race between > ndo_open() and virtio_device_ready(): the driver may start

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 27, 2022 at 04:14:20PM +0800, Jason Wang wrote: > On Mon, Jun 27, 2022 at 3:58 PM Michael S. Tsirkin wrote: > > > > On Mon, Jun 27, 2022 at 03:45:30PM +0800, Jason Wang wrote: > > > On Mon, Jun 27, 2022 at 2:39 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Mon, Jun 27, 2022

Re: [PATCH v3 1/2] vhost: Add rbtree vdpa_mem_tree to saved the counted mem

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 27, 2022 at 04:12:57PM +0800, Cindy Lu wrote: > On Sun, Jun 26, 2022 at 6:01 PM Michael S. Tsirkin wrote: > > > > On Sun, Jun 26, 2022 at 05:04:08PM +0800, Cindy Lu wrote: > > > We count pinned_vm as follow in vhost-vDPA > > > > > > lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; >

Re: [PATCH V3] virtio: disable notification hardening by default

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 27, 2022 at 04:11:18PM +0800, Jason Wang wrote: > On Mon, Jun 27, 2022 at 3:33 PM Michael S. Tsirkin wrote: > > > > On Mon, Jun 27, 2022 at 10:50:17AM +0800, Jason Wang wrote: > > > On Fri, Jun 24, 2022 at 2:31 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Wed, Jun 22, 2022

Re: [PATCH v2] x86/paravirt: useless assignment instructions cause Unixbench full core performance degradation

2022-06-27 Thread Peter Zijlstra
On Mon, Jun 27, 2022 at 05:18:02PM +0800, Guo Hui wrote: > Ok thanks Peter, your suggestion is very good, I will modify my patch as you > suggested. Because it messes up the order in which people normally read text. Why is top-posting such a bad thing? Top-posting. What is the most annoying thing

Re: vhost-vdpa tests in tools/virtio

2022-06-27 Thread Stefano Garzarella
On Thu, Jun 23, 2022 at 11:59:56AM +0800, Jason Wang wrote: On Thu, Jun 23, 2022 at 3:21 AM Eugenio Perez Martin wrote: On Wed, Jun 22, 2022 at 5:39 PM Stefano Garzarella wrote: > > Hi, > while developing/testing the vdpa-blk support in libblkio [1], I > realized that we added several

[PATCH net V2] virtio-net: fix race between ndo_open() and virtio_device_ready()

2022-06-27 Thread Jason Wang
We currently call virtio_device_ready() after netdev registration. Since ndo_open() can be called immediately after register_netdev, this means there exists a race between ndo_open() and virtio_device_ready(): the driver may start to use the device before DRIVER_OK which violates the spec. Fix

Re: [PATCH net] virtio-net: fix race between ndo_open() and virtio_device_ready()

2022-06-27 Thread Jason Wang
On Mon, Jun 27, 2022 at 3:44 PM Michael S. Tsirkin wrote: > > On Mon, Jun 27, 2022 at 02:36:56PM +0800, Jason Wang wrote: > > We used to call virtio_device_ready() after netdev registration. > > s/used to call/currently call/ > > > This > > cause > > s/This cause/Since ndo_open can be called

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Jason Wang
On Mon, Jun 27, 2022 at 3:58 PM Michael S. Tsirkin wrote: > > On Mon, Jun 27, 2022 at 03:45:30PM +0800, Jason Wang wrote: > > On Mon, Jun 27, 2022 at 2:39 PM Michael S. Tsirkin wrote: > > > > > > On Mon, Jun 27, 2022 at 10:30:42AM +0800, Jason Wang wrote: > > > > On Fri, Jun 24, 2022 at 2:59 PM

Re: [PATCH V3] virtio: disable notification hardening by default

2022-06-27 Thread Jason Wang
On Mon, Jun 27, 2022 at 3:33 PM Michael S. Tsirkin wrote: > > On Mon, Jun 27, 2022 at 10:50:17AM +0800, Jason Wang wrote: > > On Fri, Jun 24, 2022 at 2:31 PM Michael S. Tsirkin wrote: > > > > > > On Wed, Jun 22, 2022 at 03:09:31PM +0800, Jason Wang wrote: > > > > On Wed, Jun 22, 2022 at 3:03 PM

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 27, 2022 at 03:45:30PM +0800, Jason Wang wrote: > On Mon, Jun 27, 2022 at 2:39 PM Michael S. Tsirkin wrote: > > > > On Mon, Jun 27, 2022 at 10:30:42AM +0800, Jason Wang wrote: > > > On Fri, Jun 24, 2022 at 2:59 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Fri, Jun 24, 2022

Re: [PATCH v2] x86/paravirt: useless assignment instructions cause Unixbench full core performance degradation

2022-06-27 Thread Peter Zijlstra
On Mon, Jun 27, 2022 at 10:13:50AM +0800, Guo Hui wrote: > The instructions assigned to the vcpu_is_preempted function parameter > in the X86 architecture physical machine are redundant instructions, > causing the multi-core performance of Unixbench to drop by about 4% to 5%. > The C function is

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Jason Wang
On Mon, Jun 27, 2022 at 2:39 PM Michael S. Tsirkin wrote: > > On Mon, Jun 27, 2022 at 10:30:42AM +0800, Jason Wang wrote: > > On Fri, Jun 24, 2022 at 2:59 PM Michael S. Tsirkin wrote: > > > > > > On Fri, Jun 24, 2022 at 10:56:05AM +0800, Xuan Zhuo wrote: > > > > Add queue_notify_data in struct

Re: [PATCH net] virtio-net: fix race between ndo_open() and virtio_device_ready()

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 27, 2022 at 02:36:56PM +0800, Jason Wang wrote: > We used to call virtio_device_ready() after netdev registration. s/used to call/currently call/ > This > cause s/This cause/Since ndo_open can be called immediately after register_netdev, this means there exists/ > a race between

Re: [PATCH V3] virtio: disable notification hardening by default

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 27, 2022 at 10:50:17AM +0800, Jason Wang wrote: > On Fri, Jun 24, 2022 at 2:31 PM Michael S. Tsirkin wrote: > > > > On Wed, Jun 22, 2022 at 03:09:31PM +0800, Jason Wang wrote: > > > On Wed, Jun 22, 2022 at 3:03 PM Michael S. Tsirkin > > > wrote: > > > > > > > > On Wed, Jun 22, 2022

RE: [PATCH v3 5/5] vfio/iommu_type1: Simplify group attachment

2022-06-27 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Friday, June 24, 2022 4:00 AM > > Un-inline the domain specific logic from the attach/detach_group ops into > two paired functions vfio_iommu_alloc_attach_domain() and > vfio_iommu_detach_destroy_domain() that strictly deal with creating and > destroying struct

[PATCH net] virtio-net: fix race between ndo_open() and virtio_device_ready()

2022-06-27 Thread Jason Wang
We used to call virtio_device_ready() after netdev registration. This cause a race between ndo_open() and virtio_device_ready(): if ndo_open() is called before virtio_device_ready(), the driver may start to use the device before DRIVER_OK which violates the spec. Fixing this by switching to use

Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-06-27 Thread Michael S. Tsirkin
On Mon, Jun 27, 2022 at 10:30:42AM +0800, Jason Wang wrote: > On Fri, Jun 24, 2022 at 2:59 PM Michael S. Tsirkin wrote: > > > > On Fri, Jun 24, 2022 at 10:56:05AM +0800, Xuan Zhuo wrote: > > > Add queue_notify_data in struct virtio_pci_common_cfg, which comes from > > > here

Re: [PATCH] virtio-net: fix race between ndo_open() and virtio_device_ready()

2022-06-27 Thread Jason Wang
On Fri, Jun 17, 2022 at 3:29 PM Jason Wang wrote: > > We used to call virtio_device_ready() after netdev registration. This > cause a race between ndo_open() and virtio_device_ready(): if > ndo_open() is called before virtio_device_ready(), the driver may > start to use the device before