Re: [PATCH] defines modified to match the 80-char rule

2015-07-06 Thread Joe Perches
On Mon, 2015-07-06 at 08:07 +0200, Krzysztof Hałasa wrote:
 Joe Perches j...@perches.com writes:
  Nah, you're not an extremist, you're just preferring narrowly
  localized readability over global consistency.
 
  That's fine and all, until you come up to LCONSOLE_ERROR_MSG
  type use which blows the nice old formatting up.
 
  So what I suggested is just a simple consistency thing.
 
 So, could we have the localized readability when it makes sense,
 and the default rules when nothing else applies?

Then the question becomes how local.

 OTOH I think the 80 columns rule should go.

I have no issue with that.
There should be some limit though.


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: dgnc: Replace macro with flow control statement by a function

2015-07-06 Thread Dan Carpenter
On Sun, Jul 05, 2015 at 11:46:28PM +0530, Arjun Krishna Babu wrote:
 This patch fixes the checkpatch.pl warning:
 
 WARNING: Macros with flow control statements should be avoided
 
 Replace the macro with a function doing the exact same task as the
 macro.
 

No.  You haven't understood what DGNC_VERIFY_BOARD() does and have you
even tried to compile this?  Surely the compiler will complain that some
paths don't have a return value?

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] defines modified to match the 80-char rule

2015-07-06 Thread Dan Carpenter
On Mon, Jul 06, 2015 at 08:07:52AM +0200, Krzysztof Hałasa wrote:
 Joe Perches j...@perches.com writes:
 
  Nah, you're not an extremist, you're just preferring narrowly
  localized readability over global consistency.
 
  That's fine and all, until you come up to LCONSOLE_ERROR_MSG
  type use which blows the nice old formatting up.
 
  So what I suggested is just a simple consistency thing.
 
 So, could we have the localized readability when it makes sense,
 and the default rules when nothing else applies?

It's localized to literally those four lines, the pattern breaks down
for the other six macros.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] defines modified to match the 80-char rule

2015-07-06 Thread Krzysztof Hałasa
Joe Perches j...@perches.com writes:

 So, could we have the localized readability when it makes sense,
 and the default rules when nothing else applies?

 Then the question becomes how local.

The answer seems easy to me: as much as it's needed to get the best
readability.

If that means 4 or 2 custom formatted lines, great. Why not?

It should be the maintainer's call anyway. It's (s)he who has to work
with the code in question most.

 OTOH I think the 80 columns rule should go.

 I have no issue with that.
 There should be some limit though.

Sure, the max readability should set the limit. Though I would say one
shouldn't exceed maybe 132 chars (this is what old VT100 had, and this
is also supported on PC since some 8-bit XT-BUS VGA cards).

132 chars also allow for full 80-char console output text lines.
-- 
Krzysztof Halasa

Industrial Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: dgnc: Replace macro with flow control statement by a function

2015-07-06 Thread Sudip Mukherjee
On Mon, Jul 06, 2015 at 05:45:24PM +0530, Ravi Teja Darbha wrote:
 What you need to do is to replace all DGNC_VERIFY_BOARD() macro calls with 
 its definition.
And repeating the same code 12 times??
That is why the macro is there, to avoid the duplication of code.

regards
sudip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv2 6/9] staging: vme_user: return -EFAULT on __copy_*_user errors

2015-07-06 Thread Martyn Welch



On 25/06/15 13:05, Dmitry Kalinkin wrote:


This is why I think this is not a “we broke userspace” situation.


The vme_user module is also in the staging tree and (almost) by 
definition the API shouldn't be considered as stable.


Martyn

--
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: dgnc: Replace macro with flow control statement by a function

2015-07-06 Thread Ravi Teja Darbha
What you need to do is to replace all DGNC_VERIFY_BOARD() macro calls with its 
definition.

Regards,
Ravi Teja

On Sun, Jul 05, 2015 at 11:46:28PM +0530, Arjun Krishna Babu wrote:
 This patch fixes the checkpatch.pl warning:
 
 WARNING: Macros with flow control statements should be avoided
 
 Replace the macro with a function doing the exact same task as the
 macro.
 
 Signed-off-by: Arjun Krishna Babu arjunkrishnabab...@gmail.com
 ---
  drivers/staging/dgnc/dgnc_sysfs.c | 22 ++
  1 file changed, 10 insertions(+), 12 deletions(-)
 
 diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
 b/drivers/staging/dgnc/dgnc_sysfs.c
 index 44db870..8ab0922 100644
 --- a/drivers/staging/dgnc/dgnc_sysfs.c
 +++ b/drivers/staging/dgnc/dgnc_sysfs.c
 @@ -92,19 +92,17 @@ void dgnc_remove_driver_sysfiles(struct pci_driver 
 *dgnc_driver)
  }
  
  
 -#define DGNC_VERIFY_BOARD(p, bd) \
 - do {\
 - if (!p) \
 - return 0;   \
 - \
 - bd = dev_get_drvdata(p);\
 - if (!bd || bd-magic != DGNC_BOARD_MAGIC)   \
 - return 0;   \
 - if (bd-state != BOARD_READY)   \
 - return 0;   \
 - } while (0)
 -
 +static int DGNC_VERIFY_BOARD(struct device *p, struct dgnc_board *bd)
 +{
 + if (!p)
 + return 0;
  
 + bd = dev_get_drvdata(p);
 + if (!bd || bd-magic != DGNC_BOARD_MAGIC)
 + return 0;
 + if (bd-state != BOARD_READY)
 + return 0;
 +}
  
  static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
char *buf)
 -- 
 1.9.1
 
 ___
 devel mailing list
 de...@linuxdriverproject.org
 http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv3 6/9] staging: vme_user: switch to returning -EFAULT on __copy_*_user errors

2015-07-06 Thread Dmitry Kalinkin
On Mon, Jul 6, 2015 at 3:51 PM, Martyn Welch martyn.we...@ge.com wrote:
 On 26/06/15 21:39, Dmitry Kalinkin wrote:

 Signed-off-by: Dmitry Kalinkin dmitry.kalin...@gmail.com
 ---
   drivers/staging/vme/devices/vme_user.c | 47
 --
   1 file changed, 11 insertions(+), 36 deletions(-)

 diff --git a/drivers/staging/vme/devices/vme_user.c
 b/drivers/staging/vme/devices/vme_user.c
 index a2345db..ef876a4 100644
 --- a/drivers/staging/vme/devices/vme_user.c
 +++ b/drivers/staging/vme/devices/vme_user.c
 @@ -123,7 +123,6 @@ struct vme_user_vma_priv {
   static ssize_t resource_to_user(int minor, char __user *buf, size_t
 count,
 loff_t *ppos)
   {
 -   ssize_t retval;
 ssize_t copied = 0;

 if (count  image[minor].size_buf)
 @@ -135,13 +134,8 @@ static ssize_t resource_to_user(int minor, char
 __user *buf, size_t count,
 if (copied  0)
 return (int)copied;

 -   retval = __copy_to_user(buf, image[minor].kern_buf,
 -   (unsigned long)copied);
 -   if (retval != 0) {
 -   copied = (copied - retval);
 -   pr_info(User copy failed\n);
 -   return -EINVAL;
 -   }
 +   if (__copy_to_user(buf, image[minor].kern_buf, (unsigned
 long)copied))
 +   return -EFAULT;

 return copied;


 Does __copy_to_user() not return the number of bytes still to be copied? The
 above seems to add the assumption that __copy_to_user()
 can't return part way through a copy.
Yes it does. And this information is useless in userspace.
Returning -EFAULT would be more informative in this case.
I couldn't find an example of kernel code doing this any other way:
http://lxr.free-electrons.com/ident?i=__copy_to_user

   }
 @@ -149,21 +143,16 @@ static ssize_t resource_to_user(int minor, char
 __user *buf, size_t count,
   static ssize_t resource_from_user(unsigned int minor, const char __user
 *buf,
   size_t count, loff_t *ppos)
   {
 -   ssize_t retval;
 ssize_t copied = 0;

 if (count  image[minor].size_buf)
 count = image[minor].size_buf;

 -   retval = __copy_from_user(image[minor].kern_buf, buf,
 - (unsigned long)count);
 -   if (retval != 0)
 -   copied = (copied - retval);
 -   else
 -   copied = count;
 +   if (__copy_from_user(image[minor].kern_buf, buf, (unsigned
 long)count))
 +   return -EFAULT;


 Same here.

 copied = vme_master_write(image[minor].resource,
 image[minor].kern_buf,
 - copied, *ppos);
 + count, *ppos);

 return copied;
   }
 @@ -172,38 +161,24 @@ static ssize_t buffer_to_user(unsigned int minor,
 char __user *buf,
   size_t count, loff_t *ppos)
   {
 void *image_ptr;
 -   ssize_t retval;

 image_ptr = image[minor].kern_buf + *ppos;
 +   if (__copy_to_user(buf, image_ptr, (unsigned long)count))
 +   return -EFAULT;


 Ditto.

 -   retval = __copy_to_user(buf, image_ptr, (unsigned long)count);
 -   if (retval != 0) {
 -   retval = (count - retval);
 -   pr_warn(Partial copy to userspace\n);
 -   } else
 -   retval = count;
 -
 -   /* Return number of bytes successfully read */
 -   return retval;
 +   return count;
   }

   static ssize_t buffer_from_user(unsigned int minor, const char __user
 *buf,
 size_t count, loff_t *ppos)
   {
 void *image_ptr;
 -   size_t retval;

 image_ptr = image[minor].kern_buf + *ppos;
 +   if (__copy_from_user(image_ptr, buf, (unsigned long)count))
 +   return -EFAULT;


 And here.

 -   retval = __copy_from_user(image_ptr, buf, (unsigned long)count);
 -   if (retval != 0) {
 -   retval = (count - retval);
 -   pr_warn(Partial copy to userspace\n);
 -   } else
 -   retval = count;
 -
 -   /* Return number of bytes successfully read */
 -   return retval;
 +   return count;
   }

   static ssize_t vme_user_read(struct file *file, char __user *buf, size_t
 count,


 --
 Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
 GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
 T +44(0)1327322748 | Manchester, M2 3AB
 E martyn.we...@ge.com  | VAT:GB 927559189
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/7] Drivers: hv: vmbus: define the new offer type for Hyper-V socket (hvsock)

2015-07-06 Thread Dexuan Cui
A helper function is also added.

Signed-off-by: Dexuan Cui de...@microsoft.com
---
 include/linux/hyperv.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 30d3a1f..aa21814 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -236,6 +236,7 @@ struct vmbus_channel_offer {
 #define VMBUS_CHANNEL_LOOPBACK_OFFER   0x100
 #define VMBUS_CHANNEL_PARENT_OFFER 0x200
 #define VMBUS_CHANNEL_REQUEST_MONITORED_NOTIFICATION   0x400
+#define VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER 0x2000
 
 struct vmpacket_descriptor {
u16 type;
@@ -758,6 +759,12 @@ struct vmbus_channel {
struct list_head percpu_list;
 };
 
+static inline bool is_hvsock_channel(const struct vmbus_channel *c)
+{
+   return !!(c-offermsg.offer.chn_flags 
+   VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER);
+}
+
 static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
 {
c-batched_reading = state;
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/7] Drivers: hv: vmbus: add APIs to register callbacks to process hvsock connection

2015-07-06 Thread Dexuan Cui
With the 2 APIs supplied by the VMBus driver, the coming net/hvsock driver
can register 2 callbacks and can know when a new hvsock connection is
offered by the host, and when a hvsock connection is being closed by the
host.

Signed-off-by: Dexuan Cui de...@microsoft.com
---
 drivers/hv/Makefile   |  4 ++-
 drivers/hv/channel_mgmt.c |  9 ++
 drivers/hv/hvsock_callbacks.c | 71 +++
 include/linux/hyperv.h|  9 ++
 4 files changed, 92 insertions(+), 1 deletion(-)
 create mode 100644 drivers/hv/hvsock_callbacks.c

diff --git a/drivers/hv/Makefile b/drivers/hv/Makefile
index 39c9b2c..ef6f8a8 100644
--- a/drivers/hv/Makefile
+++ b/drivers/hv/Makefile
@@ -4,5 +4,7 @@ obj-$(CONFIG_HYPERV_BALLOON)+= hv_balloon.o
 
 hv_vmbus-y := vmbus_drv.o \
 hv.o connection.o channel.o \
-channel_mgmt.o ring_buffer.o
+channel_mgmt.o ring_buffer.o \
+hvsock_callbacks.o
+
 hv_utils-y := hv_util.o hv_kvp.o hv_snapshot.o hv_fcopy.o hv_utils_transport.o
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 7018c53..a8b1e61 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -300,6 +300,12 @@ static void vmbus_process_offer(struct vmbus_channel 
*newchannel)
return;
}
 
+   if (is_hvsock_channel(newchannel)) {
+   if (hvsock_process_offer(newchannel) != 0)
+   goto err_deq_chan;
+   return;
+   }
+
/*
 * Start the process of binding this offer to the driver
 * We need to set the DeviceObject field before calling
@@ -564,7 +570,10 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)
vmbus_device_unregister(channel-device_obj);
put_device(dev);
}
+   } else if (is_hvsock_channel(channel)) {
+   hvsock_process_offer_rescind(channel);
} else {
+   /* it is a sub-channel. */
hv_process_channel_removal(channel,
channel-offermsg.child_relid);
}
diff --git a/drivers/hv/hvsock_callbacks.c b/drivers/hv/hvsock_callbacks.c
new file mode 100644
index 000..28f7b75
--- /dev/null
+++ b/drivers/hv/hvsock_callbacks.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2015, Microsoft Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+#define pr_fmt(fmt) KBUILD_MODNAME :  fmt
+
+#include linux/hyperv.h
+
+/* We should hold the mutex when getting/setting the function pointers */
+static DEFINE_MUTEX(hvsock_cb_mutex);
+static int (*__process_offer)(struct vmbus_channel *channel);
+static void (*__process_offer_rescind)(struct vmbus_channel *channel);
+
+int hvsock_process_offer(struct vmbus_channel *channel)
+{
+   int ret = -ENODEV;
+
+   mutex_lock(hvsock_cb_mutex);
+
+   if (__process_offer != NULL)
+   ret = __process_offer(channel);
+
+   mutex_unlock(hvsock_cb_mutex);
+
+   return ret;
+}
+
+void hvsock_process_offer_rescind(struct vmbus_channel *channel)
+{
+   mutex_lock(hvsock_cb_mutex);
+
+   if (__process_offer_rescind != NULL)
+   __process_offer_rescind(channel);
+   else
+   hv_process_channel_removal(channel,
+   channel-offermsg.child_relid);
+
+   mutex_unlock(hvsock_cb_mutex);
+}
+
+void vmbus_register_hvsock_callbacks(
+   int (*process_offer)(struct vmbus_channel *),
+   void (*process_offer_rescind)(struct vmbus_channel *))
+{
+   mutex_lock(hvsock_cb_mutex);
+
+   __process_offer = process_offer;
+   __process_offer_rescind = process_offer_rescind;
+
+   mutex_unlock(hvsock_cb_mutex);
+}
+EXPORT_SYMBOL_GPL(vmbus_register_hvsock_callbacks);
+
+void vmbus_unregister_hvsock_callbacks(void)
+{
+   mutex_lock(hvsock_cb_mutex);
+
+   __process_offer = NULL;
+   __process_offer_rescind = NULL;
+
+   mutex_unlock(hvsock_cb_mutex);
+}
+EXPORT_SYMBOL_GPL(vmbus_unregister_hvsock_callbacks);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 1e4c58e..307910b3 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1270,6 +1270,15 @@ extern __u32 vmbus_proto_version;
 int vmbus_send_tl_connect_request(const uuid_le *shv_guest_servie_id,
const uuid_le *shv_host_servie_id);
 
+extern int hvsock_process_offer(struct vmbus_channel *channel);
+extern void hvsock_process_offer_rescind(struct vmbus_channel 

[PATCH 3/7] Drivers: hv: vmbus: add APIs to send/recv hvsock packet and get the r/w-ability

2015-07-06 Thread Dexuan Cui
This will be used by the coming net/hvsock driver.

Signed-off-by: Dexuan Cui de...@microsoft.com
---
 drivers/hv/channel.c  | 131 ++
 drivers/hv/hyperv_vmbus.h |   4 ++
 drivers/hv/ring_buffer.c  |  14 +
 include/linux/hyperv.h|  33 
 4 files changed, 182 insertions(+)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index b09d1b7..9c3727a 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -758,6 +758,53 @@ int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel 
*channel,
 EXPORT_SYMBOL_GPL(vmbus_sendpacket_pagebuffer_ctl);
 
 /*
+ * vmbus_sendpacket_hvsock - Send the hvsock payload 'buf' into the vmbus
+ * ringbuffer
+ */
+int vmbus_sendpacket_hvsock(struct vmbus_channel *channel, void *buf, u32 len)
+{
+   struct vmpacket_descriptor desc;
+   struct vmpipe_proto_header pipe_hdr;
+   u32 packetlen;
+   u32 packetlen_aligned;
+   struct kvec bufferlist[4];
+   u64 aligned_data = 0;
+   int ret;
+   bool signal = false;
+
+   packetlen = HVSOCK_HEADER_LEN + len;
+   packetlen_aligned = ALIGN(packetlen, sizeof(u64));
+
+   /* Setup the descriptor */
+   desc.type = VM_PKT_DATA_INBAND;
+   /* in 8-bytes granularity */
+   desc.offset8 = sizeof(struct vmpacket_descriptor)  3;
+   desc.len8 = (u16)(packetlen_aligned  3);
+   desc.flags = 0;
+   desc.trans_id = 0;
+
+   pipe_hdr.pkt_type = 1;
+   pipe_hdr.data_size = len;
+
+   bufferlist[0].iov_base = desc;
+   bufferlist[0].iov_len  = sizeof(struct vmpacket_descriptor);
+   bufferlist[1].iov_base = pipe_hdr;
+   bufferlist[1].iov_len  = sizeof(struct vmpipe_proto_header);
+   bufferlist[2].iov_base = buf;
+   bufferlist[2].iov_len  = len;
+   bufferlist[3].iov_base = aligned_data;
+   bufferlist[3].iov_len  = packetlen_aligned - packetlen;
+
+   ret = hv_ringbuffer_write(channel-outbound, bufferlist, 4, signal);
+
+   if (ret == 0  signal)
+   vmbus_setevent(channel);
+
+   return ret;
+}
+EXPORT_SYMBOL(vmbus_sendpacket_hvsock);
+
+/*
  * vmbus_sendpacket_pagebuffer - Send a range of single-page buffer
  * packets using a GPADL Direct packet type.
  */
@@ -978,3 +1025,87 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, 
void *buffer,
return ret;
 }
 EXPORT_SYMBOL_GPL(vmbus_recvpacket_raw);
+
+/*
+ * vmbus_recvpacket_hvsock - Receive the hvsock payload from the vmbus
+ * ringbuffer into the 'buffer'.
+ */
+int vmbus_recvpacket_hvsock(struct vmbus_channel *channel, void *buffer,
+   u32 bufferlen, u32 *buffer_actual_len)
+{
+   struct vmpacket_descriptor *desc;
+   struct vmpipe_proto_header *pipe_hdr;
+   u32 packet_len, payload_len;
+   int ret;
+   bool signal = false;
+
+   *buffer_actual_len = 0;
+
+   if (bufferlen  HVSOCK_HEADER_LEN)
+   return -ENOBUFS;
+
+   ret = hv_ringbuffer_peek(channel-inbound, buffer,
+HVSOCK_HEADER_LEN);
+   if (ret != 0)
+   return 0;
+
+   desc = (struct vmpacket_descriptor *)buffer;
+   packet_len = desc-len8  3;
+   if (desc-type != VM_PKT_DATA_INBAND ||
+   desc-offset8 != (sizeof(*desc) / 8) ||
+   packet_len  HVSOCK_HEADER_LEN)
+   return -EIO;
+
+   pipe_hdr = (struct vmpipe_proto_header *)(desc + 1);
+   payload_len = pipe_hdr-data_size;
+
+   if (pipe_hdr-pkt_type != 1 || payload_len == 0)
+   return -EIO;
+
+   if (HVSOCK_PKT_LEN(payload_len) != packet_len + PREV_INDICES_LEN)
+   return -EIO;
+
+   if (bufferlen  packet_len - HVSOCK_HEADER_LEN)
+   return -ENOBUFS;
+
+   /* Copy over the hvsock payload to the user buffer */
+   ret = hv_ringbuffer_read(channel-inbound, buffer,
+packet_len - HVSOCK_HEADER_LEN,
+HVSOCK_HEADER_LEN, signal);
+   if (ret != 0)
+   return ret;
+
+   *buffer_actual_len = payload_len;
+
+   if (signal)
+   vmbus_setevent(channel);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(vmbus_recvpacket_hvsock);
+
+/*
+ * vmbus_get_hvsock_rw_status - can the ringbuffer be read/written?
+ */
+void vmbus_get_hvsock_rw_status(struct vmbus_channel *channel,
+  bool *can_read, bool *can_write)
+{
+   u32 avl_read_bytes, avl_write_bytes, dummy;
+
+   if (can_read != NULL) {
+   hv_get_ringbuffer_space(channel-inbound, avl_read_bytes,
+   dummy);
+   *can_read = avl_read_bytes = HVSOCK_MIN_PKT_LEN;
+   }
+
+   /* We write into the ringbuffer only when we're able to write a
+* a payload of 4096 bytes (the actual written payload's length may be
+* less than 4096).
+*/
+   if (can_write != NULL) {
+   

Re: [PATCHv3 6/9] staging: vme_user: switch to returning -EFAULT on __copy_*_user errors

2015-07-06 Thread Martyn Welch

On 26/06/15 21:39, Dmitry Kalinkin wrote:

Signed-off-by: Dmitry Kalinkin dmitry.kalin...@gmail.com
---
  drivers/staging/vme/devices/vme_user.c | 47 --
  1 file changed, 11 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/vme/devices/vme_user.c 
b/drivers/staging/vme/devices/vme_user.c
index a2345db..ef876a4 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -123,7 +123,6 @@ struct vme_user_vma_priv {
  static ssize_t resource_to_user(int minor, char __user *buf, size_t count,
loff_t *ppos)
  {
-   ssize_t retval;
ssize_t copied = 0;

if (count  image[minor].size_buf)
@@ -135,13 +134,8 @@ static ssize_t resource_to_user(int minor, char __user 
*buf, size_t count,
if (copied  0)
return (int)copied;

-   retval = __copy_to_user(buf, image[minor].kern_buf,
-   (unsigned long)copied);
-   if (retval != 0) {
-   copied = (copied - retval);
-   pr_info(User copy failed\n);
-   return -EINVAL;
-   }
+   if (__copy_to_user(buf, image[minor].kern_buf, (unsigned long)copied))
+   return -EFAULT;

return copied;


Does __copy_to_user() not return the number of bytes still to be copied? 
The above seems to add the assumption that __copy_to_user()

can't return part way through a copy.


  }
@@ -149,21 +143,16 @@ static ssize_t resource_to_user(int minor, char __user 
*buf, size_t count,
  static ssize_t resource_from_user(unsigned int minor, const char __user *buf,
  size_t count, loff_t *ppos)
  {
-   ssize_t retval;
ssize_t copied = 0;

if (count  image[minor].size_buf)
count = image[minor].size_buf;

-   retval = __copy_from_user(image[minor].kern_buf, buf,
- (unsigned long)count);
-   if (retval != 0)
-   copied = (copied - retval);
-   else
-   copied = count;
+   if (__copy_from_user(image[minor].kern_buf, buf, (unsigned long)count))
+   return -EFAULT;



Same here.


copied = vme_master_write(image[minor].resource, image[minor].kern_buf,
- copied, *ppos);
+ count, *ppos);

return copied;
  }
@@ -172,38 +161,24 @@ static ssize_t buffer_to_user(unsigned int minor, char 
__user *buf,
  size_t count, loff_t *ppos)
  {
void *image_ptr;
-   ssize_t retval;

image_ptr = image[minor].kern_buf + *ppos;
+   if (__copy_to_user(buf, image_ptr, (unsigned long)count))
+   return -EFAULT;



Ditto.


-   retval = __copy_to_user(buf, image_ptr, (unsigned long)count);
-   if (retval != 0) {
-   retval = (count - retval);
-   pr_warn(Partial copy to userspace\n);
-   } else
-   retval = count;
-
-   /* Return number of bytes successfully read */
-   return retval;
+   return count;
  }

  static ssize_t buffer_from_user(unsigned int minor, const char __user *buf,
size_t count, loff_t *ppos)
  {
void *image_ptr;
-   size_t retval;

image_ptr = image[minor].kern_buf + *ppos;
+   if (__copy_from_user(image_ptr, buf, (unsigned long)count))
+   return -EFAULT;



And here.


-   retval = __copy_from_user(image_ptr, buf, (unsigned long)count);
-   if (retval != 0) {
-   retval = (count - retval);
-   pr_warn(Partial copy to userspace\n);
-   } else
-   retval = count;
-
-   /* Return number of bytes successfully read */
-   return retval;
+   return count;
  }

  static ssize_t vme_user_read(struct file *file, char __user *buf, size_t 
count,



--
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/7] introduce Hyper-V VM Sockets(hvsock)

2015-07-06 Thread Dexuan Cui
Hyper-V VM Sockets (hvsock) is a byte-stream based communication mechanism
between Windowsd 10 (or later) host and a guest. It's kind of TCP over
VMBus, but the transportation layer (VMBus) is much simpler than IP.
With Hyper-V VM Sockets, applications between the host and a guest can
talk with each other directly by the traditional BSD-style socket APIs.

The patchset implements the necessary support in the guest side by adding
the necessary new APIs in the vmbus driver, and introducing a new driver
hv_sock.ko, which implements_a new socket address family AF_HYPERV.


I know the kernel has already had a VM Sockets driver (AF_VSOCK) based
on VMware's VMCI (net/vmw_vsock/, drivers/misc/vmw_vmci), and KVM is
proposing AF_VSOCK of virtio version:
http://thread.gmane.org/gmane.linux.network/365205.

However, though Hyper-V VM Sockets may seem conceptually similar to
AF_VOSCK, there are differences in the transportation layer, and IMO these
make the direct code reusing impractical:

1. In AF_VSOCK, the endpoint type is: u32 ContextID, u32 Port, but in
AF_HYPERV, the endpoint type is: GUID VM_ID, GUID ServiceID. Here GUID
is 128-bit.

2. AF_VSOCK supports SOCK_DGRAM, while AF_HYPERV doesn't.

3. AF_VSOCK supports some special sock opts, like SO_VM_SOCKETS_BUFFER_SIZE,
SO_VM_SOCKETS_BUFFER_MIN/MAX_SIZE and SO_VM_SOCKETS_CONNECT_TIMEOUT.
These are meaningless to AF_HYPERV.

4. Some AF_VSOCK's VMCI transportation ops are meanless to AF_HYPERV/VMBus,
like.notify_recv_init
.notify_recv_pre_block
.notify_recv_pre_dequeue
.notify_recv_post_dequeue
.notify_send_init
.notify_send_pre_block
.notify_send_pre_enqueue
.notify_send_post_enqueue
etc.

So I think we'd better introduce a new address family: AF_HYPERV.


Please review the patchset.

Looking forward to your comments!

Dexuan Cui (7):
  Drivers: hv: vmbus: define the new offer type for Hyper-V socket
(hvsock)
  Drivers: hv: vmbus: define a new VMBus message type for hvsock
  Drivers: hv: vmbus: add APIs to send/recv hvsock packet and get the
r/w-ability
  Drivers: hv: vmbus: add APIs to register callbacks to process hvsock
connection
  Drivers: hv: vmbus: add a helper function to set a channel's pending
send size
  hvsock: introduce Hyper-V VM Sockets feature
  Drivers: hv: vmbus: disable local interrupt when hvsock's callback is
running

 MAINTAINERS   |2 +
 drivers/hv/Makefile   |4 +-
 drivers/hv/channel.c  |  146 
 drivers/hv/channel_mgmt.c |   13 +
 drivers/hv/connection.c   |   15 +-
 drivers/hv/hvsock_callbacks.c |   71 ++
 drivers/hv/hyperv_vmbus.h |4 +
 drivers/hv/ring_buffer.c  |   14 +
 include/linux/hyperv.h|   68 ++
 include/linux/socket.h|4 +-
 include/net/af_hvsock.h   |   44 ++
 include/uapi/linux/hyperv.h   |   16 +
 net/Kconfig   |1 +
 net/Makefile  |1 +
 net/hv_sock/Kconfig   |   10 +
 net/hv_sock/Makefile  |5 +
 net/hv_sock/af_hvsock.c   | 1463 +
 17 files changed, 1878 insertions(+), 3 deletions(-)
 create mode 100644 drivers/hv/hvsock_callbacks.c
 create mode 100644 include/net/af_hvsock.h
 create mode 100644 net/hv_sock/Kconfig
 create mode 100644 net/hv_sock/Makefile
 create mode 100644 net/hv_sock/af_hvsock.c

-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/3] VME bus error handling overhaul

2015-07-06 Thread Martyn Welch

Hi Dmitry,

These are looking good to me.

You mention error handling in relation to vme_master_mmap, am I right in 
thinking patch 3 avoids errors being recorded when triggered by an mmap 
access (so as not to appear as a spurious error on a later access)?


I think it would be worth at least logging errors to the kernel log 
should they be generated and not be handled by a error handler, so 
someone using mmap gets at least some form of notification that their 
accesses are resulting on bus errors. What do you think?


Martyn

On 02/07/15 15:11, Dmitry Kalinkin wrote:

This moves tsi148 error handling into VME subsystem so it can be shared with
the other bridge driver.  Then there is a change to close a fixme on separating
errors by address space.  And finally a fix for memory leak problem that was
introduced with support of mmap's.

The next logical step in this direction would be to add error handling support
to ca91cx42 and make it unconditional for tsi148. It also makes much sense to
add synchronization to error-related list operations (spinlocks, rcu).

Dmitry Kalinkin (3):
   vme: move tsi148 error handling into VME subsystem
   vme: include address space in error filtering
   vme: change bus error handling scheme

  drivers/vme/bridges/vme_ca91cx42.c |   3 +-
  drivers/vme/bridges/vme_tsi148.c   | 170 ++---
  drivers/vme/vme.c  |  83 ++
  drivers/vme/vme_bridge.h   |  21 +++--
  4 files changed, 147 insertions(+), 130 deletions(-)



--
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 6/7] hvsock: introduce Hyper-V VM Sockets feature

2015-07-06 Thread Dexuan Cui
Hyper-V VM sockets (hvsock) supplies a byte-stream based communication
mechanism between the host and a guest. It's kind of TCP over VMBus, but
the transportation layer (VMBus) is much simpler than IP. With Hyper-V VM
Sockets, applications between the host and a guest can talk with each
other directly by the traditional BSD-style socket APIs.

Hyper-V VM Sockets is only available on Windows 10 host and later. The
patch implements the necessary support in the guest side by introducing
a new socket address family AF_HYPERV.

Signed-off-by: Dexuan Cui de...@microsoft.com
---
 MAINTAINERS |2 +
 include/linux/socket.h  |4 +-
 include/net/af_hvsock.h |   44 ++
 include/uapi/linux/hyperv.h |   16 +
 net/Kconfig |1 +
 net/Makefile|1 +
 net/hv_sock/Kconfig |   10 +
 net/hv_sock/Makefile|5 +
 net/hv_sock/af_hvsock.c | 1463 +++
 9 files changed, 1545 insertions(+), 1 deletion(-)
 create mode 100644 include/net/af_hvsock.h
 create mode 100644 net/hv_sock/Kconfig
 create mode 100644 net/hv_sock/Makefile
 create mode 100644 net/hv_sock/af_hvsock.c

diff --git a/MAINTAINERS b/MAINTAINERS
index e7bdbac..a4a7e03 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4941,7 +4941,9 @@ F:drivers/input/serio/hyperv-keyboard.c
 F: drivers/net/hyperv/
 F: drivers/scsi/storvsc_drv.c
 F: drivers/video/fbdev/hyperv_fb.c
+F: net/hv_sock/
 F: include/linux/hyperv.h
+F: include/net/af_hvsock.h
 F: tools/hv/
 
 I2C OVER PARALLEL PORT
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 5bf59c8..d5ef612 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -200,7 +200,8 @@ struct ucred {
 #define AF_ALG 38  /* Algorithm sockets*/
 #define AF_NFC 39  /* NFC sockets  */
 #define AF_VSOCK   40  /* vSockets */
-#define AF_MAX 41  /* For now.. */
+#define AF_HYPERV  41  /* Hyper-V virtual sockets  */
+#define AF_MAX 42  /* For now.. */
 
 /* Protocol families, same as address families. */
 #define PF_UNSPEC  AF_UNSPEC
@@ -246,6 +247,7 @@ struct ucred {
 #define PF_ALG AF_ALG
 #define PF_NFC AF_NFC
 #define PF_VSOCK   AF_VSOCK
+#define PF_HYPERV  AF_HYPERV
 #define PF_MAX AF_MAX
 
 /* Maximum queue length specifiable by listen.  */
diff --git a/include/net/af_hvsock.h b/include/net/af_hvsock.h
new file mode 100644
index 000..9951658
--- /dev/null
+++ b/include/net/af_hvsock.h
@@ -0,0 +1,44 @@
+#ifndef __AF_HVSOCK_H__
+#define __AF_HVSOCK_H__
+
+#include linux/kernel.h
+#include linux/hyperv.h
+#include net/sock.h
+
+#define VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV (5 * PAGE_SIZE)
+#define VMBUS_RINGBUFFER_SIZE_HVSOCK_SEND (5 * PAGE_SIZE)
+
+#define HVSOCK_RCV_BUF_SZ  VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV
+#define HVSOCK_SND_BUF_SZ  PAGE_SIZE
+
+#define sk_to_hvsock(__sk)((struct hvsock_sock *)(__sk))
+#define hvsock_to_sk(__hvsk)   ((struct sock *)(__hvsk))
+
+struct hvsock_sock {
+   /* sk must be the first member. */
+   struct sock sk;
+
+   struct sockaddr_hv local_addr;
+   struct sockaddr_hv remote_addr;
+
+   /* protected by the global hvsock_mutex */
+   struct list_head bound_list;
+   struct list_head connected_list;
+
+   struct list_head accept_queue;
+   /* used by enqueue and dequeue */
+   struct mutex accept_queue_mutex;
+
+   struct delayed_work dwork;
+
+   u32 peer_shutdown;
+
+   struct vmbus_channel *channel;
+
+   char send_buf[HVSOCK_SND_BUF_SZ];
+   char recv_buf[HVSOCK_RCV_BUF_SZ];
+   unsigned int recv_data_len;
+   unsigned int recv_data_offset;
+};
+
+#endif /* __AF_HVSOCK_H__ */
diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
index e4c0a35..ed51402 100644
--- a/include/uapi/linux/hyperv.h
+++ b/include/uapi/linux/hyperv.h
@@ -26,6 +26,7 @@
 #define _UAPI_HYPERV_H
 
 #include linux/uuid.h
+#include linux/socket.h
 
 /*
  * Framework version for util services.
@@ -395,4 +396,19 @@ struct hv_kvp_ip_msg {
struct hv_kvp_ipaddr_value  kvp_ip_val;
 } __attribute__((packed));
 
+/* This is the Hyper-V socket's address format. */
+struct sockaddr_hv {
+   __kernel_sa_family_tshv_family; /* Address family   */
+   __le16  reserved;   /* Must be zero */
+   uuid_le shv_vm_id;  /* Not used by Linux. Must be Zero. */
+   uuid_le shv_service_id; /* Service ID   */
+};
+
+#define SHV_VMID_GUEST NULL_UUID_LE
+#define SHV_VMID_HOST  NULL_UUID_LE
+
+#define SHV_SERVICE_ID_ANY NULL_UUID_LE
+
+#define SHV_PROTO_RAW  1
+
 #endif /* _UAPI_HYPERV_H */
diff --git a/net/Kconfig b/net/Kconfig
index 57a7c5a..9ad9f66 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -228,6 +228,7 @@ source 

[PATCH 7/7] Drivers: hv: vmbus: disable local interrupt when hvsock's callback is running

2015-07-06 Thread Dexuan Cui
In the SMP guest case, when the per-channel callback hvsock_events() is
running on virtual CPU A, if the guest tries to close the connection on
virtual CPU B: we invoke vmbus_close() - vmbus_close_internal(),
then we can have trouble: on B, vmbus_close_internal() will send IPI
reset_channel_cb() to A, trying to set channel-onchannel_callbackto NULL;
on A, if the IPI handler happens between
if (channel-onchannel_callback != NULL) and invoking
channel-onchannel_callback, we'll invoke a function pointer of NULL.

This is why the patch is necessary.

Signed-off-by: Dexuan Cui de...@microsoft.com
---
 drivers/hv/connection.c | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 4fc2e88..4766fd8 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -319,6 +319,9 @@ static void process_chn_event(u32 relid)
void *arg;
bool read_state;
u32 bytes_to_read;
+   bool is_hvsock = false;
+
+   local_irq_disable();
 
/*
 * Find the channel based on this relid and invokes the
@@ -327,7 +330,11 @@ static void process_chn_event(u32 relid)
channel = pcpu_relid2channel(relid);
 
if (!channel)
-   return;
+   goto out;
+
+   is_hvsock = is_hvsock_channel(channel);
+   if (!is_hvsock)
+   local_irq_enable();
 
/*
 * A channel once created is persistent even when there
@@ -363,6 +370,12 @@ static void process_chn_event(u32 relid)
bytes_to_read = 0;
} while (read_state  (bytes_to_read != 0));
}
+
+   /* local_irq_enable() is alredy invoked above */
+   if (!is_hvsock)
+   return;
+out:
+   local_irq_enable();
 }
 
 /*
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/7] Drivers: hv: vmbus: add a helper function to set a channel's pending send size

2015-07-06 Thread Dexuan Cui
This will be used by the coming net/hvsock driver.

Signed-off-by: Dexuan Cui de...@microsoft.com
---
 include/linux/hyperv.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 307910b3..c52f4cb 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -791,6 +791,12 @@ static inline void *get_per_channel_state(struct 
vmbus_channel *c)
return c-per_channel_state;
 }
 
+static inline void set_channel_pending_send_size(struct vmbus_channel *c,
+u32 size)
+{
+   c-outbound.ring_buffer-pending_send_sz = size;
+}
+
 void vmbus_onmessage(void *context);
 
 int vmbus_request_offers(void);
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: dgnc: Replace macro with flow control statement by a function

2015-07-06 Thread Valdis . Kletnieks
On Mon, 06 Jul 2015 18:50:12 +0530, Ravi Teja Darbha said:
 Why would you use a macro to avoid code duplication?

The macro does end up putting code in each place it's used.
However, the actual code is in one place rather than open-coded
in multiple places that can diverge over time (somebody patching 2 of
3 instances, and missing 1, for example).


pgphviufHeQGQ.pgp
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/7] introduce Hyper-V VM Sockets(hvsock)

2015-07-06 Thread Dexuan Cui
Hyper-V VM Sockets (hvsock) is a byte-stream based communication mechanism
between Windowsd 10 (or later) host and a guest. It's kind of TCP over
VMBus, but the transportation layer (VMBus) is much simpler than IP.
With Hyper-V VM Sockets, applications between the host and a guest can
talk with each other directly by the traditional BSD-style socket APIs.

The patchset implements the necessary support in the guest side by adding
the necessary new APIs in the vmbus driver, and introducing a new driver
hv_sock.ko, which implements_a new socket address family AF_HYPERV.


I know the kernel has already had a VM Sockets driver (AF_VSOCK) based
on VMware's VMCI (net/vmw_vsock/, drivers/misc/vmw_vmci), and KVM is
proposing AF_VSOCK of virtio version:
http://thread.gmane.org/gmane.linux.network/365205.

However, though Hyper-V VM Sockets may seem conceptually similar to
AF_VOSCK, there are differences in the transportation layer, and IMO these
make the direct code reusing impractical:

1. In AF_VSOCK, the endpoint type is: u32 ContextID, u32 Port, but in
AF_HYPERV, the endpoint type is: GUID VM_ID, GUID ServiceID. Here GUID
is 128-bit.

2. AF_VSOCK supports SOCK_DGRAM, while AF_HYPERV doesn't.

3. AF_VSOCK supports some special sock opts, like SO_VM_SOCKETS_BUFFER_SIZE,
SO_VM_SOCKETS_BUFFER_MIN/MAX_SIZE and SO_VM_SOCKETS_CONNECT_TIMEOUT.
These are meaningless to AF_HYPERV.

4. Some AF_VSOCK's VMCI transportation ops are meanless to AF_HYPERV/VMBus,
like.notify_recv_init
.notify_recv_pre_block
.notify_recv_pre_dequeue
.notify_recv_post_dequeue
.notify_send_init
.notify_send_pre_block
.notify_send_pre_enqueue
.notify_send_post_enqueue
etc.

So I think we'd better introduce a new address family: AF_HYPERV.


Please review the patchset.

Looking forward to your comments!

Dexuan Cui (7):
  Drivers: hv: vmbus: define the new offer type for Hyper-V socket
(hvsock)
  Drivers: hv: vmbus: define a new VMBus message type for hvsock
  Drivers: hv: vmbus: add APIs to send/recv hvsock packet and get the
r/w-ability
  Drivers: hv: vmbus: add APIs to register callbacks to process hvsock
connection
  Drivers: hv: vmbus: add a helper function to set a channel's pending
send size
  hvsock: introduce Hyper-V VM Sockets feature
  Drivers: hv: vmbus: disable local interrupt when hvsock's callback is
running

 MAINTAINERS   |2 +
 drivers/hv/Makefile   |4 +-
 drivers/hv/channel.c  |  146 
 drivers/hv/channel_mgmt.c |   13 +
 drivers/hv/connection.c   |   15 +-
 drivers/hv/hvsock_callbacks.c |   71 ++
 drivers/hv/hyperv_vmbus.h |4 +
 drivers/hv/ring_buffer.c  |   14 +
 include/linux/hyperv.h|   68 ++
 include/linux/socket.h|4 +-
 include/net/af_hvsock.h   |   44 ++
 include/uapi/linux/hyperv.h   |   16 +
 net/Kconfig   |1 +
 net/Makefile  |1 +
 net/hv_sock/Kconfig   |   10 +
 net/hv_sock/Makefile  |5 +
 net/hv_sock/af_hvsock.c   | 1463 +
 17 files changed, 1878 insertions(+), 3 deletions(-)
 create mode 100644 drivers/hv/hvsock_callbacks.c
 create mode 100644 include/net/af_hvsock.h
 create mode 100644 net/hv_sock/Kconfig
 create mode 100644 net/hv_sock/Makefile
 create mode 100644 net/hv_sock/af_hvsock.c

-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH trivial] staging: comedi: Grammar s/Enable support a/Enable support for a/

2015-07-06 Thread Geert Uytterhoeven
Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/staging/comedi/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 7dee73dfbf88ff09..57e71f9f14a2385b 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -2,7 +2,7 @@ config COMEDI
tristate Data acquisition support (comedi)
depends on m
---help---
- Enable support a wide range of data acquisition devices
+ Enable support for a wide range of data acquisition devices
  for Linux.
 
 if COMEDI
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: board: Kconfig: Let STAGING_BOARD depend on CLKDEV_LOOKUP

2015-07-06 Thread Paul Gortmaker
[Re: [PATCH] staging: board: Kconfig: Let STAGING_BOARD depend on 
CLKDEV_LOOKUP] On 06/07/2015 (Mon 08:48) Stephen Rothwell wrote:

 Hi all,
 
 On Sun, 5 Jul 2015 18:57:51 +0200 Geert Uytterhoeven ge...@linux-m68k.org 
 wrote:
 
  On Sat, Jul 4, 2015 at 11:35 PM, Chen Gang xili_gchen_5...@hotmail.com 
  wrote:
   It needs clk_add_alias() from clk drivers, which is implemented in
   drivers/clk/clkdev.c which depends on CLKDEV_LOOKUP.
  
   Normally, archs and clk driver its own will decide whether select
   CLKDEV_LOOKUP, and common drivers will decide whether depend on it.
  
   The related error (with allmodconfig under cris for next-20150702):
  
 drivers/built-in.o: In function `board_staging_register_clock':
 drivers/staging/board/board.c:131: undefined reference to 
   `clk_add_alias'
  
  
   Signed-off-by: Chen Gang gang.chen.5...@gmail.com
  
  Fix available for the last 15 days:
  
  https://lkml.org/lkml/2015/6/20/215
 
 I added Chen's patch to my fixes tree today (only because I couldn't
 easily find a copy of Paul's patch (sorry Paul) i.e. how does one get a
 full mail message from lkml.org?  Or Geert, maybe that is not the best
 place to link to.

I have had reasonable success pulling stuff out of lkml patchworks:

https://patchwork.kernel.org/patch/6651831/

BTW, Chen's patch is missing the OF_IRQ dependency Geert found in
his build coverage; I'd folded that into the v2 above, figuring
that is what he'd desired I do with it.

P.
--

 
 -- 
 Cheers,
 Stephen Rothwells...@canb.auug.org.au


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv3 08/16] staging: vme_user: provide DMA functionality

2015-07-06 Thread Dmitry Kalinkin
On Mon, Jul 6, 2015 at 4:22 PM, Martyn Welch martyn.we...@ge.com wrote:

 Sorry about the *really* late reply, loads of emails some how missed my
 periodic search of the mailing list.

 I'm happy with the addition of DMA, just not sure whether it's worth adding
 an extra device file just to handle DMA. Could the user space application
 not just use the control device?
That would require an additional ioctl field for DMA channel id in case we want
to support both DMA channels on tsi148.

It would make sense to save that device minor if Documentation/devices.txt
was good.
But it has only 4 slave and 4 master windows whereas we would want to
make some parameters for vme_user to configure this allocation numbers up
to 8 slaves and 8 masters.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv3 6/9] staging: vme_user: switch to returning -EFAULT on __copy_*_user errors

2015-07-06 Thread Martyn Welch



On 06/07/15 14:10, Dmitry Kalinkin wrote:

On Mon, Jul 6, 2015 at 3:51 PM, Martyn Welch martyn.we...@ge.com wrote:

On 26/06/15 21:39, Dmitry Kalinkin wrote:


Signed-off-by: Dmitry Kalinkin dmitry.kalin...@gmail.com
---
   drivers/staging/vme/devices/vme_user.c | 47
--
   1 file changed, 11 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/vme/devices/vme_user.c
b/drivers/staging/vme/devices/vme_user.c
index a2345db..ef876a4 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -123,7 +123,6 @@ struct vme_user_vma_priv {
   static ssize_t resource_to_user(int minor, char __user *buf, size_t
count,
 loff_t *ppos)
   {
-   ssize_t retval;
 ssize_t copied = 0;

 if (count  image[minor].size_buf)
@@ -135,13 +134,8 @@ static ssize_t resource_to_user(int minor, char
__user *buf, size_t count,
 if (copied  0)
 return (int)copied;

-   retval = __copy_to_user(buf, image[minor].kern_buf,
-   (unsigned long)copied);
-   if (retval != 0) {
-   copied = (copied - retval);
-   pr_info(User copy failed\n);
-   return -EINVAL;
-   }
+   if (__copy_to_user(buf, image[minor].kern_buf, (unsigned
long)copied))
+   return -EFAULT;

 return copied;



Does __copy_to_user() not return the number of bytes still to be copied? The
above seems to add the assumption that __copy_to_user()
can't return part way through a copy.

Yes it does. And this information is useless in userspace.
Returning -EFAULT would be more informative in this case.
I couldn't find an example of kernel code doing this any other way:
https://urldefense.proofpoint.com/v2/url?u=http-3A__lxr.free-2Delectrons.com_ident-3Fi-3D-5F-5Fcopy-5Fto-5Fuserd=AwIBaQc=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSIr=o_jX-O9t9rDa5QmNKEzuslLxr8l2x1M2rHid0HdzmY4m=YqOunx1QvC1jz8WjtHd_feWk5cdNWIVW0utSWesR8ags=BdRq0di7Bryi1LqA3LtL_Z9UeSHdpiYwghMElfWbR1Ae=


Fair enough. If that's the approach taken elsewhere, then I'm happy for 
this to become consistent.





   }
@@ -149,21 +143,16 @@ static ssize_t resource_to_user(int minor, char
__user *buf, size_t count,
   static ssize_t resource_from_user(unsigned int minor, const char __user
*buf,
   size_t count, loff_t *ppos)
   {
-   ssize_t retval;
 ssize_t copied = 0;

 if (count  image[minor].size_buf)
 count = image[minor].size_buf;

-   retval = __copy_from_user(image[minor].kern_buf, buf,
- (unsigned long)count);
-   if (retval != 0)
-   copied = (copied - retval);
-   else
-   copied = count;
+   if (__copy_from_user(image[minor].kern_buf, buf, (unsigned
long)count))
+   return -EFAULT;



Same here.


 copied = vme_master_write(image[minor].resource,
image[minor].kern_buf,
- copied, *ppos);
+ count, *ppos);

 return copied;
   }
@@ -172,38 +161,24 @@ static ssize_t buffer_to_user(unsigned int minor,
char __user *buf,
   size_t count, loff_t *ppos)
   {
 void *image_ptr;
-   ssize_t retval;

 image_ptr = image[minor].kern_buf + *ppos;
+   if (__copy_to_user(buf, image_ptr, (unsigned long)count))
+   return -EFAULT;



Ditto.


-   retval = __copy_to_user(buf, image_ptr, (unsigned long)count);
-   if (retval != 0) {
-   retval = (count - retval);
-   pr_warn(Partial copy to userspace\n);
-   } else
-   retval = count;
-
-   /* Return number of bytes successfully read */
-   return retval;
+   return count;
   }

   static ssize_t buffer_from_user(unsigned int minor, const char __user
*buf,
 size_t count, loff_t *ppos)
   {
 void *image_ptr;
-   size_t retval;

 image_ptr = image[minor].kern_buf + *ppos;
+   if (__copy_from_user(image_ptr, buf, (unsigned long)count))
+   return -EFAULT;



And here.


-   retval = __copy_from_user(image_ptr, buf, (unsigned long)count);
-   if (retval != 0) {
-   retval = (count - retval);
-   pr_warn(Partial copy to userspace\n);
-   } else
-   retval = count;
-
-   /* Return number of bytes successfully read */
-   return retval;
+   return count;
   }

   static ssize_t vme_user_read(struct file *file, char __user *buf, size_t
count,



--
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189


--
Martyn Welch (Lead Software Engineer)  | Registered in 

Re: [PATCH] staging: board: Kconfig: Let STAGING_BOARD depend on CLKDEV_LOOKUP

2015-07-06 Thread Geert Uytterhoeven
Hi Paul,

On Mon, Jul 6, 2015 at 3:42 PM, Paul Gortmaker
paul.gortma...@windriver.com wrote:
 BTW, Chen's patch is missing the OF_IRQ dependency Geert found in
 his build coverage; I'd folded that into the v2 above, figuring
 that is what he'd desired I do with it.

Which I'm very grateful for. Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: dgnc: Replace macro with flow control statement by a function

2015-07-06 Thread Dan Carpenter
Since this is turning into a long thread, the correct thing is to copy
3eb141511bd5 ('staging: dgap: get rid of nasty DGAP_VERIFY_BOARD macro').

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/20] staging/lustre: remove alloc_fail_rate sysctl

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

It was used to control allocation failure rate, but there is
in-kernel way of doing that that's more versatile too.

This is going to remove just the sysctl, the underlying variable
will be removed once all OBD_ALLOC* macros removal patchseries land.

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 .../lustre/lustre/obdclass/linux/linux-sysctl.c| 38 --
 1 file changed, 38 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
index 54f0a81..b9a7d2f 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
@@ -203,37 +203,6 @@ static int proc_max_dirty_pages_in_mb(struct ctl_table 
*table, int write,
return rc;
 }
 
-static int proc_alloc_fail_rate(struct ctl_table *table, int write,
-void __user *buffer, size_t *lenp, loff_t *ppos)
-{
-   int rc= 0;
-
-   if (!table-data || !table-maxlen || !*lenp || (*ppos  !write)) {
-   *lenp = 0;
-   return 0;
-   }
-   if (write) {
-   rc = lprocfs_write_frac_helper(buffer, *lenp,
-  (unsigned int *)table-data,
-  OBD_ALLOC_FAIL_MULT);
-   } else {
-   char buf[21];
-   int  len;
-
-   len = lprocfs_read_frac_helper(buf, 21,
-  *(unsigned int *)table-data,
-  OBD_ALLOC_FAIL_MULT);
-   if (len  *lenp)
-   len = *lenp;
-   buf[len] = '\0';
-   if (copy_to_user(buffer, buf, len))
-   return -EFAULT;
-   *lenp = len;
-   }
-   *ppos += *lenp;
-   return rc;
-}
-
 static struct ctl_table obd_table[] = {
{
.procname = timeout,
@@ -299,13 +268,6 @@ static struct ctl_table obd_table[] = {
.proc_handler = proc_set_timeout
},
{
-   .procname = alloc_fail_rate,
-   .data = obd_alloc_fail_rate,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_alloc_fail_rate
-   },
-   {
.procname = max_dirty_mb,
.data = obd_max_dirty_pages,
.maxlen   = sizeof(int),
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/20] Lustre: final procfs bits removal.

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

This patch series removes the sysctls (also under /proc) from Lustre.
/proc/sys/lnet is moved to debugfs and
/proc/sys/lustre content is moved to /sys/fs/lustre

Additionally we now have the tools that understand the new layout,
and so first few patches fix problems introduced by earlier
code moving to sysfs.

With this accepted there would be no more proc files exported by Lustre.

Please consider.

Dmitry Eremin (4):
  staging/lustre/libcfs: Remove redundant enums and sysctl moduleparams
  staging/lustre/libcfs: Remove unneeded lnet watchdog_ratelimit sysctl
  staging/lustre/libcfs: get rid of
debugfs/lnet/console_{min,max}_delay_centisecs
  staging/lustre/libcfs: remove unused portal_enter_debugger variable

Oleg Drokin (16):
  staging/lustre/lov: Move target sysfs symlink removal to object
freeing
  staging/lustre: make ldebugfs_remove recursive
  staging/lustre/ldlm: In ldlm_pools_fini make sure there was init
first.
  staging/lustre/obdclass: fix class_procfs_init error return value
  staging/lustre: remove alloc_fail_rate sysctl
  staging/lustre: Remove now obsolete memory tracking sysctls
  staging/lustre: Remove unneeded ldlm_timeout control
  staging/lustre/obdclass: move sysctl timeout to sysfs
  staging/lustre/obdclass: move max_dirty_mb from sysctl to sysfs
  staging/lustre/obdclass: move debug controls to sysfs
  staging/lustre/obdclass: Move AT controls from sysctl to sysfs
  staging/lustre: Get rid of remaining /proc/sys/lustre plumbing
  staging/lustre/libcfs: move /proc/sys/lnet to debugfs
  staging/lustre/libcfs: Remove redundant lnet debugfs variables
  staging/lustre/libcfs: get rid of debugfs/lnet/console_backoff
  staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb

 .../lustre/include/linux/libcfs/libcfs_debug.h |   1 -
 .../lustre/include/linux/libcfs/libcfs_private.h   |  28 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c|  12 -
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|   5 -
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |   3 +-
 drivers/staging/lustre/lnet/lnet/router_proc.c |  11 -
 drivers/staging/lustre/lustre/include/obd_class.h  |   3 +-
 .../staging/lustre/lustre/include/obd_support.h|  16 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c|   9 -
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c |   6 +-
 drivers/staging/lustre/lustre/libcfs/debug.c   | 146 +++-
 drivers/staging/lustre/lustre/libcfs/module.c  | 334 +-
 drivers/staging/lustre/lustre/libcfs/tracefile.c   |  12 -
 drivers/staging/lustre/lustre/libcfs/tracefile.h   |   1 -
 drivers/staging/lustre/lustre/lov/lov_obd.c|   7 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  17 +-
 .../lustre/lustre/obdclass/linux/linux-module.c|   2 +-
 .../lustre/lustre/obdclass/linux/linux-sysctl.c| 374 +
 .../lustre/lustre/obdclass/lprocfs_status.c|   2 +-
 .../staging/lustre/lustre/obdclass/obd_config.c|   7 +-
 drivers/staging/lustre/sysfs-fs-lustre | 103 ++
 21 files changed, 424 insertions(+), 675 deletions(-)

-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/20] staging/lustre/obdclass: fix class_procfs_init error return value

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

Dan Carpenter noticed that procfs conversion patches introduced
a bug where should kobject_create_and_add, an error is not returned
from class_procfs_init.

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index 84f75dc..b618c0b 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -423,7 +423,7 @@ static struct attribute_group lustre_attr_group = {
 
 int class_procfs_init(void)
 {
-   int rc = 0;
+   int rc = -ENOMEM;
struct dentry *file;
 
lustre_kobj = kobject_create_and_add(lustre, fs_kobj);
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/20] staging/lustre/lov: Move target sysfs symlink removal to object freeing

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

This helps to avoid use after free on unmount.

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/lov/lov_obd.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c 
b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 96c55ac..134b663 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -107,6 +107,10 @@ static void lov_putref(struct obd_device *obd)
/* Disconnect */
__lov_del_obd(obd, tgt);
}
+
+   if (lov-lov_tgts_kobj)
+   kobject_put(lov-lov_tgts_kobj);
+
} else {
mutex_unlock(lov-lov_lock);
}
@@ -322,9 +326,6 @@ static int lov_disconnect(struct obd_export *exp)
}
}
 
-   if (lov-lov_tgts_kobj)
-   kobject_put(lov-lov_tgts_kobj);
-
obd_putref(obd);
 
 out:
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/20] staging/lustre/obdclass: move sysctl timeout to sysfs

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

This is the first step of moving lustre sysctls from
/proc/sys/lustre to /sys/fs/lustre

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/include/obd_class.h  |  4 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  6 +-
 .../lustre/lustre/obdclass/linux/linux-sysctl.c| 66 +-
 drivers/staging/lustre/sysfs-fs-lustre | 12 
 4 files changed, 71 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_class.h 
b/drivers/staging/lustre/lustre/include/obd_class.h
index 36ed781..7dce4ee 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -1869,8 +1869,8 @@ extern int (*ptlrpc_put_connection_superhack)(struct 
ptlrpc_connection *c);
 /* obd_mount.c */
 
 /* sysctl.c */
-extern void obd_sysctl_init (void);
-extern void obd_sysctl_clean (void);
+extern int obd_sysctl_init(void);
+extern void obd_sysctl_clean(void);
 
 /* uuid.c  */
 typedef __u8 class_uuid_t[16];
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c 
b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index df0063b..1f949dc 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -567,12 +567,14 @@ static int __init init_obdclass(void)
if (err)
return err;
 
-   obd_sysctl_init();
-
err = class_procfs_init();
if (err)
return err;
 
+   err = obd_sysctl_init();
+   if (err)
+   return err;
+
err = lu_global_init();
if (err)
return err;
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
index eda5f30..3c8087b 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
@@ -54,16 +54,53 @@
 static struct ctl_table_header *obd_table_header;
 #endif
 
-#ifdef CONFIG_SYSCTL
-static int proc_set_timeout(struct ctl_table *table, int write,
-   void __user *buffer, size_t *lenp, loff_t *ppos)
+struct static_lustre_uintvalue_attr {
+   struct {
+   struct attribute attr;
+   ssize_t (*show)(struct kobject *kobj, struct attribute *attr,
+   char *buf);
+   ssize_t (*store)(struct kobject *kobj, struct attribute *attr,
+const char *buf, size_t len);
+   } u;
+   int *value;
+};
+
+static ssize_t static_uintvalue_show(struct kobject *kobj,
+   struct attribute *attr,
+   char *buf)
 {
+   struct static_lustre_uintvalue_attr *lattr = (void *)attr;
+
+   return sprintf(buf, %d\n, *lattr-value);
+}
+
+static ssize_t static_uintvalue_store(struct kobject *kobj,
+struct attribute *attr,
+const char *buffer, size_t count)
+{
+   struct static_lustre_uintvalue_attr *lattr  = (void *)attr;
int rc;
+   unsigned int val;
 
-   rc = proc_dointvec(table, write, buffer, lenp, ppos);
-   return rc;
+   rc = kstrtouint(buffer, 10, val);
+   if (rc)
+   return rc;
+
+   *lattr-value = val;
+
+   return count;
 }
 
+#define LUSTRE_STATIC_UINT_ATTR(name, value) \
+static struct static_lustre_uintvalue_attr lustre_sattr_##name =   \
+   {__ATTR(name, 0644, \
+   static_uintvalue_show,  \
+   static_uintvalue_store),\
+ value }
+
+LUSTRE_STATIC_UINT_ATTR(timeout, obd_timeout);
+
+#ifdef CONFIG_SYSCTL
 static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write,
   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -107,13 +144,6 @@ static int proc_max_dirty_pages_in_mb(struct ctl_table 
*table, int write,
 
 static struct ctl_table obd_table[] = {
{
-   .procname = timeout,
-   .data = obd_timeout,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_set_timeout
-   },
-   {
.procname = debug_peer_on_timeout,
.data = obd_debug_peer_on_timeout,
.maxlen   = sizeof(int),
@@ -191,12 +221,22 @@ static struct ctl_table parent_table[] = {
 };
 #endif
 
-void obd_sysctl_init(void)
+static struct attribute *lustre_attrs[] = {
+   lustre_sattr_timeout.u.attr,
+   NULL,
+};
+
+static struct attribute_group lustre_attr_group = {
+   .attrs = lustre_attrs,
+};
+
+int obd_sysctl_init(void)
 {
 #ifdef CONFIG_SYSCTL
if 

[PATCH 09/20] staging/lustre/obdclass: move max_dirty_mb from sysctl to sysfs

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

max_dirty_mb is now a parameter in /sys/fs/lustre/

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 .../lustre/lustre/obdclass/linux/linux-sysctl.c| 74 +-
 drivers/staging/lustre/sysfs-fs-lustre | 12 
 2 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
index 3c8087b..bb55a07 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
@@ -100,48 +100,42 @@ static struct static_lustre_uintvalue_attr 
lustre_sattr_##name =  \
 
 LUSTRE_STATIC_UINT_ATTR(timeout, obd_timeout);
 
-#ifdef CONFIG_SYSCTL
-static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write,
-  void __user *buffer, size_t *lenp, loff_t *ppos)
+static ssize_t max_dirty_mb_show(struct kobject *kobj, struct attribute *attr,
+char *buf)
 {
-   int rc = 0;
+   return sprintf(buf, %ul\n,
+   obd_max_dirty_pages / (1  (20 - PAGE_CACHE_SHIFT)));
+}
+
+static ssize_t max_dirty_mb_store(struct kobject *kobj, struct attribute *attr,
+ const char *buffer, size_t count)
+{
+   int rc;
+   unsigned long val;
+
+   rc = kstrtoul(buffer, 10, val);
+   if (rc)
+   return rc;
+
+   val *= 1  (20 - PAGE_CACHE_SHIFT); /* convert to pages */
 
-   if (!table-data || !table-maxlen || !*lenp || (*ppos  !write)) {
-   *lenp = 0;
-   return 0;
+   if (val  ((totalram_pages / 10) * 9)) {
+   /* Somebody wants to assign too much memory to dirty pages */
+   return -EINVAL;
}
-   if (write) {
-   rc = lprocfs_write_frac_helper(buffer, *lenp,
-  (unsigned int *)table-data,
-  1  (20 - PAGE_CACHE_SHIFT));
-   /* Don't allow them to let dirty pages exceed 90% of system
-* memory and set a hard minimum of 4MB. */
-   if (obd_max_dirty_pages  ((totalram_pages / 10) * 9)) {
-   CERROR(Refusing to set max dirty pages to %u, which is 
more than 90%% of available RAM; setting to %lu\n,
-  obd_max_dirty_pages,
-  ((totalram_pages / 10) * 9));
-   obd_max_dirty_pages = (totalram_pages / 10) * 9;
-   } else if (obd_max_dirty_pages  4  (20 - PAGE_CACHE_SHIFT)) {
-   obd_max_dirty_pages = 4  (20 - PAGE_CACHE_SHIFT);
-   }
-   } else {
-   char buf[21];
-   int len;
-
-   len = lprocfs_read_frac_helper(buf, sizeof(buf),
-  *(unsigned int *)table-data,
-  1  (20 - PAGE_CACHE_SHIFT));
-   if (len  *lenp)
-   len = *lenp;
-   buf[len] = '\0';
-   if (copy_to_user(buffer, buf, len))
-   return -EFAULT;
-   *lenp = len;
+
+   if (val  4  (20 - PAGE_CACHE_SHIFT)) {
+   /* Less than 4 Mb for dirty cache is also bad */
+   return -EINVAL;
}
-   *ppos += *lenp;
-   return rc;
+
+   obd_max_dirty_pages = val;
+
+   return count;
 }
+LUSTRE_RW_ATTR(max_dirty_mb);
 
+#ifdef CONFIG_SYSCTL
 static struct ctl_table obd_table[] = {
{
.procname = debug_peer_on_timeout,
@@ -165,13 +159,6 @@ static struct ctl_table obd_table[] = {
.proc_handler = proc_dointvec
},
{
-   .procname = max_dirty_mb,
-   .data = obd_max_dirty_pages,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_max_dirty_pages_in_mb
-   },
-   {
.procname = at_min,
.data = at_min,
.maxlen   = sizeof(int),
@@ -223,6 +210,7 @@ static struct ctl_table parent_table[] = {
 
 static struct attribute *lustre_attrs[] = {
lustre_sattr_timeout.u.attr,
+   lustre_attr_max_dirty_mb.attr,
NULL,
 };
 
diff --git a/drivers/staging/lustre/sysfs-fs-lustre 
b/drivers/staging/lustre/sysfs-fs-lustre
index 6dbad26..38d1adc 100644
--- a/drivers/staging/lustre/sysfs-fs-lustre
+++ b/drivers/staging/lustre/sysfs-fs-lustre
@@ -52,6 +52,18 @@ Description:
AT (adaptive timeouts).
Unit: seconds, default: 100
 
+What:  /sys/fs/lustre/max_dirty_mb
+Date:  June 2015
+Contact:   Oleg Drokin oleg.dro...@intel.com
+Description:
+   Controls total number of dirty cache (in megabytes) allowed
+   across all mounted 

[PATCH 06/20] staging/lustre: Remove now obsolete memory tracking sysctls

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

In the past when Lustre did its own allocation amounts tracking
the results were shown in sysctl as current and overall max
number of bytes and pages allocated. Now that we don't
track these, remove the sysctls.

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 .../lustre/lustre/obdclass/linux/linux-sysctl.c| 124 -
 1 file changed, 124 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
index b9a7d2f..e800bd6 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
@@ -66,102 +66,6 @@ static int proc_set_timeout(struct ctl_table *table, int 
write,
return rc;
 }
 
-static int proc_memory_alloc(struct ctl_table *table, int write,
-   void __user *buffer, size_t *lenp, loff_t *ppos)
-{
-   char buf[22];
-   int len;
-
-   if (!*lenp || (*ppos  !write)) {
-   *lenp = 0;
-   return 0;
-   }
-   if (write)
-   return -EINVAL;
-
-   len = snprintf(buf, sizeof(buf), %llu\n, obd_memory_sum());
-   if (len  *lenp)
-   len = *lenp;
-   buf[len] = '\0';
-   if (copy_to_user(buffer, buf, len))
-   return -EFAULT;
-   *lenp = len;
-   *ppos += *lenp;
-   return 0;
-}
-
-static int proc_pages_alloc(struct ctl_table *table, int write,
-   void __user *buffer, size_t *lenp, loff_t *ppos)
-{
-   char buf[22];
-   int len;
-
-   if (!*lenp || (*ppos  !write)) {
-   *lenp = 0;
-   return 0;
-   }
-   if (write)
-   return -EINVAL;
-
-   len = snprintf(buf, sizeof(buf), %llu\n, obd_pages_sum());
-   if (len  *lenp)
-   len = *lenp;
-   buf[len] = '\0';
-   if (copy_to_user(buffer, buf, len))
-   return -EFAULT;
-   *lenp = len;
-   *ppos += *lenp;
-   return 0;
-}
-
-static int proc_mem_max(struct ctl_table *table, int write, void __user 
*buffer,
-size_t *lenp, loff_t *ppos)
-{
-   char buf[22];
-   int len;
-
-   if (!*lenp || (*ppos  !write)) {
-   *lenp = 0;
-   return 0;
-   }
-   if (write)
-   return -EINVAL;
-
-   len = snprintf(buf, sizeof(buf), %llu\n, obd_memory_max());
-   if (len  *lenp)
-   len = *lenp;
-   buf[len] = '\0';
-   if (copy_to_user(buffer, buf, len))
-   return -EFAULT;
-   *lenp = len;
-   *ppos += *lenp;
-   return 0;
-}
-
-static int proc_pages_max(struct ctl_table *table, int write,
-   void __user *buffer, size_t *lenp, loff_t *ppos)
-{
-   char buf[22];
-   int len;
-
-   if (!*lenp || (*ppos  !write)) {
-   *lenp = 0;
-   return 0;
-   }
-   if (write)
-   return -EINVAL;
-
-   len = snprintf(buf, sizeof(buf), %llu\n, obd_pages_max());
-   if (len  *lenp)
-   len = *lenp;
-   buf[len] = '\0';
-   if (copy_to_user(buffer, buf, len))
-   return -EFAULT;
-   *lenp = len;
-   *ppos += *lenp;
-   return 0;
-}
-
 static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write,
   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -233,34 +137,6 @@ static struct ctl_table obd_table[] = {
.proc_handler = proc_dointvec
},
{
-   .procname = memused,
-   .data = NULL,
-   .maxlen   = 0,
-   .mode = 0444,
-   .proc_handler = proc_memory_alloc
-   },
-   {
-   .procname = pagesused,
-   .data = NULL,
-   .maxlen   = 0,
-   .mode = 0444,
-   .proc_handler = proc_pages_alloc
-   },
-   {
-   .procname = memused_max,
-   .data = NULL,
-   .maxlen   = 0,
-   .mode = 0444,
-   .proc_handler = proc_mem_max
-   },
-   {
-   .procname = pagesused_max,
-   .data = NULL,
-   .maxlen   = 0,
-   .mode = 0444,
-   .proc_handler = proc_pages_max
-   },
-   {
.procname = ldlm_timeout,
.data = ldlm_timeout,
.maxlen   = sizeof(int),
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/20] staging/lustre/obdclass: Move AT controls from sysctl to sysfs

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

Adaptive Timeouts controls are being moved from /proc/sys/lustre
to /sys/fs/lustre

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 .../lustre/lustre/obdclass/linux/linux-sysctl.c| 45 --
 drivers/staging/lustre/sysfs-fs-lustre | 53 ++
 2 files changed, 63 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
index 6af1cb2..82b3c39 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
@@ -138,44 +138,14 @@ LUSTRE_RW_ATTR(max_dirty_mb);
 LUSTRE_STATIC_UINT_ATTR(debug_peer_on_timeout, obd_debug_peer_on_timeout);
 LUSTRE_STATIC_UINT_ATTR(dump_on_timeout, obd_dump_on_timeout);
 LUSTRE_STATIC_UINT_ATTR(dump_on_eviction, obd_dump_on_eviction);
+LUSTRE_STATIC_UINT_ATTR(at_min, at_min);
+LUSTRE_STATIC_UINT_ATTR(at_max, at_max);
+LUSTRE_STATIC_UINT_ATTR(at_extra, at_extra);
+LUSTRE_STATIC_UINT_ATTR(at_early_margin, at_early_margin);
+LUSTRE_STATIC_UINT_ATTR(at_history, at_history);
 
 #ifdef CONFIG_SYSCTL
 static struct ctl_table obd_table[] = {
-   {
-   .procname = at_min,
-   .data = at_min,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec,
-   },
-   {
-   .procname = at_max,
-   .data = at_max,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec,
-   },
-   {
-   .procname = at_extra,
-   .data = at_extra,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec,
-   },
-   {
-   .procname = at_early_margin,
-   .data = at_early_margin,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec,
-   },
-   {
-   .procname = at_history,
-   .data = at_history,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec,
-   },
{}
 };
 
@@ -197,6 +167,11 @@ static struct attribute *lustre_attrs[] = {
lustre_sattr_debug_peer_on_timeout.u.attr,
lustre_sattr_dump_on_timeout.u.attr,
lustre_sattr_dump_on_eviction.u.attr,
+   lustre_sattr_at_min.u.attr,
+   lustre_sattr_at_max.u.attr,
+   lustre_sattr_at_extra.u.attr,
+   lustre_sattr_at_early_margin.u.attr,
+   lustre_sattr_at_history.u.attr,
NULL,
 };
 
diff --git a/drivers/staging/lustre/sysfs-fs-lustre 
b/drivers/staging/lustre/sysfs-fs-lustre
index ea9982b..873e2cf 100644
--- a/drivers/staging/lustre/sysfs-fs-lustre
+++ b/drivers/staging/lustre/sysfs-fs-lustre
@@ -90,6 +90,59 @@ Description:
This is useful if yout debug buffer typically rolls over
 by the time you notice the eviction event.
 
+What:  /sys/fs/lustre/at_min
+Date:  July 2015
+Contact:   Oleg Drokin oleg.dro...@intel.com
+Description:
+   Controls minimum adaptive timeout in seconds. If you encounter
+   a case where clients timeout due to server-reported processing
+   time being too short, you might consider increasing this value.
+   One common case of this if the underlying network has
+   unpredictable long delays.
+   Default: 0
+
+What:  /sys/fs/lustre/at_max
+Date:  July 2015
+Contact:   Oleg Drokin oleg.dro...@intel.com
+Description:
+   Controls maximum adaptive timeout in seconds. If at_max timeout
+   is reached for an RPC, the RPC will time out.
+   Some genuinuely slow network hardware might warrant increasing
+   this value.
+   Setting this value to 0 disables Adaptive Timeouts
+   functionality and old-style obd_timeout value is then used.
+   Default: 600
+
+What:  /sys/fs/lustre/at_extra
+Date:  July 2015
+Contact:   Oleg Drokin oleg.dro...@intel.com
+Description:
+   Controls how much extra time to request for unfinished requests
+   in processing in seconds. Normally a server-side parameter, it
+   is also used on the client for responses to various LDLM ASTs
+   that are handled with a special server thread on the client.
+   This is a way for the servers to ask the clients not to time
+   out the request that reached current servicing time estimate
+   yet and give it some more time.
+   Default: 30
+
+What:  /sys/fs/lustre/at_early_margin
+Date:  July 2015
+Contact:   

[PATCH 13/20] staging/lustre/libcfs: move /proc/sys/lnet to debugfs

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

Parameters in lnet sysctl are of debug quantity, so let's move them
to debugfs instead.

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/libcfs/module.c | 86 +--
 1 file changed, 56 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index e60b2e9..bffde77 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -50,6 +50,7 @@
 #include linux/list.h
 
 #include linux/sysctl.h
+#include linux/debugfs.h
 
 # define DEBUG_SUBSYSTEM S_LNET
 
@@ -69,10 +70,10 @@ extern struct miscdevice libcfs_dev;
 extern struct cfs_wi_sched *cfs_sched_rehash;
 extern void libcfs_init_nidstrings(void);
 
-static int insert_proc(void);
-static void remove_proc(void);
+static void insert_debugfs(void);
+static void remove_debugfs(void);
 
-static struct ctl_table_header *lnet_table_header;
+static struct dentry *lnet_debugfs_root;
 extern char lnet_upcall[1024];
 /**
  * The path of debug log dump upcall script.
@@ -428,17 +429,10 @@ static int init_libcfs_module(void)
goto cleanup_wi;
}
 
-
-   rc = insert_proc();
-   if (rc) {
-   CERROR(insert_proc: error %d\n, rc);
-   goto cleanup_crypto;
-   }
+   insert_debugfs();
 
CDEBUG (D_OTHER, portals setup OK\n);
return 0;
- cleanup_crypto:
-   cfs_crypto_unregister();
  cleanup_wi:
cfs_wi_shutdown();
  cleanup_deregister:
@@ -454,7 +448,7 @@ static void exit_libcfs_module(void)
 {
int rc;
 
-   remove_proc();
+   remove_debugfs();
 
CDEBUG(D_MALLOC, before Portals cleanup: kmem %d\n,
   atomic_read(libcfs_kmemory));
@@ -935,31 +929,63 @@ static struct ctl_table lnet_table[] = {
}
 };
 
-static struct ctl_table top_table[] = {
-   {
-   .procname = lnet,
-   .mode = 0555,
-   .data = NULL,
-   .maxlen   = 0,
-   .child= lnet_table,
-   },
-   {
-   }
+static ssize_t lnet_debugfs_read(struct file *filp, char __user *buf,
+size_t count, loff_t *ppos)
+{
+   struct ctl_table *table = filp-private_data;
+   int error;
+
+   error = table-proc_handler(table, 0, (void __user *)buf, count, ppos);
+   if (!error)
+   error = count;
+
+   return error;
+}
+
+static ssize_t lnet_debugfs_write(struct file *filp, const char __user *buf,
+ size_t count, loff_t *ppos)
+{
+   struct ctl_table *table = filp-private_data;
+   int error;
+
+   error = table-proc_handler(table, 1, (void __user *)buf, count, ppos);
+   if (!error)
+   error = count;
+
+   return error;
+}
+
+static const struct file_operations lnet_debugfs_file_operations = {
+   .open   = simple_open,
+   .read   = lnet_debugfs_read,
+   .write  = lnet_debugfs_write,
+   .llseek = default_llseek,
 };
 
-static int insert_proc(void)
+static void insert_debugfs(void)
 {
-   if (lnet_table_header == NULL)
-   lnet_table_header = register_sysctl_table(top_table);
-   return 0;
+   struct ctl_table *table;
+   struct dentry *entry;
+
+   if (lnet_debugfs_root == NULL)
+   lnet_debugfs_root = debugfs_create_dir(lnet, NULL);
+
+   /* Even if we cannot create, just ignore it altogether) */
+   if (IS_ERR_OR_NULL(lnet_debugfs_root))
+   return;
+
+   for (table = lnet_table; table-procname; table++)
+   entry = debugfs_create_file(table-procname, table-mode,
+   lnet_debugfs_root, table,
+   lnet_debugfs_file_operations);
 }
 
-static void remove_proc(void)
+static void remove_debugfs(void)
 {
-   if (lnet_table_header != NULL)
-   unregister_sysctl_table(lnet_table_header);
+   if (lnet_debugfs_root != NULL)
+   debugfs_remove_recursive(lnet_debugfs_root);
 
-   lnet_table_header = NULL;
+   lnet_debugfs_root = NULL;
 }
 
 MODULE_VERSION(1.0.0);
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/20] staging/lustre/obdclass: move debug controls to sysfs

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

debug_peer_on_timeout, dump_on_timeout and dump_on_eviction
controls from /proc/sys/lustre to /sys/fs/lustre

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 .../lustre/lustre/obdclass/linux/linux-sysctl.c| 28 ++
 drivers/staging/lustre/sysfs-fs-lustre | 26 
 2 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
index bb55a07..6af1cb2 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
@@ -135,30 +135,13 @@ static ssize_t max_dirty_mb_store(struct kobject *kobj, 
struct attribute *attr,
 }
 LUSTRE_RW_ATTR(max_dirty_mb);
 
+LUSTRE_STATIC_UINT_ATTR(debug_peer_on_timeout, obd_debug_peer_on_timeout);
+LUSTRE_STATIC_UINT_ATTR(dump_on_timeout, obd_dump_on_timeout);
+LUSTRE_STATIC_UINT_ATTR(dump_on_eviction, obd_dump_on_eviction);
+
 #ifdef CONFIG_SYSCTL
 static struct ctl_table obd_table[] = {
{
-   .procname = debug_peer_on_timeout,
-   .data = obd_debug_peer_on_timeout,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec
-   },
-   {
-   .procname = dump_on_timeout,
-   .data = obd_dump_on_timeout,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec
-   },
-   {
-   .procname = dump_on_eviction,
-   .data = obd_dump_on_eviction,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec
-   },
-   {
.procname = at_min,
.data = at_min,
.maxlen   = sizeof(int),
@@ -211,6 +194,9 @@ static struct ctl_table parent_table[] = {
 static struct attribute *lustre_attrs[] = {
lustre_sattr_timeout.u.attr,
lustre_attr_max_dirty_mb.attr,
+   lustre_sattr_debug_peer_on_timeout.u.attr,
+   lustre_sattr_dump_on_timeout.u.attr,
+   lustre_sattr_dump_on_eviction.u.attr,
NULL,
 };
 
diff --git a/drivers/staging/lustre/sysfs-fs-lustre 
b/drivers/staging/lustre/sysfs-fs-lustre
index 38d1adc..ea9982b 100644
--- a/drivers/staging/lustre/sysfs-fs-lustre
+++ b/drivers/staging/lustre/sysfs-fs-lustre
@@ -64,6 +64,32 @@ Description:
find some pages to free/writeout.
Default 1/2 RAM. Min value 4, max value 9/10 of RAM.
 
+What:  /sys/fs/lustre/debug_peer_on_timeout
+Date:  June 2015
+Contact:   Oleg Drokin oleg.dro...@intel.com
+Description:
+   Control if lnet debug information should be printed when
+   an RPC timeout occurs.
+   0 disabled (default)
+   1 enabled
+
+What:  /sys/fs/lustre/dump_on_timeout
+Date:  June 2015
+Contact:   Oleg Drokin oleg.dro...@intel.com
+Description:
+   Controls if Lustre debug log should be dumped when an RPC
+   timeout occurs. This is useful if yout debug buffer typically
+   rolls over by the time you notice RPC timeouts.
+
+What:  /sys/fs/lustre/dump_on_eviction
+Date:  June 2015
+Contact:   Oleg Drokin oleg.dro...@intel.com
+Description:
+   Controls if Lustre debug log should be dumped when an this
+   client is evicted from one of the servers.
+   This is useful if yout debug buffer typically rolls over
+by the time you notice the eviction event.
+
 What:  /sys/fs/lustre/llite/fsname-uuid/blocksize
 Date:  May 2015
 Contact:   Oleg Drokin oleg.dro...@intel.com
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/20] staging/lustre/ldlm: In ldlm_pools_fini make sure there was init first.

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

It turns out if you call ldlm_pools_fini without completing the
ldlm_pools_init, then attempt to unregister not yet registered
shrinkers makes the kernel very unhappy.
So make sure we have them registered first.

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
index 1605b9c..251efb7 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
@@ -1486,8 +1486,10 @@ EXPORT_SYMBOL(ldlm_pools_init);
 
 void ldlm_pools_fini(void)
 {
-   unregister_shrinker(ldlm_pools_srv_shrinker);
-   unregister_shrinker(ldlm_pools_cli_shrinker);
+   if (ldlm_pools_thread) {
+   unregister_shrinker(ldlm_pools_srv_shrinker);
+   unregister_shrinker(ldlm_pools_cli_shrinker);
+   }
ldlm_pools_thread_stop();
 }
 EXPORT_SYMBOL(ldlm_pools_fini);
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 17/20] staging/lustre/libcfs: Remove unneeded lnet watchdog_ratelimit sysctl

2015-07-06 Thread green
From: Dmitry Eremin dmitry.ere...@intel.com

It is no longer used anywhere.

Signed-off-by: Dmitry Eremin dmitry.ere...@intel.com
---
 drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h |  1 -
 drivers/staging/lustre/lustre/libcfs/debug.c   |  3 ---
 drivers/staging/lustre/lustre/libcfs/module.c  | 12 
 3 files changed, 16 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
index 8251ac9..a3aa644 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h
@@ -50,7 +50,6 @@ extern unsigned int libcfs_stack;
 extern unsigned int libcfs_debug;
 extern unsigned int libcfs_printk;
 extern unsigned int libcfs_console_ratelimit;
-extern unsigned int libcfs_watchdog_ratelimit;
 extern unsigned int libcfs_console_max_delay;
 extern unsigned int libcfs_console_min_delay;
 extern unsigned int libcfs_console_backoff;
diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index 9807552..5ae7b65 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -128,9 +128,6 @@ EXPORT_SYMBOL(portal_enter_debugger);
 unsigned int libcfs_catastrophe;
 EXPORT_SYMBOL(libcfs_catastrophe);
 
-unsigned int libcfs_watchdog_ratelimit = 300;
-EXPORT_SYMBOL(libcfs_watchdog_ratelimit);
-
 unsigned int libcfs_panic_on_lbug = 1;
 module_param(libcfs_panic_on_lbug, uint, 0644);
 MODULE_PARM_DESC(libcfs_panic_on_lbug, Lustre kernel panic on LBUG);
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index 95fa846..8e228ae 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -511,9 +511,6 @@ static int proc_dobitmasks(struct ctl_table *table, int 
write,
 __proc_dobitmasks);
 }
 
-static int min_watchdog_ratelimit;   /* disable ratelimiting */
-static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */
-
 static int __proc_dump_kernel(void *data, int write,
  loff_t pos, void __user *buffer, int nob)
 {
@@ -798,15 +795,6 @@ static struct ctl_table lnet_table[] = {
.proc_handler = proc_debug_mb,
},
{
-   .procname = watchdog_ratelimit,
-   .data = libcfs_watchdog_ratelimit,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec_minmax,
-   .extra1   = min_watchdog_ratelimit,
-   .extra2   = max_watchdog_ratelimit,
-   },
-   {
.procname = force_lbug,
.data = NULL,
.maxlen   = 0,
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Alternate rtl8192cu driver.

2015-07-06 Thread P. Varet

On 07/06/2015 06:47 PM, Greg KH wrote:


How about making it a patch for drivers/staging/ ?  That way the code
can get cleaned up in-tree by others?


Ah, I thought that was what I did? As in, I checked out the kernel git 
repository, moved the driver code into drivers/staging/, and used git diff to 
generate the attached patch. What did I do wrong?


Cheers,

-- P.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 15/20] staging/lustre/libcfs: get rid of debugfs/lnet/console_backoff

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

module parameter libcfs_console_backoff accessible through
/sys/module/libcfs/parameters/libcfs_console_backoff would
do the same thing, just add a special uintpos parameter
type to disallow 0 values too.
Also add a symlink to the module parameter variable for
backwards compatibility

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/libcfs/debug.c  | 31 +-
 drivers/staging/lustre/lustre/libcfs/module.c | 59 +++
 2 files changed, 54 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index 021c92f..147004ce 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -82,8 +82,37 @@ module_param(libcfs_console_min_delay, uint, 0644);
 MODULE_PARM_DESC(libcfs_console_min_delay, Lustre kernel debug console min 
delay (jiffies));
 EXPORT_SYMBOL(libcfs_console_min_delay);
 
+static int param_set_uint_minmax(const char *val,
+const struct kernel_param *kp,
+unsigned int min, unsigned int max)
+{
+   unsigned int num;
+   int ret;
+
+   if (!val)
+   return -EINVAL;
+   ret = kstrtouint(val, 0, num);
+   if (ret == -EINVAL || num  min || num  max)
+   return -EINVAL;
+   *((unsigned int *)kp-arg) = num;
+   return 0;
+}
+
+static int param_set_uintpos(const char *val, const struct kernel_param *kp)
+{
+   return param_set_uint_minmax(val, kp, 1, -1);
+}
+
+static struct kernel_param_ops param_ops_uintpos = {
+   .set = param_set_uintpos,
+   .get = param_get_uint,
+};
+
+#define param_check_uintpos(name, p) \
+   __param_check(name, p, unsigned int)
+
 unsigned int libcfs_console_backoff = CDEBUG_DEFAULT_BACKOFF;
-module_param(libcfs_console_backoff, uint, 0644);
+module_param(libcfs_console_backoff, uintpos, 0644);
 MODULE_PARM_DESC(libcfs_console_backoff, Lustre kernel debug console backoff 
factor);
 EXPORT_SYMBOL(libcfs_console_backoff);
 
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index 8a26446..8b9ce22 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -678,34 +678,6 @@ static int proc_console_min_delay_cs(struct ctl_table 
*table, int write,
return rc;
 }
 
-static int proc_console_backoff(struct ctl_table *table, int write,
-   void __user *buffer, size_t *lenp, loff_t *ppos)
-{
-   int rc, backoff;
-   struct ctl_table dummy = *table;
-
-   dummy.data = backoff;
-   dummy.proc_handler = proc_dointvec;
-
-   if (!write) { /* read */
-   backoff = libcfs_console_backoff;
-   rc = proc_dointvec(dummy, write, buffer, lenp, ppos);
-   return rc;
-   }
-
-   /* write */
-   backoff = 0;
-   rc = proc_dointvec(dummy, write, buffer, lenp, ppos);
-   if (rc  0)
-   return rc;
-   if (backoff = 0)
-   return -EINVAL;
-
-   libcfs_console_backoff = backoff;
-
-   return rc;
-}
-
 static int libcfs_force_lbug(struct ctl_table *table, int write,
 void __user *buffer,
 size_t *lenp, loff_t *ppos)
@@ -815,13 +787,6 @@ static struct ctl_table lnet_table[] = {
.proc_handler = proc_console_min_delay_cs
},
{
-   .procname = console_backoff,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_console_backoff
-   },
-
-   {
.procname = cpu_partition_table,
.maxlen   = 128,
.mode = 0444,
@@ -907,6 +872,23 @@ static struct ctl_table lnet_table[] = {
}
 };
 
+struct lnet_debugfs_symlink_def {
+   char *name;
+   char *target;
+};
+
+struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = {
+   { console_ratelimit,
+ /sys/module/libcfs/parameters/libcfs_console_ratelimit},
+   { debug_path,
+ /sys/module/libcfs/parameters/libcfs_debug_file_path},
+   { panic_on_lbug,
+ /sys/module/libcfs/parameters/libcfs_panic_on_lbug},
+   { libcfs_console_backoff,
+ /sys/module/libcfs/parameters/libcfs_console_backoff},
+   {},
+};
+
 static ssize_t lnet_debugfs_read(struct file *filp, char __user *buf,
 size_t count, loff_t *ppos)
 {
@@ -944,6 +926,7 @@ static void insert_debugfs(void)
 {
struct ctl_table *table;
struct dentry *entry;
+   struct lnet_debugfs_symlink_def *symlinks;
 
if (lnet_debugfs_root == NULL)
lnet_debugfs_root = debugfs_create_dir(lnet, NULL);
@@ -956,6 +939,12 @@ static void insert_debugfs(void)
   

[PATCH 12/20] staging/lustre: Get rid of remaining /proc/sys/lustre plumbing

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

Since all of the variables from /proc/sys/lustre were moved to
/sys/fs/lustre, get rid of the remaining infrastructure.

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/include/obd_class.h  |  1 -
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  1 -
 .../lustre/lustre/obdclass/linux/linux-sysctl.c| 30 --
 3 files changed, 32 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_class.h 
b/drivers/staging/lustre/lustre/include/obd_class.h
index 7dce4ee..e1f8b15 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -1870,7 +1870,6 @@ extern int (*ptlrpc_put_connection_superhack)(struct 
ptlrpc_connection *c);
 
 /* sysctl.c */
 extern int obd_sysctl_init(void);
-extern void obd_sysctl_clean(void);
 
 /* uuid.c  */
 typedef __u8 class_uuid_t[16];
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c 
b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 1f949dc..2c5e703 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -659,7 +659,6 @@ static void cleanup_obdclass(void)
lu_global_fini();
 
obd_cleanup_caches();
-   obd_sysctl_clean();
 
class_procfs_clean();
 
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
index 82b3c39..1515163 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
@@ -50,10 +50,6 @@
 #include ../../include/obd_support.h
 #include ../../include/lprocfs_status.h
 
-#ifdef CONFIG_SYSCTL
-static struct ctl_table_header *obd_table_header;
-#endif
-
 struct static_lustre_uintvalue_attr {
struct {
struct attribute attr;
@@ -144,23 +140,6 @@ LUSTRE_STATIC_UINT_ATTR(at_extra, at_extra);
 LUSTRE_STATIC_UINT_ATTR(at_early_margin, at_early_margin);
 LUSTRE_STATIC_UINT_ATTR(at_history, at_history);
 
-#ifdef CONFIG_SYSCTL
-static struct ctl_table obd_table[] = {
-   {}
-};
-
-static struct ctl_table parent_table[] = {
-   {
-   .procname = lustre,
-   .data = NULL,
-   .maxlen   = 0,
-   .mode = 0555,
-   .child= obd_table
-   },
-   {}
-};
-#endif
-
 static struct attribute *lustre_attrs[] = {
lustre_sattr_timeout.u.attr,
lustre_attr_max_dirty_mb.attr,
@@ -181,18 +160,9 @@ static struct attribute_group lustre_attr_group = {
 
 int obd_sysctl_init(void)
 {
-#ifdef CONFIG_SYSCTL
-   if (!obd_table_header)
-   obd_table_header = register_sysctl_table(parent_table);
-#endif
return sysfs_create_group(lustre_kobj, lustre_attr_group);
 }
 
 void obd_sysctl_clean(void)
 {
-#ifdef CONFIG_SYSCTL
-   if (obd_table_header)
-   unregister_sysctl_table(obd_table_header);
-   obd_table_header = NULL;
-#endif
 }
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/20] staging/lustre: Remove unneeded ldlm_timeout control

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

ldlm_timeout is used server-side to determine AST timeouts,
so it makes no sense on the client, esp. since it's not really used
anywhere.
Remove all traces of it except from the config where make
it a noop.

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/include/obd_support.h | 4 
 drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 9 -
 drivers/staging/lustre/lustre/obdclass/class_obd.c  | 4 
 drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c | 9 -
 drivers/staging/lustre/lustre/obdclass/obd_config.c | 7 +--
 5 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h 
b/drivers/staging/lustre/lustre/include/obd_support.h
index 73e2d48..f6b3692 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -56,9 +56,7 @@ extern unsigned int obd_dump_on_eviction;
 /* obd_timeout should only be used for recovery, not for
networking / disk / timings affected by load (use Adaptive Timeouts) */
 extern unsigned int obd_timeout; /* seconds */
-extern unsigned int ldlm_timeout;   /* seconds */
 extern unsigned int obd_timeout_set;
-extern unsigned int ldlm_timeout_set;
 extern unsigned int at_min;
 extern unsigned int at_max;
 extern unsigned int at_history;
@@ -105,8 +103,6 @@ int obd_alloc_fail(const void *ptr, const char *name, const 
char *type,
 
 /* Timeout definitions */
 #define OBD_TIMEOUT_DEFAULT 100
-#define LDLM_TIMEOUT_DEFAULT   20
-#define MDS_LDLM_TIMEOUT_DEFAULT   6
 /* Time to wait for all clients to reconnect during recovery (hard limit) */
 #define OBD_RECOVERY_TIME_HARD   (obd_timeout * 9)
 /* Time to wait for all clients to reconnect during recovery (soft limit) */
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index b7b6ca1..de74e1c 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -76,15 +76,6 @@ inline unsigned long round_timeout(unsigned long timeout)
return cfs_time_seconds((int)cfs_duration_sec(cfs_time_sub(timeout, 0)) 
+ 1);
 }
 
-/* timeout for initial callback (AST) reply (bz10399) */
-static inline unsigned int ldlm_get_rq_timeout(void)
-{
-   /* Non-AT value */
-   unsigned int timeout = min(ldlm_timeout, obd_timeout / 3);
-
-   return timeout  1 ? 1 : timeout;
-}
-
 #define ELT_STOPPED   0
 #define ELT_READY 1
 #define ELT_TERMINATE 2
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c 
b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 1bc3756..df0063b 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -78,12 +78,8 @@ atomic_t obd_dirty_pages;
 EXPORT_SYMBOL(obd_dirty_pages);
 unsigned int obd_timeout = OBD_TIMEOUT_DEFAULT;   /* seconds */
 EXPORT_SYMBOL(obd_timeout);
-unsigned int ldlm_timeout = LDLM_TIMEOUT_DEFAULT; /* seconds */
-EXPORT_SYMBOL(ldlm_timeout);
 unsigned int obd_timeout_set;
 EXPORT_SYMBOL(obd_timeout_set);
-unsigned int ldlm_timeout_set;
-EXPORT_SYMBOL(ldlm_timeout_set);
 /* Adaptive timeout defs here instead of ptlrpc module for /proc/sys/ access */
 unsigned int at_min = 0;
 EXPORT_SYMBOL(at_min);
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
index e800bd6..eda5f30 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
@@ -61,8 +61,6 @@ static int proc_set_timeout(struct ctl_table *table, int 
write,
int rc;
 
rc = proc_dointvec(table, write, buffer, lenp, ppos);
-   if (ldlm_timeout = obd_timeout)
-   ldlm_timeout = max(obd_timeout / 3, 1U);
return rc;
 }
 
@@ -137,13 +135,6 @@ static struct ctl_table obd_table[] = {
.proc_handler = proc_dointvec
},
{
-   .procname = ldlm_timeout,
-   .data = ldlm_timeout,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_set_timeout
-   },
-   {
.procname = max_dirty_mb,
.data = obd_max_dirty_pages,
.maxlen   = sizeof(int),
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c 
b/drivers/staging/lustre/lustre/obdclass/obd_config.c
index fbdb748..4a32416 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_config.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c
@@ -1123,12 +1123,7 @@ int class_process_config(struct lustre_cfg *lcfg)
goto out;
}
case LCFG_SET_LDLM_TIMEOUT: {
-   CDEBUG(D_IOCTL, changing lustre ldlm_timeout from %d 

[PATCH 20/20] staging/lustre/libcfs: remove unused portal_enter_debugger variable

2015-07-06 Thread green
From: Dmitry Eremin dmitry.ere...@intel.com

Remove portal_enter_debugger because it's not used any more.

Signed-off-by: Dmitry Eremin dmitry.ere...@intel.com
---
 drivers/staging/lustre/lustre/libcfs/debug.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index 07a8f5b..917d179 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -212,9 +212,6 @@ EXPORT_SYMBOL(libcfs_debug_binary);
 unsigned int libcfs_stack = 3 * THREAD_SIZE / 4;
 EXPORT_SYMBOL(libcfs_stack);
 
-static unsigned int portal_enter_debugger;
-EXPORT_SYMBOL(portal_enter_debugger);
-
 unsigned int libcfs_catastrophe;
 EXPORT_SYMBOL(libcfs_catastrophe);
 
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 16/20] staging/lustre/libcfs: Remove redundant enums and sysctl moduleparams

2015-07-06 Thread green
From: Dmitry Eremin dmitry.ere...@intel.com

/proc/sys/lnet/lnet_memused
Remove memory tracking for LNet.
Remove redundant enums definition.

Signed-off-by: Dmitry Eremin dmitry.ere...@intel.com
---
 .../lustre/include/linux/libcfs/libcfs_private.h   | 28 +--
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c| 12 ---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  5 ---
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |  3 +-
 drivers/staging/lustre/lnet/lnet/router_proc.c | 11 --
 .../staging/lustre/lustre/include/obd_support.h| 12 +++
 drivers/staging/lustre/lustre/libcfs/debug.c   |  3 --
 drivers/staging/lustre/lustre/libcfs/module.c  | 41 --
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  6 ++--
 9 files changed, 9 insertions(+), 112 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
index ed37d26..9544860 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
@@ -87,24 +87,6 @@ do { 
\
lbug_with_loc(msgdata);\
 } while (0)
 
-extern atomic_t libcfs_kmemory;
-/*
- * Memory
- */
-
-# define libcfs_kmem_inc(ptr, size)\
-do {   \
-   atomic_add(size, libcfs_kmemory);  \
-} while (0)
-
-# define libcfs_kmem_dec(ptr, size)\
-do {   \
-   atomic_sub(size, libcfs_kmemory);  \
-} while (0)
-
-# define libcfs_kmem_read()\
-   atomic_read(libcfs_kmemory)
-
 #ifndef LIBCFS_VMALLOC_SIZE
 #define LIBCFS_VMALLOC_SIZE(2  PAGE_CACHE_SHIFT) /* 2 pages */
 #endif
@@ -121,14 +103,9 @@ do {   
\
if (unlikely((ptr) == NULL)) {  \
CERROR(LNET: out of memory at %s:%d (tried to alloc ' \
   #ptr ' = %d)\n, __FILE__, __LINE__, (int)(size));  \
-   CERROR(LNET: %d total bytes allocated by lnet\n,  \
-  libcfs_kmem_read()); \
} else {\
memset((ptr), 0, (size));   \
-   libcfs_kmem_inc((ptr), (size)); \
-   CDEBUG(D_MALLOC, alloc ' #ptr ': %d at %p (tot %d).\n,  \
-  (int)(size), (ptr), libcfs_kmem_read()); \
-   }  \
+   }   \
 } while (0)
 
 /**
@@ -180,9 +157,6 @@ do {
\
   %s:%d\n, s, __FILE__, __LINE__);  \
break;\
}  \
-   libcfs_kmem_dec((ptr), s);\
-   CDEBUG(D_MALLOC, kfreed ' #ptr ': %d at %p (tot %d).\n, \
-  s, (ptr), libcfs_kmem_read());   \
if (unlikely(s  LIBCFS_VMALLOC_SIZE))\
vfree(ptr); \
else\
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 4eb24a1..f429d25 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2667,9 +2667,6 @@ static void kiblnd_base_shutdown(void)
 
LASSERT(list_empty(kiblnd_data.kib_devs));
 
-   CDEBUG(D_MALLOC, before LND base cleanup: kmem %d\n,
-  atomic_read(libcfs_kmemory));
-
switch (kiblnd_data.kib_init) {
default:
LBUG();
@@ -2720,9 +2717,6 @@ static void kiblnd_base_shutdown(void)
if (kiblnd_data.kib_scheds != NULL)
cfs_percpt_free(kiblnd_data.kib_scheds);
 
-   CDEBUG(D_MALLOC, after LND base cleanup: kmem %d\n,
-  atomic_read(libcfs_kmemory));
-
kiblnd_data.kib_init = IBLND_INIT_NOTHING;
module_put(THIS_MODULE);
 }
@@ -2739,9 +2733,6 @@ void kiblnd_shutdown(lnet_ni_t *ni)
if (net == NULL)
goto out;
 
-   CDEBUG(D_MALLOC, before LND net cleanup: kmem %d\n,
-  atomic_read(libcfs_kmemory));
-
write_lock_irqsave(g_lock, flags);
net-ibn_shutdown = 1;
write_unlock_irqrestore(g_lock, flags);
@@ -2786,9 +2777,6 @@ void kiblnd_shutdown(lnet_ni_t *ni)

[PATCH 18/20] staging/lustre/libcfs: get rid of debugfs/lnet/debug_mb

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

It's just a fancy libcfs_debug_mb module parameter wrapper,
so just add debug buffer size check and resizing and the same
functionality now would be accessible via
/sys/module/libcfs/parameters/libcfs_debug_mb

Also add a symlink for backwards compatibility.

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/libcfs/debug.c | 37 ++--
 drivers/staging/lustre/lustre/libcfs/module.c| 32 ++--
 drivers/staging/lustre/lustre/libcfs/tracefile.c | 12 
 drivers/staging/lustre/lustre/libcfs/tracefile.h |  1 -
 4 files changed, 37 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index 5ae7b65..e4c7129 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -57,8 +57,39 @@ module_param(libcfs_debug, int, 0644);
 MODULE_PARM_DESC(libcfs_debug, Lustre kernel debug mask);
 EXPORT_SYMBOL(libcfs_debug);
 
+static int libcfs_param_debug_mb_set(const char *val,
+const struct kernel_param *kp)
+{
+   int rc;
+   unsigned num;
+
+   rc = kstrtouint(val, 0, num);
+   if (rc == -EINVAL)
+   return -EINVAL;
+
+   if (!*((unsigned int *)kp-arg)) {
+   *((unsigned int *)kp-arg) = num;
+   return 0;
+   }
+
+   rc = cfs_trace_set_debug_mb(num);
+
+   if (!rc)
+   *((unsigned int *)kp-arg) = cfs_trace_get_debug_mb();
+
+   return rc;
+}
+
+static struct kernel_param_ops param_ops_debugmb = {
+   .set = libcfs_param_debug_mb_set,
+   .get = param_get_uint,
+};
+
+#define param_check_debugmb(name, p) \
+   __param_check(name, p, unsigned int)
+
 static unsigned int libcfs_debug_mb;
-module_param(libcfs_debug_mb, uint, 0644);
+module_param(libcfs_debug_mb, debugmb, 0644);
 MODULE_PARM_DESC(libcfs_debug_mb, Total debug buffer size.);
 EXPORT_SYMBOL(libcfs_debug_mb);
 
@@ -437,8 +468,10 @@ int libcfs_debug_init(unsigned long bufsize)
}
rc = cfs_tracefile_init(max);
 
-   if (rc == 0)
+   if (rc == 0) {
libcfs_register_panic_notifier();
+   libcfs_debug_mb = cfs_trace_get_debug_mb();
+   }
 
return rc;
 }
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index 8e228ae..acfe778 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -550,31 +550,6 @@ static int proc_daemon_file(struct ctl_table *table, int 
write,
 __proc_daemon_file);
 }
 
-static int __proc_debug_mb(void *data, int write,
-  loff_t pos, void __user *buffer, int nob)
-{
-   if (!write) {
-   char tmpstr[32];
-   int  len = snprintf(tmpstr, sizeof(tmpstr), %d,
-   cfs_trace_get_debug_mb());
-
-   if (pos = len)
-   return 0;
-
-   return cfs_trace_copyout_string(buffer, nob, tmpstr + pos,
-  \n);
-   }
-
-   return cfs_trace_set_debug_mb_usrstr(buffer, nob);
-}
-
-static int proc_debug_mb(struct ctl_table *table, int write,
-void __user *buffer, size_t *lenp, loff_t *ppos)
-{
-   return proc_call_handler(table-data, write, ppos, buffer, lenp,
-__proc_debug_mb);
-}
-
 static int proc_console_max_delay_cs(struct ctl_table *table, int write,
 void __user *buffer, size_t *lenp,
 loff_t *ppos)
@@ -790,11 +765,6 @@ static struct ctl_table lnet_table[] = {
.proc_handler = proc_daemon_file,
},
{
-   .procname = debug_mb,
-   .mode = 0644,
-   .proc_handler = proc_debug_mb,
-   },
-   {
.procname = force_lbug,
.data = NULL,
.maxlen   = 0,
@@ -833,6 +803,8 @@ struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = {
  /sys/module/libcfs/parameters/libcfs_panic_on_lbug},
{ libcfs_console_backoff,
  /sys/module/libcfs/parameters/libcfs_console_backoff},
+   { debug_mb,
+ /sys/module/libcfs/parameters/libcfs_debug_mb},
{},
 };
 
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c 
b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index 6ee2adc..effa2af 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -937,18 +937,6 @@ int cfs_trace_set_debug_mb(int mb)
return 0;
 }
 
-int cfs_trace_set_debug_mb_usrstr(void __user *usr_str, int usr_str_nob)
-{
-   char str[32];
-   int  rc;
-
-   rc = cfs_trace_copyin_string(str, 

[PATCH 14/20] staging/lustre/libcfs: Remove redundant lnet debugfs variables

2015-07-06 Thread green
From: Oleg Drokin gr...@linuxhacker.ru

/proc/sys/lnet/console_ratelimit, debug_path and panic_on_lbug
are module parameters with no special magic accessible via
/sys/module/libcfs/parameters/libcfs_console_ratelimit,
/sys/module/libcfs/parameters/libcfs_debug_file_path and
/sys/module/libcfs/parameters/libcfs_panic_on_lbug respectively.

As such just replace them with corresponding symlinks

Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/libcfs/module.c | 22 --
 1 file changed, 22 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index bffde77..8a26446 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -803,13 +803,6 @@ static struct ctl_table lnet_table[] = {
.proc_handler = proc_dobitmasks,
},
{
-   .procname = console_ratelimit,
-   .data = libcfs_console_ratelimit,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec
-   },
-   {
.procname = console_max_delay_centisecs,
.maxlen   = sizeof(int),
.mode = 0644,
@@ -829,14 +822,6 @@ static struct ctl_table lnet_table[] = {
},
 
{
-   .procname = debug_path,
-   .data = libcfs_debug_file_path_arr,
-   .maxlen   = sizeof(libcfs_debug_file_path_arr),
-   .mode = 0644,
-   .proc_handler = proc_dostring,
-   },
-
-   {
.procname = cpu_partition_table,
.maxlen   = 128,
.mode = 0444,
@@ -872,13 +857,6 @@ static struct ctl_table lnet_table[] = {
.proc_handler = proc_dointvec,
},
{
-   .procname = panic_on_lbug,
-   .data = libcfs_panic_on_lbug,
-   .maxlen   = sizeof(int),
-   .mode = 0644,
-   .proc_handler = proc_dointvec,
-   },
-   {
.procname = dump_kernel,
.maxlen   = 256,
.mode = 0200,
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Alternate rtl8192cu driver.

2015-07-06 Thread Greg KH
On Mon, Jul 06, 2015 at 07:01:30PM +0200, P. Varet wrote:
 On 07/06/2015 06:47 PM, Greg KH wrote:
 
 How about making it a patch for drivers/staging/ ?  That way the code
 can get cleaned up in-tree by others?
 
 Ah, I thought that was what I did? As in, I checked out the kernel git
 repository, moved the driver code into drivers/staging/, and used git diff
 to generate the attached patch. What did I do wrong?

Ah, you did that, I didn't look at the compressed file as you said it
had a dkms Makefile, so I assumed it wasn't for the kernel tree.

But, have you tried the in-kernel driver for this device?  It's in
drivers/net/wireless/rtlwifi/rtl8192cu/ ?  I really don't want to merge
a driver for a device we already support.  Why not work with the author
of that driver to fix any problems you might have with it, instead of
using a totally different driver that isn't using the in-kernel wifi
stack?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 19/20] staging/lustre/libcfs: get rid of debugfs/lnet/console_{min, max}_delay_centisecs

2015-07-06 Thread green
From: Dmitry Eremin dmitry.ere...@intel.com

They are just fancy module parameters wrappers,
so just the same functionality now would be accessible via
/sys/module/libcfs/parameters/libcfs_console_{min,max}_delay

Also install compatibility symlinks

Signed-off-by: Dmitry Eremin dmitry.ere...@intel.com
Signed-off-by: Oleg Drokin gr...@linuxhacker.ru
---
 drivers/staging/lustre/lustre/libcfs/debug.c  | 69 --
 drivers/staging/lustre/lustre/libcfs/module.c | 82 ++-
 2 files changed, 68 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c 
b/drivers/staging/lustre/lustre/libcfs/debug.c
index e4c7129..07a8f5b 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -103,16 +103,75 @@ module_param(libcfs_console_ratelimit, uint, 0644);
 MODULE_PARM_DESC(libcfs_console_ratelimit, Lustre kernel debug console 
ratelimit (0 to disable));
 EXPORT_SYMBOL(libcfs_console_ratelimit);
 
+static int param_set_delay_minmax(const char *val,
+ const struct kernel_param *kp,
+ long min, long max)
+{
+   long d;
+   int sec;
+   int rc;
+
+   rc = kstrtoint(val, 0, sec);
+   if (rc)
+   return -EINVAL;
+
+   d = cfs_time_seconds(sec) / 100;
+   if (d  min || d  max)
+   return -EINVAL;
+
+   *((unsigned int *)kp-arg) = d;
+
+   return 0;
+}
+
+static int param_get_delay(char *buffer, const struct kernel_param *kp)
+{
+   unsigned int d = *(unsigned int *)kp-arg;
+
+   return sprintf(buffer, %u, (unsigned int)cfs_duration_sec(d * 100));
+}
+
 unsigned int libcfs_console_max_delay;
-module_param(libcfs_console_max_delay, uint, 0644);
-MODULE_PARM_DESC(libcfs_console_max_delay, Lustre kernel debug console max 
delay (jiffies));
 EXPORT_SYMBOL(libcfs_console_max_delay);
-
 unsigned int libcfs_console_min_delay;
-module_param(libcfs_console_min_delay, uint, 0644);
-MODULE_PARM_DESC(libcfs_console_min_delay, Lustre kernel debug console min 
delay (jiffies));
 EXPORT_SYMBOL(libcfs_console_min_delay);
 
+static int param_set_console_max_delay(const char *val,
+  const struct kernel_param *kp)
+{
+   return param_set_delay_minmax(val, kp,
+ libcfs_console_min_delay, INT_MAX);
+}
+
+static struct kernel_param_ops param_ops_console_max_delay = {
+   .set = param_set_console_max_delay,
+   .get = param_get_delay,
+};
+
+#define param_check_console_max_delay(name, p) \
+   __param_check(name, p, unsigned int)
+
+module_param(libcfs_console_max_delay, console_max_delay, 0644);
+MODULE_PARM_DESC(libcfs_console_max_delay, Lustre kernel debug console max 
delay (jiffies));
+
+static int param_set_console_min_delay(const char *val,
+  const struct kernel_param *kp)
+{
+   return param_set_delay_minmax(val, kp,
+ 1, libcfs_console_max_delay);
+}
+
+static struct kernel_param_ops param_ops_console_min_delay = {
+   .set = param_set_console_min_delay,
+   .get = param_get_delay,
+};
+
+#define param_check_console_min_delay(name, p) \
+   __param_check(name, p, unsigned int)
+
+module_param(libcfs_console_min_delay, console_min_delay, 0644);
+MODULE_PARM_DESC(libcfs_console_min_delay, Lustre kernel debug console min 
delay (jiffies));
+
 static int param_set_uint_minmax(const char *val,
 const struct kernel_param *kp,
 unsigned int min, unsigned int max)
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index acfe778..0ed2658 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -550,72 +550,6 @@ static int proc_daemon_file(struct ctl_table *table, int 
write,
 __proc_daemon_file);
 }
 
-static int proc_console_max_delay_cs(struct ctl_table *table, int write,
-void __user *buffer, size_t *lenp,
-loff_t *ppos)
-{
-   int rc, max_delay_cs;
-   struct ctl_table dummy = *table;
-   long d;
-
-   dummy.data = max_delay_cs;
-   dummy.proc_handler = proc_dointvec;
-
-   if (!write) { /* read */
-   max_delay_cs = cfs_duration_sec(libcfs_console_max_delay * 100);
-   rc = proc_dointvec(dummy, write, buffer, lenp, ppos);
-   return rc;
-   }
-
-   /* write */
-   max_delay_cs = 0;
-   rc = proc_dointvec(dummy, write, buffer, lenp, ppos);
-   if (rc  0)
-   return rc;
-   if (max_delay_cs = 0)
-   return -EINVAL;
-
-   d = cfs_time_seconds(max_delay_cs) / 100;
-   if (d == 0 || d  libcfs_console_min_delay)
-  

Re: [PATCHv3 08/16] staging: vme_user: provide DMA functionality

2015-07-06 Thread Dmitry Kalinkin
On Mon, Jul 6, 2015 at 5:48 PM, Martyn Welch martyn.we...@ge.com wrote:


 On 06/07/15 14:50, Dmitry Kalinkin wrote:

 On Mon, Jul 6, 2015 at 4:22 PM, Martyn Welch martyn.we...@ge.com wrote:


 Sorry about the *really* late reply, loads of emails some how missed my
 periodic search of the mailing list.

 I'm happy with the addition of DMA, just not sure whether it's worth
 adding
 an extra device file just to handle DMA. Could the user space application
 not just use the control device?

 That would require an additional ioctl field for DMA channel id in case we
 want
 to support both DMA channels on tsi148.


 Or just dynamically allocate and free a resource for the DMA operation?
That seems to be a too high level.
Also notice how vme_user_dma_ioctl is doing without locks now. Acquiring a
resource for operation would introduce at least one.

 It would make sense to save that device minor if Documentation/devices.txt
 was good.
 But it has only 4 slave and 4 master windows whereas we would want to
 make some parameters for vme_user to configure this allocation numbers up
 to 8 slaves and 8 masters.


 The vme_user module was originally envisaged as a mechanism to provide
 support for applications that had been written to use the original driver at
 vmelinux.org.
That part I never understood. vmelinux.org's cvs has a very dated driver
with a very limited capabilities.

This one looks like a grandpa of the one we have (both tsi148 and universe):
ftp://ftp.prosoft.ru/pub/Hardware/Fastwel/CPx/CPC600/Software/Drivers/Linux/tsi148.tar.gz

There is also VME4L driver by MEN (tsi148 only):
https://www.men.de/software/13z014-90/

Some other driver:
http://www.awa.tohoku.ac.jp/~sanshiro/kinoko-e/vmedrv/

Some other driver (universe only):
https://github.com/mgmarino/VMELinux/blob/master/driver/universe.c

Driver by CERN (dynamic window allocation):
https://github.com/cota/ht-drivers/tree/master/vmebridge/driver

The point is: there are many drivers of different quality. All all of them
include some sort of userspace interface and that, as you mention below,
seems to work well for many cases.
All I'm trying to do is to make vme_user to be at least as useful as
drivers above
without looking back at vmelinux.
 Some functionality was dropped as it was not good practice
 (such as receiving VME interrupts in user space, it's not really doable if
 the slave card is Release On Register Access rather than Release on
 Acknowledge),
Didn't know about RORA. I wonder how different this is compared to the
PCI bus case.
 so the interface became more of a debug mechanism for me.
 Others have clearly found it provides enough for them to allow drivers to be
 written in user space.

 I was thinking that the opposite might be better, no windows were mapped at
 module load, windows could be allocated and mapped using the control device.
 This would ensure that unused resources were still available for kernel
 based drivers and would mean the driver wouldn't be pre-allocating a bunch
 of fairly substantially sized slave window buffers (the buffers could also
 be allocated to match the size of the slave window requested). What do you
 think?
I'm not a VME expert, but it seems that VME windows are a quiet limited resource
no matter how you allocate your resources. Theoretically we could put up to 32
different boards in a single crate, so there won't be enough windows for each
driver to allocate. That said, there is no way around this when putting together
a really heterogeneous VME system. To overcome such problem, one could
develop a different kernel API that would not provide windows to the
drivers, but
handle reads and writes by reconfiguring windows on the fly, which in turn would
introduce more latency. Those who need such API are welcome to develop it :)

As for dynamic vme_user device allocation, I don't see the point in this.
The only existing kernel VME driver allocates windows in advance, user is just
to make sure to leave one free window if she wants to use that. Module parameter
for window count will be dynamic enough to handle that.

Cheers,
Dmitry
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Alternate rtl8192cu driver.

2015-07-06 Thread Greg KH
On Mon, Jul 06, 2015 at 06:25:25PM +0200, P. Varet wrote:
 Hi all,
 
 This is me keeping a promise I made to Greg KH half a year ago. (Thread
 here: 
 https://www.reddit.com/r/linux/comments/2ny1lz/im_greg_kroahhartman_linux_kernel_developer_ama/cmhyvqh)
 
 
 WHAT IS THIS?
 =
 
 This is an alternate implementation of a driver for the RTL8192CU family of
 chipsets. It's exactly the driver made available by Realtek on their
 website, except patched so it will compile against kernels that no longer
 provide the old procfs API and with calls to strnicmp() replaced with
 strncasecmp().
 
 A bunch of tiny details also got fixed, but nothing important. (Making logs
 less verbose and such.)
 
 This alternate driver is maintained here: 
 https://github.com/pvaret/rtl8192cu-fixes
 
 The original Realtek driver is available here: 
 http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1PNid=48PFid=48Level=5Conn=4DownTypeID=3GetDown=falseDownloads=true#2772
 
 
 WHY NOT USE THE EXISTING DRIVER?
 
 
 The RTL8192CU driver that currently ships with the kernel doesn't work well,
 or sometimes at all, with many of the devices that it purports to support.
 As far as I can tell, this is due to this still unsolved bug:
 https://bugzilla.kernel.org/show_bug.cgi?id=57171
 
 The driver provided in this patch works with many such devices (though,
 sadly, not all). It allows owners of devices such as the Belkin N300 USB
 WiFi adapter to use them on Linux.
 
 My knowledge of the inner workings of that class of hardware is WAY too low
 to tell why it doesn't work with some devices even though those use the
 8192cu chipset. (I blame Realtek.)
 
 
 IS THIS PATCH COMPLETE?
 ===
 
 Alas, no.
 
 The Makefile that comes with this driver is intended to compile it as a DKMS
 module. It would have to be ported to a 'proper' kernel Makefile.
 
 It also lacks a proper port of the procfs populating code to the new procfs
 API, though that doesn't prevent it from working. (I only disabled the code
 that uses the old API on kernel versions  3.9.)
 
 
 WHY MERGE IT?
 =
 
 As far as I know, it's the only way to get certain devices, like the
 aforementioned Belkin N300, to work at all on Linux.
 
 I therefore get a LOT of requests to try and see this driver mainlined. I
 also promised Greg KH I'd submit it here. (And sorry about the latency, by
 the way. These have been busy months.)
 
 That said, it's obviously not ready to be mainlined yet, of course. There's
 the Makefile issue, and from what I can tell, the code could use a good
 scrubbing. (Stuff that's sadly out of my immediate skillset.)
 
 
 PATCH
 =
 
 Attached as a bzipped file because it's LARGE. I hope that's okay.

How about making it a patch for drivers/staging/ ?  That way the code
can get cleaned up in-tree by others?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH net-next, v2] hv_netvsc: Add support to set MTU reservation from guest side

2015-07-06 Thread Haiyang Zhang
When packet encapsulation is in use, the MTU needs to be reduced for
headroom reservation.
The existing code takes the updated MTU value only from the host side.
But vSwitch extensions, such as Open vSwitch, require the flexibility
to change the MTU to different values from within a guest during the
lifecycle of a vNIC, when the encapsulation protocol is changed. The
patch supports this kind of MTU changes.

Signed-off-by: Haiyang Zhang haiya...@microsoft.com
Reviewed-by: K. Y. Srinivasan k...@microsoft.com
---
 drivers/net/hyperv/hyperv_net.h   |1 +
 drivers/net/hyperv/netvsc_drv.c   |3 +--
 drivers/net/hyperv/rndis_filter.c |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index dd45440..26cd14c 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -589,6 +589,7 @@ struct nvsp_message {
 
 
 #define NETVSC_MTU 65536
+#define NETVSC_MTU_MIN 68
 
 #define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16)  /* 16MB */
 #define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY  (1024*1024*15)  /* 15MB */
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 358475e..b855ba9 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -743,8 +743,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int 
mtu)
if (nvdev-nvsp_version = NVSP_PROTOCOL_VERSION_2)
limit = NETVSC_MTU - ETH_HLEN;
 
-   /* Hyper-V hosts don't support MTU  ETH_DATA_LEN (1500) */
-   if (mtu  ETH_DATA_LEN || mtu  limit)
+   if (mtu  NETVSC_MTU_MIN || mtu  limit)
return -EINVAL;
 
nvdev-start_remove = true;
diff --git a/drivers/net/hyperv/rndis_filter.c 
b/drivers/net/hyperv/rndis_filter.c
index 006c1b8..172824e 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -1053,7 +1053,7 @@ int rndis_filter_device_add(struct hv_device *dev,
ret = rndis_filter_query_device(rndis_device,
RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE,
mtu, size);
-   if (ret == 0  size == sizeof(u32))
+   if (ret == 0  size == sizeof(u32)  mtu  net_device-ndev-mtu)
net_device-ndev-mtu = mtu;
 
/* Get the mac address */
-- 
1.7.4.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Warnings : Fixed 80 character length warning in rtw_ap.c

2015-07-06 Thread Greg KH
On Mon, Jul 06, 2015 at 09:53:26PM -0400, Sreenath Madasu wrote:
 When the checkpatch.pl script was run, it showed lines with length
 more than 80 characters in rtw_ap.c file. Fixed line number 382 by
 breaking it up into two lines within 80 characters.
 
 Signed-off-by: Sreenath Madasu sreenath.mad...@gmail.com
 ---
  drivers/staging/rtl8188eu/core/rtw_ap.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Any reason why you didn't cc: the maintainer of the staging subsystem
for this?  Please use scripts/get_maintainer to determine who to send
stuff to.

Also, can you fix up the Subject line to show the subsystem and driver
you are modifying?

Can you fix that up and resend?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: lustre: obdclass: fix macro coding style issue in uuid.c

2015-07-06 Thread Greg KH
On Fri, Jun 26, 2015 at 11:04:49PM -0700, Joe Perches wrote:
 On Sat, 2015-06-27 at 06:36 +0100, Vasiliy Korchagin wrote:
  This patch fixes the checkpatch.pl error:
  
  ERROR: Macros with complex values should be enclosed in parentheses
  +#define CONSUME(val, ptr) (val) = consume(sizeof(val), (ptr))
  
  by expanding it as this macro is used only once.
 []
  Notes:
  Here is another version with macro expansion. Inline function expansion 
  doesn't
  seem like a good idea to me as it would make things overcomplicated.
 
 It looks like it'd be simpler to use vsprintf extension %pU
 ---
  drivers/staging/lustre/lustre/obdclass/uuid.c | 34 
 +--
  1 file changed, 1 insertion(+), 33 deletions(-)
 
 diff --git a/drivers/staging/lustre/lustre/obdclass/uuid.c 
 b/drivers/staging/lustre/lustre/obdclass/uuid.c
 index ff0a01b..b0b0157 100644
 --- a/drivers/staging/lustre/lustre/obdclass/uuid.c
 +++ b/drivers/staging/lustre/lustre/obdclass/uuid.c
 @@ -43,40 +43,8 @@
  #include ../include/obd_support.h
  #include ../include/obd_class.h
  
 -
 -static inline __u32 consume(int nob, __u8 **ptr)
 -{
 - __u32 value;
 -
 - LASSERT(nob = sizeof(value));
 -
 - for (value = 0; nob  0; --nob)
 - value = (value  8) | *((*ptr)++);
 - return value;
 -}
 -
 -#define CONSUME(val, ptr) (val) = consume(sizeof(val), (ptr))
 -
 -static void uuid_unpack(class_uuid_t in, __u16 *uu, int nr)
 -{
 - __u8 *ptr = in;
 -
 - LASSERT(nr * sizeof(*uu) == sizeof(class_uuid_t));
 -
 - while (nr--  0)
 - CONSUME(uu[nr], ptr);
 -}
 -
  void class_uuid_unparse(class_uuid_t uu, struct obd_uuid *out)
  {
 - /* uu as an array of __u16's */
 - __u16 uuid[sizeof(class_uuid_t) / sizeof(__u16)];
 -
 - CLASSERT(ARRAY_SIZE(uuid) == 8);
 -
 - uuid_unpack(uu, uuid, ARRAY_SIZE(uuid));
 - sprintf(out-uuid, %04x%04x-%04x-%04x-%04x-%04x%04x%04x,
 - uuid[0], uuid[1], uuid[2], uuid[3],
 - uuid[4], uuid[5], uuid[6], uuid[7]);
 + sprintf(out-uuid, %pU, uu);
  }
  EXPORT_SYMBOL(class_uuid_unparse);

I agree, much better, can you resend this in a form I can apply?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/4] staging: wilc1000: cover letter

2015-07-06 Thread Greg Kroah-Hartman
On Fri, Jun 26, 2015 at 04:43:44PM +0200, Luis de Bethencourt wrote:
 Patches to be applied on top of
 https://patchwork.kernel.org/patch/6655831/

I don't use patchwork, and when on an airplane with no internet access
(like right now), a url provides no context at all.  Always use email
subject lines or something that I can actually reference properly while
offline...

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/6] staging: wilc1000: delete 'WILC_WFIDrvHandle' structure

2015-07-06 Thread Greg KH
On Tue, Jun 30, 2015 at 05:34:34PM +0900, Dean Lee wrote:
 delete odd structure and rework it.

what do you mean by rework it?  It looks like you just made it a void
* everywhere, which is what I explicitly said to not do.

sorry, can't take this.

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: wilc1000: Delete unnecessary checks before two function calls

2015-07-06 Thread Greg Kroah-Hartman
On Sat, Jun 27, 2015 at 04:36:14PM +0200, SF Markus Elfring wrote:
 From: Markus Elfring elfr...@users.sourceforge.net
 Date: Sat, 27 Jun 2015 15:56:57 +0200

Why is this in the body of the email?  Please fix your email client or
just use git send-email properly.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] staging: wilc1000: One function call less in mac_ioctl() after error detection

2015-07-06 Thread Greg Kroah-Hartman
On Sat, Jun 27, 2015 at 04:37:24PM +0200, SF Markus Elfring wrote:
 From: Markus Elfring elfr...@users.sourceforge.net
 Date: Sat, 27 Jun 2015 16:00:59 +0200

Again, please fix.

 
 The kfree() function was called in two cases by the mac_ioctl() function
 during error handling even if the passed variable did not contain a pointer
 for a valid data item.
 
 * This implementation detail could be improved by the introduction
   of another jump label.
 
 * Drop an unnecessary initialisation for the variable buff then.

That's a different issue, please fix it in a separate patch.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 5/6] staging: wilc1000: fix initialize warning issue.

2015-07-06 Thread Greg KH
On Tue, Jun 30, 2015 at 05:34:37PM +0900, Dean Lee wrote:
 modify it

modify what?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: lustre: obdclass: fix macro coding style issue in uuid.c

2015-07-06 Thread Joe Perches
On Mon, 2015-07-06 at 19:36 -0700, Greg KH wrote:
 On Fri, Jun 26, 2015 at 11:04:49PM -0700, Joe Perches wrote:
  On Sat, 2015-06-27 at 06:36 +0100, Vasiliy Korchagin wrote:
[]
   Here is another version with macro expansion. Inline function 
   expansion doesn't
   seem like a good idea to me as it would make things overcomplicated.
  
  It looks like it'd be simpler to use vsprintf extension %pU
[]
  diff --git a/drivers/staging/lustre/lustre/obdclass/uuid.c 
  b/drivers/staging/lustre/lustre/obdclass/uuid.c
[]
  +   sprintf(out-uuid, %pU, uu);
   }
   EXPORT_SYMBOL(class_uuid_unparse);
 
 I agree, much better, can you resend this in a form I can apply?

Vasiliy, you started this, can you submit this
under your name please?


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Tools: hv: kvp: fix a build warning -Wformat-security

2015-07-06 Thread Dexuan Cui
It is to fix:
hv_kvp_daemon.c:705:2: warning: format not a string literal and no format 
arguments [-Wformat-security]

Signed-off-by: Dexuan Cui de...@microsoft.com
---
 tools/hv/hv_kvp_daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 0d9f48e..f9d5089 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -702,7 +702,7 @@ static char *kvp_mac_to_if_name(char *mac)
if (dir == NULL)
return NULL;
 
-   snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
+   snprintf(dev_id, sizeof(dev_id), %s, kvp_net_dir);
q = dev_id + strlen(kvp_net_dir);
 
while ((entry = readdir(dir)) != NULL) {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] defines modified to match the 80-char rule

2015-07-06 Thread Krzysztof Hałasa
Joe Perches j...@perches.com writes:

 Nah, you're not an extremist, you're just preferring narrowly
 localized readability over global consistency.

 That's fine and all, until you come up to LCONSOLE_ERROR_MSG
 type use which blows the nice old formatting up.

 So what I suggested is just a simple consistency thing.

So, could we have the localized readability when it makes sense,
and the default rules when nothing else applies?


OTOH I think the 80 columns rule should go.
-- 
Krzysztof Halasa

Industrial Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv4 0/2] staging: ion: enable shrinking of pool

2015-07-06 Thread Gioh Kim
Hello,

The ion has internal page pool to keep freed pages.
There is no way to shrink the pool so that the pool sometimes
grows too big.

For example my platform allocates some graphic memory via ion.
Sometimes the pool can be several hundreds MB. I want to
flush the pool before critical page shortage.


This patch set combines 2 patches like followings.

1. Patch 1/2: make individual pool work by page unit
This patch makes the pool be shrinked in page unit.

2. Patch 2/2: enable pool shrink
This patch enables pool shrink and make debugfs to specify shrink amount.
The pool shrink is almost implemented but it is not complete.
This patch completes the implementation.

For instance, this shrinks all pages in every pool.
echo 0  /sys/kernel/debug/ion/heaps/system_shrink
If you want specify the number of pages to be shrinked:
echo 30  /sys/kernel/debug/ion/heaps/system_shrink

My thanks to Laura Abbott for reviews of the v3v2 patchset. Most
of the changes below were based on her feedback.

Changes since v3:
- Add reviewer Laura Abbott
- Fix description of patch 2/2

Changes since v2:
- Rebased to v4.1
- Call shrinker interfaces instead of calling heap-ops-shrink
- Add more description about the reason
- Remove a patch to limit pool size

This patchset is based on v4.1


Gioh Kim (2):
  staging: ion: shrink page-pool by page unit
  staging: ion: debugfs to shrink pool

 drivers/staging/android/ion/ion.c |   22 +-
 drivers/staging/android/ion/ion_page_pool.c   |5 +++--
 drivers/staging/android/ion/ion_system_heap.c |   16 ++--
 3 files changed, 26 insertions(+), 17 deletions(-)

-- 
1.7.9.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv4 2/2] staging: ion: debugfs to shrink pool

2015-07-06 Thread Gioh Kim
This patch enables debugfs file /sys/kernel/debug/ion/heaps/system_shrink
to shrink pool and get pool size. This technically enables debugfs
shrinking for all heaps, not just the system heap although the system heap
is the only one with a shrinker right now. It is already implemented
but not complete. This patch completes and enables it.

Reading the file returns pool size
in page unit and writing the number of pages shrinks pool.
It flushes all pages to write zero at the file.

Signed-off-by: Gioh Kim gioh@lge.com
Reviewed-by: Laura Abbott labb...@redhat.com
---
 drivers/staging/android/ion/ion.c |   22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 6f48112..9327e8a 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1466,7 +1466,6 @@ static const struct file_operations debug_heap_fops = {
.release = single_release,
 };
 
-#ifdef DEBUG_HEAP_SHRINKER
 static int debug_shrink_set(void *data, u64 val)
 {
struct ion_heap *heap = data;
@@ -1474,15 +1473,14 @@ static int debug_shrink_set(void *data, u64 val)
int objs;
 
sc.gfp_mask = -1;
-   sc.nr_to_scan = 0;
-
-   if (!val)
-   return 0;
+   sc.nr_to_scan = val;
 
-   objs = heap-shrinker.shrink(heap-shrinker, sc);
-   sc.nr_to_scan = objs;
+   if (!val) {
+   objs = heap-shrinker.count_objects(heap-shrinker, sc);
+   sc.nr_to_scan = objs;
+   }
 
-   heap-shrinker.shrink(heap-shrinker, sc);
+   heap-shrinker.scan_objects(heap-shrinker, sc);
return 0;
 }
 
@@ -1495,14 +1493,13 @@ static int debug_shrink_get(void *data, u64 *val)
sc.gfp_mask = -1;
sc.nr_to_scan = 0;
 
-   objs = heap-shrinker.shrink(heap-shrinker, sc);
+   objs = heap-shrinker.count_objects(heap-shrinker, sc);
*val = objs;
return 0;
 }
 
 DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get,
debug_shrink_set, %llu\n);
-#endif
 
 void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
 {
@@ -1540,8 +1537,7 @@ void ion_device_add_heap(struct ion_device *dev, struct 
ion_heap *heap)
path, heap-name);
}
 
-#ifdef DEBUG_HEAP_SHRINKER
-   if (heap-shrinker.shrink) {
+   if (heap-shrinker.count_objects  heap-shrinker.scan_objects) {
char debug_name[64];
 
snprintf(debug_name, 64, %s_shrink, heap-name);
@@ -1556,7 +1552,7 @@ void ion_device_add_heap(struct ion_device *dev, struct 
ion_heap *heap)
path, debug_name);
}
}
-#endif
+
up_write(dev-lock);
 }
 
-- 
1.7.9.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv4 1/2] staging: ion: shrink page-pool by page unit

2015-07-06 Thread Gioh Kim
This patch shrink page-pool by page unit.

The system shrinker calls ion_heap_shrink_count() to get nr_to_scan,
and pass it to ion_heap_shrink_scan().
The problem is the return value of ion_heap_shrink_count() is the number
of pages but ion_system_heap_shrink(), which is called by
ion_heap_shrink_scan(), gets the number of chunk.

The main root of this is that ion_page_pool_shrink() returns page count
via ion_page_pool_total() if it have to check pool size. But it frees
chunks of pages if it have to free pools.

This patch first fix ion_page_pool_shrink() to count only pages,
not chunks. And then ion_system_heap_shrink() to work on pages.

Signed-off-by: Gioh Kim gioh@lge.com
Reviewed-by: Laura Abbott labb...@redhat.com
---
 drivers/staging/android/ion/ion_page_pool.c   |5 +++--
 drivers/staging/android/ion/ion_system_heap.c |   16 ++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/ion_page_pool.c 
b/drivers/staging/android/ion/ion_page_pool.c
index 4b88f11..19ad3ab 100644
--- a/drivers/staging/android/ion/ion_page_pool.c
+++ b/drivers/staging/android/ion/ion_page_pool.c
@@ -116,7 +116,7 @@ static int ion_page_pool_total(struct ion_page_pool *pool, 
bool high)
 int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t gfp_mask,
int nr_to_scan)
 {
-   int freed;
+   int freed = 0;
bool high;
 
if (current_is_kswapd())
@@ -127,7 +127,7 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t 
gfp_mask,
if (nr_to_scan == 0)
return ion_page_pool_total(pool, high);
 
-   for (freed = 0; freed  nr_to_scan; freed++) {
+   while (freed  nr_to_scan) {
struct page *page;
 
mutex_lock(pool-mutex);
@@ -141,6 +141,7 @@ int ion_page_pool_shrink(struct ion_page_pool *pool, gfp_t 
gfp_mask,
}
mutex_unlock(pool-mutex);
ion_page_pool_free_pages(pool, page);
+   freed += (1  pool-order);
}
 
return freed;
diff --git a/drivers/staging/android/ion/ion_system_heap.c 
b/drivers/staging/android/ion/ion_system_heap.c
index da2a63c..7a7a9a0 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -212,14 +212,26 @@ static int ion_system_heap_shrink(struct ion_heap *heap, 
gfp_t gfp_mask,
 {
struct ion_system_heap *sys_heap;
int nr_total = 0;
-   int i;
+   int i, nr_freed;
+   int only_scan = 0;
 
sys_heap = container_of(heap, struct ion_system_heap, heap);
 
+   if (!nr_to_scan)
+   only_scan = 1;
+
for (i = 0; i  num_orders; i++) {
struct ion_page_pool *pool = sys_heap-pools[i];
 
-   nr_total += ion_page_pool_shrink(pool, gfp_mask, nr_to_scan);
+   nr_freed = ion_page_pool_shrink(pool, gfp_mask, nr_to_scan);
+   nr_total += nr_freed;
+
+   if (!only_scan) {
+   nr_to_scan -= nr_freed;
+   /* shrink completed */
+   if (nr_to_scan = 0)
+   break;
+   }
}
 
return nr_total;
-- 
1.7.9.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH trivial] staging: comedi: Grammar s/Enable support a/Enable support for a/

2015-07-06 Thread Ian Abbott

On 06/07/15 14:41, Geert Uytterhoeven wrote:

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
  drivers/staging/comedi/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 7dee73dfbf88ff09..57e71f9f14a2385b 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -2,7 +2,7 @@ config COMEDI
tristate Data acquisition support (comedi)
depends on m
---help---
- Enable support a wide range of data acquisition devices
+ Enable support for a wide range of data acquisition devices
  for Linux.

  if COMEDI



Thanks for the fix!

Reviewed-by: Ian Abbott abbo...@mev.co.uk

--
-=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] vme: print unhandled VME access errors

2015-07-06 Thread Martyn Welch

That's the ticket :-)

On 06/07/15 15:43, Dmitry Kalinkin wrote:

This will enable error messages for accesses done through mmap.

Signed-off-by: Dmitry Kalinkin dmitry.kalin...@gmail.com
---
This depends on '[PATCH 0/3] VME bus error handling overhaul' patchset.
---
  drivers/vme/vme.c | 7 +++
  1 file changed, 7 insertions(+)

diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index 7a10d92..72924b0 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -1028,6 +1028,7 @@ void vme_bus_error_handler(struct vme_bridge *bridge,
  {
struct list_head *handler_pos = NULL;
struct vme_error_handler *handler;
+   int handler_triggered = 0;
u32 aspace = vme_get_aspace(am);

list_for_each(handler_pos, bridge-vme_error_handlers) {
@@ -1040,8 +1041,14 @@ void vme_bus_error_handler(struct vme_bridge *bridge,
handler-first_error = address;
if (handler-num_errors != UINT_MAX)
handler-num_errors++;
+   handler_triggered = 1;
}
}
+
+   if (!handler_triggered)
+   dev_err(bridge-parent,
+   Unhandled VME access error at address 0x%llx\n,
+   address);
  }
  EXPORT_SYMBOL(vme_bus_error_handler);




--
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv3 08/16] staging: vme_user: provide DMA functionality

2015-07-06 Thread Martyn Welch

On 13/06/15 01:28, Greg Kroah-Hartman wrote:

On Thu, May 28, 2015 at 03:07:05PM +0300, Dmitry Kalinkin wrote:

This introduces a new dma device that provides a single ioctl call that
provides DMA read and write functionality to the user space.

Signed-off-by: Dmitry Kalinkin dmitry.kalin...@gmail.com
Cc: Igor Alekseev igor.aleks...@itep.ru
---
  drivers/staging/vme/devices/vme_user.c | 201 -
  drivers/staging/vme/devices/vme_user.h |  11 ++
  2 files changed, 209 insertions(+), 3 deletions(-)


I want to get Martyn's feedback on this, as it's adding a new feature to
the subsystem that he's going to have to maintain.



Sorry about the *really* late reply, loads of emails some how missed my 
periodic search of the mailing list.


I'm happy with the addition of DMA, just not sure whether it's worth 
adding an extra device file just to handle DMA. Could the user space 
application not just use the control device?


--
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] vme: print unhandled VME access errors

2015-07-06 Thread Dmitry Kalinkin
This will enable error messages for accesses done through mmap.

Signed-off-by: Dmitry Kalinkin dmitry.kalin...@gmail.com
---
This depends on '[PATCH 0/3] VME bus error handling overhaul' patchset.
---
 drivers/vme/vme.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index 7a10d92..72924b0 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -1028,6 +1028,7 @@ void vme_bus_error_handler(struct vme_bridge *bridge,
 {
struct list_head *handler_pos = NULL;
struct vme_error_handler *handler;
+   int handler_triggered = 0;
u32 aspace = vme_get_aspace(am);
 
list_for_each(handler_pos, bridge-vme_error_handlers) {
@@ -1040,8 +1041,14 @@ void vme_bus_error_handler(struct vme_bridge *bridge,
handler-first_error = address;
if (handler-num_errors != UINT_MAX)
handler-num_errors++;
+   handler_triggered = 1;
}
}
+
+   if (!handler_triggered)
+   dev_err(bridge-parent,
+   Unhandled VME access error at address 0x%llx\n,
+   address);
 }
 EXPORT_SYMBOL(vme_bus_error_handler);
 
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: board: Kconfig: Let STAGING_BOARD depend on CLKDEV_LOOKUP

2015-07-06 Thread Stephen Rothwell
Hi Paul,

On Mon, 6 Jul 2015 09:42:47 -0400 Paul Gortmaker paul.gortma...@windriver.com 
wrote:

 [Re: [PATCH] staging: board: Kconfig: Let STAGING_BOARD depend on 
 CLKDEV_LOOKUP] On 06/07/2015 (Mon 08:48) Stephen Rothwell wrote:
 
  On Sun, 5 Jul 2015 18:57:51 +0200 Geert Uytterhoeven ge...@linux-m68k.org 
  wrote:
  
   On Sat, Jul 4, 2015 at 11:35 PM, Chen Gang xili_gchen_5...@hotmail.com 
   wrote:
It needs clk_add_alias() from clk drivers, which is implemented in
drivers/clk/clkdev.c which depends on CLKDEV_LOOKUP.
   
Normally, archs and clk driver its own will decide whether select
CLKDEV_LOOKUP, and common drivers will decide whether depend on it.
   
The related error (with allmodconfig under cris for next-20150702):
   
  drivers/built-in.o: In function `board_staging_register_clock':
  drivers/staging/board/board.c:131: undefined reference to 
`clk_add_alias'
   
   
Signed-off-by: Chen Gang gang.chen.5...@gmail.com
   
   Fix available for the last 15 days:
   
   https://lkml.org/lkml/2015/6/20/215
  
  I added Chen's patch to my fixes tree today (only because I couldn't
  easily find a copy of Paul's patch (sorry Paul) i.e. how does one get a
  full mail message from lkml.org?  Or Geert, maybe that is not the best
  place to link to.
 
 I have had reasonable success pulling stuff out of lkml patchworks:
 
 https://patchwork.kernel.org/patch/6651831/
 
 BTW, Chen's patch is missing the OF_IRQ dependency Geert found in
 his build coverage; I'd folded that into the v2 above, figuring
 that is what he'd desired I do with it.

I have replaced Chen's patch with your patch in my fixes tree ...
hopefully it won;t need to be there long.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpbvCvKGzZh9.pgp
Description: OpenPGP digital signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv3 08/16] staging: vme_user: provide DMA functionality

2015-07-06 Thread Martyn Welch



On 06/07/15 14:50, Dmitry Kalinkin wrote:

On Mon, Jul 6, 2015 at 4:22 PM, Martyn Welch martyn.we...@ge.com wrote:


Sorry about the *really* late reply, loads of emails some how missed my
periodic search of the mailing list.

I'm happy with the addition of DMA, just not sure whether it's worth adding
an extra device file just to handle DMA. Could the user space application
not just use the control device?

That would require an additional ioctl field for DMA channel id in case we want
to support both DMA channels on tsi148.



Or just dynamically allocate and free a resource for the DMA operation?


It would make sense to save that device minor if Documentation/devices.txt
was good.
But it has only 4 slave and 4 master windows whereas we would want to
make some parameters for vme_user to configure this allocation numbers up
to 8 slaves and 8 masters.



The vme_user module was originally envisaged as a mechanism to provide 
support for applications that had been written to use the original 
driver at vmelinux.org. Some functionality was dropped as it was not 
good practice (such as receiving VME interrupts in user space, it's not 
really doable if the slave card is Release On Register Access rather 
than Release on Acknowledge), so the interface became more of a debug 
mechanism for me. Others have clearly found it provides enough for them 
to allow drivers to be written in user space.


I was thinking that the opposite might be better, no windows were mapped 
at module load, windows could be allocated and mapped using the control 
device. This would ensure that unused resources were still available for 
kernel based drivers and would mean the driver wouldn't be 
pre-allocating a bunch of fairly substantially sized slave window 
buffers (the buffers could also be allocated to match the size of the 
slave window requested). What do you think?



--
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel