virtio: last-minute fixes

Some bugfixes that seem important and safe enough to merge at the last
 minute.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJbXxanAAoJECgfDbjSjVRpDqoH/iqUcK2KkLQTUut4KWF0xjfs
 0AZxB9sT2fXNAwF4dDS0SywN8oXKRA0c83AY5WgtcJfndPYEhg4mZsiQThLN6GVw
 /CRVizpN1mSbn7ds4Xl5htD2Ml8OxRkAdulOXfG/DZ2eIiEgoQ6vPzDF2jqy1dIj
 yWjBNWoSKIqElkN310BlkDX0hjqSP9zr4kEDFSB7AHcsNRhUDcgRqFzA83bRZU0b
 qKNzeLwU28jYnjzBPjQ449lkHGXtSjSkBnxUOXHU2CVCiQ5I0rBPi/Xdhtd94gDM
 Bbl4Spf74IiwPdfMwk4pa6rO8JPLpYhrFHIG0Gkk8AFV4Gwh1IYQ9s3On3ADWSQ=
 =p1AG
 -----END PGP SIGNATURE-----

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull virtio fixes from Michael Tsirkin:
 "Some bugfixes that seem important and safe enough to merge at the last
  minute"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  virtio_balloon: fix another race between migration and ballooning
  tools/virtio: add kmalloc_array stub
  tools/virtio: add dma barrier stubs
This commit is contained in:
Linus Torvalds 2018-07-31 09:35:32 -07:00
commit 095c3633f1
3 changed files with 9 additions and 2 deletions

View file

@ -513,7 +513,9 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
tell_host(vb, vb->inflate_vq);
/* balloon's page migration 2nd step -- deflate "page" */
spin_lock_irqsave(&vb_dev_info->pages_lock, flags);
balloon_page_delete(page);
spin_unlock_irqrestore(&vb_dev_info->pages_lock, flags);
vb->num_pfns = VIRTIO_BALLOON_PAGES_PER_PAGE;
set_page_pfns(vb, vb->pfns, page);
tell_host(vb, vb->deflate_vq);

View file

@ -13,8 +13,8 @@
} while (0);
/* Weak barriers should be used. If not - it's a bug */
# define mb() abort()
# define rmb() abort()
# define wmb() abort()
# define dma_rmb() abort()
# define dma_wmb() abort()
#else
#error Please fill in barrier macros
#endif

View file

@ -52,6 +52,11 @@ static inline void *kmalloc(size_t s, gfp_t gfp)
return __kmalloc_fake;
return malloc(s);
}
static inline void *kmalloc_array(unsigned n, size_t s, gfp_t gfp)
{
return kmalloc(n * s, gfp);
}
static inline void *kzalloc(size_t s, gfp_t gfp)
{
void *p = kmalloc(s, gfp);