Re: [PATCH v3 6/9] xen/gntdev: Make private routines/structures accessible

From: Oleksandr Andrushchenko
Date: Wed Jun 13 2018 - 03:23:34 EST

On 06/13/2018 04:38 AM, Boris Ostrovsky wrote:

On 06/12/2018 09:41 AM, Oleksandr Andrushchenko wrote:
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>

This is in preparation for adding support of DMA buffer
functionality: make map/unmap related code and structures, used
privately by gntdev, ready for dma-buf extension, which will re-use
these. Rename corresponding structures as those become non-private
to gntdev now.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
 drivers/xen/gntdev-common.h | 86 +++++++++++++++++++++++
 drivers/xen/gntdev.c | 132 ++++++++++++------------------------
 2 files changed, 128 insertions(+), 90 deletions(-)
 create mode 100644 drivers/xen/gntdev-common.h

diff --git a/drivers/xen/gntdev-common.h b/drivers/xen/gntdev-common.h
new file mode 100644
index 000000000000..7a9845a6bee9
--- /dev/null
+++ b/drivers/xen/gntdev-common.h
@@ -0,0 +1,86 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+ * Common functionality of grant device.
+ *
+ * Copyright (c) 2006-2007, D G Murray.
+ *ÂÂÂÂÂÂÂÂÂÂ (c) 2009 Gerd Hoffmann <kraxel@xxxxxxxxxx>
+ *ÂÂÂÂÂÂÂÂÂÂ (c) 2018 Oleksandr Andrushchenko, EPAM Systems Inc.
+ */
+#include <linux/mm.h>
+#include <linux/mman.h>
+#include <linux/mmu_notifier.h>
+#include <linux/types.h>
+struct gntdev_priv {
+ÂÂÂ /* maps with visible offsets in the file descriptor */
+ÂÂÂ struct list_head maps;
+ÂÂÂ /* maps that are not visible; will be freed on munmap.
+ÂÂÂÂ * Only populated if populate_freeable_maps == 1 */

Since you are touching this code please fix comment style.

I saw that while running checkpatch, but was not sure if I have to touch
those as they seemed to be not related to the change itself.
But I'll make sure all the comments are consistent.

+ÂÂÂ struct list_head freeable_maps;
+ÂÂÂ /* lock protects maps and freeable_maps */
+ÂÂÂ struct mutex lock;
+ÂÂÂ struct mm_struct *mm;
+ÂÂÂ struct mmu_notifier mn;
+ÂÂÂ /* Device for which DMA memory is allocated. */
+ÂÂÂ struct device *dma_dev;

With that fixed,

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>

Thank you,