Re: [PATCH 3/3] xen blkback: add fault injection facility

2018-04-22 Thread kbuild test robot
Hi Stanislav,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[also build test ERROR on v4.17-rc1 next-20180420]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Stanislav-Kinsburskii/Introduce-Xen-fault-injection-facility/20180422-201946
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/block//xen-blkback/blkback_fi.c: In function 'xen_blkif_fi_init':
>> drivers/block//xen-blkback/blkback_fi.c:87:51: error: dereferencing pointer 
>> to incomplete type 'struct backend_info'
 bfi->dir = debugfs_create_dir(dev_name(>be->dev->dev),
  ^~

vim +87 drivers/block//xen-blkback/blkback_fi.c

77  
78  int xen_blkif_fi_init(struct xen_blkif *blkif)
79  {
80  struct xen_blkif_fi *bfi;
81  int fi, err = -ENOMEM;
82  
83  bfi = kmalloc(sizeof(*bfi), GFP_KERNEL);
84  if (!bfi)
85  return -ENOMEM;
86  
  > 87  bfi->dir = debugfs_create_dir(dev_name(>be->dev->dev),
88blkif_fi_dir);
89  if (!bfi->dir)
90  goto err_dir;
91  
92  for (fi = 0; fi < XENBLKIF_FI_MAX; fi++) {
93  bfi->faults[fi] = xen_fi_dir_add(bfi->dir,
94   
xen_blkif_fi_names[fi]);
95  if (!bfi->faults[fi])
96  goto err_fault;
97  }
98  
99  blkif->fi_info = bfi;
   100  return 0;
   101  
   102  err_fault:
   103  for (; fi > 0; fi--)
   104  xen_fi_del(bfi->faults[fi]);
   105  debugfs_remove_recursive(bfi->dir);
   106  err_dir:
   107  kfree(bfi);
   108  return err;
   109  }
   110  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 3/3] xen blkback: add fault injection facility

2018-04-20 Thread staskins

On 04/20/18 13:28, Juergen Gross wrote:

On 20/04/18 12:47, Stanislav Kinsburskii wrote:

This patch adds wrapper helpers around generic Xen fault inject
facility.
The major reason is to keep all the module fault injection directories
in a dedicated subdirectory instead of Xen fault inject root.

IOW, when using these helpers, per-device and named by device name
fault injection control directories will appear under the following
directory:
- /sys/kernel/debug/xen/fault_inject/xen-blkback/
instead of:
- /sys/kernel/debug/xen/fault_inject/

Signed-off-by: Stanislav Kinsburskii 
CC: Jens Axboe 
CC: Konrad Rzeszutek Wilk 
CC: "Roger Pau Monné" 
CC: linux-ker...@vger.kernel.org
CC: linux-block@vger.kernel.org
CC: xen-de...@lists.xenproject.org
CC: Stanislav Kinsburskii 
CC: David Woodhouse 

This is an exact copy of the netback patch apart from the names.

I don't like adding multiple copies of the same coding to the tree.


Sure, will dedupplicate this.



Juergen



Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B


[PATCH 3/3] xen blkback: add fault injection facility

2018-04-20 Thread Stanislav Kinsburskii
This patch adds wrapper helpers around generic Xen fault inject
facility.
The major reason is to keep all the module fault injection directories
in a dedicated subdirectory instead of Xen fault inject root.

IOW, when using these helpers, per-device and named by device name
fault injection control directories will appear under the following
directory:
- /sys/kernel/debug/xen/fault_inject/xen-blkback/
instead of:
- /sys/kernel/debug/xen/fault_inject/

Signed-off-by: Stanislav Kinsburskii 
CC: Jens Axboe 
CC: Konrad Rzeszutek Wilk 
CC: "Roger Pau Monné" 
CC: linux-ker...@vger.kernel.org
CC: linux-block@vger.kernel.org
CC: xen-de...@lists.xenproject.org
CC: Stanislav Kinsburskii 
CC: David Woodhouse 
---
 drivers/block/Kconfig  |7 ++
 drivers/block/xen-blkback/Makefile |1 
 drivers/block/xen-blkback/blkback.c|9 ++
 drivers/block/xen-blkback/blkback_fi.c |  116 
 drivers/block/xen-blkback/blkback_fi.h |   37 ++
 drivers/block/xen-blkback/common.h |3 +
 drivers/block/xen-blkback/xenbus.c |5 +
 7 files changed, 178 insertions(+)
 create mode 100644 drivers/block/xen-blkback/blkback_fi.c
 create mode 100644 drivers/block/xen-blkback/blkback_fi.h

diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index ad9b687..0ce05fe 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -436,6 +436,13 @@ config XEN_BLKDEV_BACKEND
  compile this driver as a module, chose M here: the module
  will be called xen-blkback.
 
+config XEN_BLKDEV_BACKEND_FAULT_INJECTION
+ bool "Xen block-device backend driver fault injection"
+ depends on XEN_BLKDEV_BACKEND
+ depends on XEN_FAULT_INJECTION
+ default n
+ help
+   Allow to inject errors to Xen backend block driver
 
 config VIRTIO_BLK
tristate "Virtio block driver"
diff --git a/drivers/block/xen-blkback/Makefile 
b/drivers/block/xen-blkback/Makefile
index e491c1b..035d134 100644
--- a/drivers/block/xen-blkback/Makefile
+++ b/drivers/block/xen-blkback/Makefile
@@ -1,3 +1,4 @@
 obj-$(CONFIG_XEN_BLKDEV_BACKEND) := xen-blkback.o
 
 xen-blkback-y  := blkback.o xenbus.o
+xen-blkback-$(CONFIG_XEN_BLKDEV_BACKEND_FAULT_INJECTION) += blkback_fi.o
diff --git a/drivers/block/xen-blkback/blkback.c 
b/drivers/block/xen-blkback/blkback.c
index 987d665..2933bec 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include "common.h"
+#include "blkback_fi.h"
 
 /*
  * Maximum number of unused free pages to keep in the internal buffer.
@@ -1491,11 +1492,19 @@ static int __init xen_blkif_init(void)
if (rc)
goto failed_init;
 
+   (void) xen_blkbk_fi_init();
  failed_init:
return rc;
 }
 
 module_init(xen_blkif_init);
 
+static void __exit xen_blkif_fini(void)
+{
+   xen_blkbk_fi_fini();
+}
+
+module_exit(xen_blkif_fini);
+
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_ALIAS("xen-backend:vbd");
diff --git a/drivers/block/xen-blkback/blkback_fi.c 
b/drivers/block/xen-blkback/blkback_fi.c
new file mode 100644
index 000..b7abaea
--- /dev/null
+++ b/drivers/block/xen-blkback/blkback_fi.c
@@ -0,0 +1,116 @@
+/*
+ * Fault injection interface for Xen virtual block devices
+ *
+ * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include 
+#include 
+
+#include 
+
+#include "blkback_fi.h"