RE: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets
> From: David Miller [mailto:da...@davemloft.net] > Sent: Saturday, May 7, 2016 1:04 > To: Dexuan Cui > Cc: gre...@linuxfoundation.org; net...@vger.kernel.org; linux- > ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de; > a...@canonical.com; jasow...@redhat.com; cav...@redhat.com; KY > Srinivasan ; Haiyang Zhang ; > j...@perches.com; vkuzn...@redhat.com > Subject: Re: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets > > From: Dexuan Cui > Date: Wed, 4 May 2016 09:56:57 -0700 > > > +#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 > ... > > +struct hvsock_sock { > ... > > + /* The 'hdr' and 'buf' in the below 'send' and 'recv' definitions must > > +* be consecutive: see hvsock_send_data() and hvsock_recv_data(). > > +*/ > > + struct { > > + struct vmpipe_proto_header hdr; > > + u8 buf[HVSOCK_SND_BUF_SZ]; > > + } send; > > + > > + struct { > > + struct vmpipe_proto_header hdr; > > + u8 buf[HVSOCK_RCV_BUF_SZ]; > > + > > + unsigned int data_len; > > + unsigned int data_offset; > > + } recv; > > I don't think allocating 5 pages of unswappable memory for every Hyper-V > socket > created is reasonable. Thanks for the comment, David! I should be able to make 'send', 'recv' here to pointers and use vmalloc() to allocate the memory for them. I will do this. Thanks, -- Dexuan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: android: gio: fixes a variable type issue and tabbing issues
Fixes issues with the coding style checks. Signed-off-by: Thimo Braker --- drivers/staging/android/timed_gpio.c | 36 +- drivers/staging/android/timed_gpio.h | 8 drivers/staging/android/timed_output.c | 16 +++ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index 914fd10..61fbed7 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -26,17 +26,17 @@ #include "timed_gpio.h" struct timed_gpio_data { - struct timed_output_dev dev; - struct hrtimer timer; - spinlock_t lock; - unsigned gpio; - int max_timeout; - u8 active_low; + struct timed_output_dev dev; + struct hrtimer timer; + spinlock_t lock; + unsigned intgpio; + int max_timeout; + u8 active_low; }; static enum hrtimer_restart gpio_timer_func(struct hrtimer *timer) { - struct timed_gpio_data *data = + struct timed_gpio_data *data = container_of(timer, struct timed_gpio_data, timer); gpio_direction_output(data->gpio, data->active_low ? 1 : 0); @@ -45,8 +45,8 @@ static enum hrtimer_restart gpio_timer_func(struct hrtimer *timer) static int gpio_get_time(struct timed_output_dev *dev) { - struct timed_gpio_data *data; - ktime_t t; + struct timed_gpio_data *data; + ktime_t t; data = container_of(dev, struct timed_gpio_data, dev); @@ -60,9 +60,9 @@ static int gpio_get_time(struct timed_output_dev *dev) static void gpio_enable(struct timed_output_dev *dev, int value) { - struct timed_gpio_data *data = + struct timed_gpio_data *data = container_of(dev, struct timed_gpio_data, dev); - unsigned long flags; + unsigned long flags; spin_lock_irqsave(&data->lock, flags); @@ -84,10 +84,10 @@ static void gpio_enable(struct timed_output_dev *dev, int value) static int timed_gpio_probe(struct platform_device *pdev) { - struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; - struct timed_gpio *cur_gpio; - struct timed_gpio_data *gpio_data, *gpio_dat; - int i, ret; + struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; + struct timed_gpio *cur_gpio; + struct timed_gpio_data *gpio_data, *gpio_dat; + int i, ret; if (!pdata) return -EBUSY; @@ -139,9 +139,9 @@ err_out: static int timed_gpio_remove(struct platform_device *pdev) { - struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; - struct timed_gpio_data *gpio_data = platform_get_drvdata(pdev); - int i; + struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; + struct timed_gpio_data *gpio_data = platform_get_drvdata(pdev); + int i; for (i = 0; i < pdata->num_gpios; i++) { timed_output_dev_unregister(&gpio_data[i].dev); diff --git a/drivers/staging/android/timed_gpio.h b/drivers/staging/android/timed_gpio.h index d29e169..2068c8f 100644 --- a/drivers/staging/android/timed_gpio.h +++ b/drivers/staging/android/timed_gpio.h @@ -19,15 +19,15 @@ #define TIMED_GPIO_NAME "timed-gpio" struct timed_gpio { - const char *name; - unsignedgpio; + const char *name; + unsigned intgpio; int max_timeout; u8 active_low; }; struct timed_gpio_platform_data { - int num_gpios; - struct timed_gpio *gpios; + int num_gpios; + struct timed_gpio *gpios; }; #endif diff --git a/drivers/staging/android/timed_output.c b/drivers/staging/android/timed_output.c index aff9cdb..05d9863 100644 --- a/drivers/staging/android/timed_output.c +++ b/drivers/staging/android/timed_output.c @@ -25,14 +25,14 @@ #include "timed_output.h" -static struct class *timed_output_class; -static atomic_t device_count; +static struct class*timed_output_class; +static atomic_tdevice_count; static ssize_t enable_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct timed_output_dev *tdev = dev_get_drvdata(dev); - int remaining = tdev->get_time(tdev); + struct timed_output_dev *tdev = dev_get_drvdata(dev); + int remaining = tdev->get_time(tdev); return sprintf(buf, "%d\n", remaining); } @@ -40,9 +40,9 @@ static ssize_t enable_show(struct device *dev, struct device_attribute *attr, static ssize_t enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t
Re: [PATCH] Staging: android: gio: fixes a variable type issue and tabbing issues
On Sat, May 07, 2016 at 10:56:37AM -0500, Thimo Braker wrote: > Fixes issues with the coding style checks. What issues? Always be specific, and describe what you are doing. Also don't put more than one "thing" in a single patch (hint, "coding style cleanups" are not one thing.) > > Signed-off-by: Thimo Braker > --- > drivers/staging/android/timed_gpio.c | 36 > +- > drivers/staging/android/timed_gpio.h | 8 > drivers/staging/android/timed_output.c | 16 +++ These files are not in linux-next, please always work from that, they have been gone from my tree for months now :( thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets
From: Dexuan Cui Date: Sat, 7 May 2016 10:49:25 + > I should be able to make 'send', 'recv' here to pointers and use vmalloc() > to allocate the memory for them. I will do this. That's still unswappable kernel memory. People can open N sockets, where N is something on the order of the FD limit the process has, per process. This allows someone to quickly eat up a lot of memory and hold onto it nearly indefinitely. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[GIT PULL] Staging driver fixes for 4.6-rc7
The following changes since commit bf16200689118d19de1b8d2a3c314fc21f5dc7bb: Linux 4.6-rc3 (2016-04-10 17:58:30 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ tags/staging-4.6-rc7 for you to fetch changes up to 2b86c4a84377b74a6ec0ec9463feb0803bcb1066: Merge tag 'iio-fixes-for-4.6d' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus (2016-05-05 15:38:07 -0700) Staging/IIO driver fixes for 4.6-rc7 Well, it's really just IIO drivers here, some small fixes that resolve some "crash on boot" errors that have shown up in the -rc series, and other bugfixes that are required. All have been in linux-next with no reported problems. Signed-off-by: Greg Kroah-Hartman Daniel Baluta (1): iio: imu: mpu6050: Fix name/chip_id when using ACPI Greg Kroah-Hartman (2): Merge tag 'iio-fixes-for-4.6c' of git://git.kernel.org/.../jic23/iio into staging-linus Merge tag 'iio-fixes-for-4.6d' of git://git.kernel.org/.../jic23/iio into staging-linus Krzysztof Kozlowski (1): iio: ak8975: Fix NULL pointer exception on early interrupt Marek Vasut (1): iio:adc:at91-sama5d2: Repair crash on module removal Matt Ranostay (1): iio: imu: mpu6050: fix possible NULL dereferences Richard Leitner (1): iio: ak8975: fix maybe-uninitialized warning drivers/iio/adc/at91-sama5d2_adc.c| 2 ++ drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 30 +++--- drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 3 ++- drivers/iio/magnetometer/ak8975.c | 6 +++--- 4 files changed, 34 insertions(+), 7 deletions(-) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: android: gio: fixes a variable type issue and tabbing issues
Thanks for the reply. Will give that a check. :) Got pointed to torvalds/linux-2.6 by some other guy. Will have a look in the other repo. Also, would you rather have me send a patch for every type (eg tabbing fix, capital fix, spelling fix, 80-char fix, etc)? (Just to be sure I properly understood you.) Thanks, Thimo B. On 7-5-2016 19:15, Greg KH wrote: On Sat, May 07, 2016 at 10:56:37AM -0500, Thimo Braker wrote: Fixes issues with the coding style checks. What issues? Always be specific, and describe what you are doing. Also don't put more than one "thing" in a single patch (hint, "coding style cleanups" are not one thing.) Signed-off-by: Thimo Braker --- drivers/staging/android/timed_gpio.c | 36 +- drivers/staging/android/timed_gpio.h | 8 drivers/staging/android/timed_output.c | 16 +++ These files are not in linux-next, please always work from that, they have been gone from my tree for months now :( thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: android: gio: fixes a variable type issue and tabbing issues
A: No. Q: Should I include quotations after my reply? http://daringfireball.net/2007/07/on_top On Sat, May 07, 2016 at 08:05:22PM +0200, Thimo Braker wrote: > Thanks for the reply. > Will give that a check. :) > Got pointed to torvalds/linux-2.6 by some other guy. > > Will have a look in the other repo. > Also, would you rather have me send a patch for every type (eg tabbing fix, > capital fix, spelling fix, 80-char fix, etc)? (Just to be sure I properly > understood you.) Yes, a patch should only do one thing. Look at the patches sent the driverdevel mailing list for examples of this. thanks, greg kh ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] Staging: android: ion: fixes use of typedef
Fixes a checkpatch.pl warning about 'do not add new typedefs' Signed-off-by: Thimo Braker --- drivers/staging/android/uapi/ion.h | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h index 0a8e40f..77a46f0 100644 --- a/drivers/staging/android/uapi/ion.h +++ b/drivers/staging/android/uapi/ion.h @@ -20,8 +20,6 @@ #include #include -typedef int ion_user_handle_t; - /** * enum ion_heap_types - list of all possible types of heaps * @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc @@ -95,7 +93,7 @@ struct ion_allocation_data { size_t align; unsigned int heap_id_mask; unsigned int flags; - ion_user_handle_t handle; + int handle; }; /** @@ -109,7 +107,7 @@ struct ion_allocation_data { * provides the file descriptor and the kernel returns the handle. */ struct ion_fd_data { - ion_user_handle_t handle; + int handle; int fd; }; @@ -118,7 +116,7 @@ struct ion_fd_data { * @handle:a handle */ struct ion_handle_data { - ion_user_handle_t handle; + int handle; }; /** -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: android: gio: fixes a variable type issue and tabbing issues
Q: Should I include quotations after my reply? Sorry about that, will do. Look at the patches sent the driverdevel mailing list for examples of this. Just subscribed to that mailing list, will keep an eye out for proper patch mails. Thanks, Thimo B. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] Staging: android: ion: fixes indentation
Fixes indentation before variable names. Signed-off-by: Thimo Braker --- drivers/staging/android/uapi/ion.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h index 77a46f0..ddb8174 100644 --- a/drivers/staging/android/uapi/ion.h +++ b/drivers/staging/android/uapi/ion.h @@ -89,11 +89,11 @@ enum ion_heap_type { * Provided by userspace as an argument to the ioctl */ struct ion_allocation_data { - size_t len; - size_t align; + size_t len; + size_t align; unsigned int heap_id_mask; unsigned int flags; - int handle; + int handle; }; /** @@ -128,7 +128,7 @@ struct ion_handle_data { * This works just like the regular cmd and arg fields of an ioctl. */ struct ion_custom_data { - unsigned int cmd; + unsigned int cmd; unsigned long arg; }; -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] Staging: emxx_udc: emxx_udc: fixed coding style issue
fixed checkpatch.pl warning about 'Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: Shyam Saini --- drivers/staging/emxx_udc/emxx_udc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 58e189b7..3bd9175 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -3051,7 +3051,7 @@ static int nbu2ss_gad_vbus_session(struct usb_gadget *pgadget, int is_active) } /*-*/ -static int nbu2ss_gad_vbus_draw(struct usb_gadget *pgadget, unsigned mA) +static int nbu2ss_gad_vbus_draw(struct usb_gadget *pgadget, unsigned int mA) { struct nbu2ss_udc *udc; unsigned long flags; @@ -3101,7 +3101,7 @@ static int nbu2ss_gad_pullup(struct usb_gadget *pgadget, int is_on) /*-*/ static int nbu2ss_gad_ioctl( struct usb_gadget *pgadget, - unsigned code, + unsigned int code, unsigned long param) { return 0; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/gdm724x: fix "alignment should match open parenthesis" issues
Fix checkpatch issues: "CHECK: Alignment should match open parenthesis" Signed-off-by: Bruno Carvalho --- drivers/staging/gdm724x/gdm_mux.c | 5 +++-- drivers/staging/gdm724x/netlink_k.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/gdm724x/gdm_mux.c b/drivers/staging/gdm724x/gdm_mux.c index 6bedd66..4009691 100644 --- a/drivers/staging/gdm724x/gdm_mux.c +++ b/drivers/staging/gdm724x/gdm_mux.c @@ -278,8 +278,9 @@ static void gdm_mux_rcv_complete(struct urb *urb) } } -static int gdm_mux_recv(void *priv_dev, int (*cb)(void *data, int len, - int tty_index, struct tty_dev *tty_dev, int complete)) +static int gdm_mux_recv(void *priv_dev, + int (*cb)(void *data, int len, int tty_index, + struct tty_dev *tty_dev, int complete)) { struct mux_dev *mux_dev = priv_dev; struct usb_device *usbdev = mux_dev->usbdev; diff --git a/drivers/staging/gdm724x/netlink_k.c b/drivers/staging/gdm724x/netlink_k.c index 9d83477..a0232e8 100644 --- a/drivers/staging/gdm724x/netlink_k.c +++ b/drivers/staging/gdm724x/netlink_k.c @@ -88,7 +88,8 @@ static void netlink_rcv(struct sk_buff *skb) } struct sock *netlink_init(int unit, - void (*cb)(struct net_device *dev, u16 type, void *msg, int len)) + void (*cb)(struct net_device *dev, u16 type, +void *msg, int len)) { struct sock *sock; struct netlink_kernel_cfg cfg = { -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/gdm724x: Fix avoid CamelCase
Fix checkpatch issues: "CHECK: Avoid CamelCase" Signed-off-by: Bruno Carvalho --- drivers/staging/gdm724x/gdm_usb.c| 6 +++--- drivers/staging/gdm724x/hci_packet.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c index 9db9b90..d650d77 100644 --- a/drivers/staging/gdm724x/gdm_usb.c +++ b/drivers/staging/gdm724x/gdm_usb.c @@ -708,7 +708,7 @@ static void do_tx(struct work_struct *work) #define SDU_PARAM_LEN 12 static int gdm_usb_sdu_send(void *priv_dev, void *data, int len, - unsigned int dftEpsId, unsigned int epsId, + unsigned int dft_eps_ID, unsigned int eps_ID, void (*cb)(void *data), void *cb_data, int dev_idx, int nic_type) { @@ -746,8 +746,8 @@ static int gdm_usb_sdu_send(void *priv_dev, void *data, int len, } sdu->len = gdm_cpu_to_dev16(&udev->gdm_ed, send_len); - sdu->dftEpsId = gdm_cpu_to_dev32(&udev->gdm_ed, dftEpsId); - sdu->bearer_ID = gdm_cpu_to_dev32(&udev->gdm_ed, epsId); + sdu->dft_eps_ID = gdm_cpu_to_dev32(&udev->gdm_ed, dft_eps_ID); + sdu->bearer_ID = gdm_cpu_to_dev32(&udev->gdm_ed, eps_ID); sdu->nic_type = gdm_cpu_to_dev32(&udev->gdm_ed, nic_type); t_sdu->len = send_len + HCI_HEADER_SIZE; diff --git a/drivers/staging/gdm724x/hci_packet.h b/drivers/staging/gdm724x/hci_packet.h index 7fba8a6..dbc4446 100644 --- a/drivers/staging/gdm724x/hci_packet.h +++ b/drivers/staging/gdm724x/hci_packet.h @@ -58,7 +58,7 @@ struct sdu_header { struct sdu { u16 cmd_evt; u16 len; - u32 dftEpsId; + u32 dft_eps_ID; u32 bearer_ID; u32 nic_type; u8 data[0]; -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/2] Staging: android: ion: fixes use of typedef
On Sat, May 07, 2016 at 03:22:03PM -0500, Thimo Braker wrote: > Fixes a checkpatch.pl warning about 'do not add new typedefs' > > Signed-off-by: Thimo Braker > --- > drivers/staging/android/uapi/ion.h | 8 +++- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/android/uapi/ion.h > b/drivers/staging/android/uapi/ion.h > index 0a8e40f..77a46f0 100644 > --- a/drivers/staging/android/uapi/ion.h > +++ b/drivers/staging/android/uapi/ion.h > @@ -20,8 +20,6 @@ > #include > #include > > -typedef int ion_user_handle_t; > - You just broke userspace :( Sorry, you can't do this, be careful when touching files that cross the user/kernel boundry (hint, they have uapi in the path), you have to know exactly what you are doing when you do that. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] Staging: android: ion: fixes indentation
On Sat, May 07, 2016 at 03:33:04PM -0500, Thimo Braker wrote: > Fixes indentation before variable names. > > Signed-off-by: Thimo Braker > --- > drivers/staging/android/uapi/ion.h | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/android/uapi/ion.h > b/drivers/staging/android/uapi/ion.h > index 77a46f0..ddb8174 100644 > --- a/drivers/staging/android/uapi/ion.h > +++ b/drivers/staging/android/uapi/ion.h > @@ -89,11 +89,11 @@ enum ion_heap_type { > * Provided by userspace as an argument to the ioctl > */ > struct ion_allocation_data { > - size_t len; > - size_t align; > + size_t len; > + size_t align; > unsigned int heap_id_mask; > unsigned int flags; > - int handle; > + int handle; > }; > > /** > @@ -128,7 +128,7 @@ struct ion_handle_data { > * This works just like the regular cmd and arg fields of an ioctl. > */ > struct ion_custom_data { > - unsigned int cmd; > + unsigned int cmd; > unsigned long arg; > }; > Doesn't apply as I didn't take path 1/2 :( ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/gdm724x: Use tty_alloc_driver instead of alloc_tty_driver
- alloc_tty_driver() is deprecated. So it is replaced by tty_alloc_driver() Signed-off-by: Bruno Carvalho --- drivers/staging/gdm724x/gdm_tty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/gdm724x/gdm_tty.c b/drivers/staging/gdm724x/gdm_tty.c index eb7e252..c0888f5 100644 --- a/drivers/staging/gdm724x/gdm_tty.c +++ b/drivers/staging/gdm724x/gdm_tty.c @@ -306,7 +306,9 @@ int register_lte_tty_driver(void) int ret; for (i = 0; i < TTY_MAX_COUNT; i++) { - tty_driver = alloc_tty_driver(GDM_TTY_MINOR); + tty_driver = tty_alloc_driver(GDM_TTY_MINOR, + TTY_DRIVER_REAL_RAW | + TTY_DRIVER_DYNAMIC_DEV); if (!tty_driver) return -ENOMEM; -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets
> From: David Miller [mailto:da...@davemloft.net] > Sent: Sunday, May 8, 2016 1:41 > To: Dexuan Cui > Cc: gre...@linuxfoundation.org; net...@vger.kernel.org; linux- > ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de; > a...@canonical.com; jasow...@redhat.com; cav...@redhat.com; KY > Srinivasan ; Haiyang Zhang ; > j...@perches.com; vkuzn...@redhat.com > Subject: Re: [PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets > > From: Dexuan Cui > Date: Sat, 7 May 2016 10:49:25 + > > > I should be able to make 'send', 'recv' here to pointers and use vmalloc() > > to allocate the memory for them. I will do this. > > That's still unswappable kernel memory. Hi David, My understanding is: kernel pages are not swappable in Linux, so it looks I can't avoid unswappable kernel memory here? > People can open N sockets, where N is something on the order of the FD > limit the process has, per process. This allows someone to quickly > eat up a lot of memory and hold onto it nearly indefinitely. Thanks for pointing this out! I understand, so I think I should add a module parameter, e.g., "hv_sock.max_socket_number" with a default value, say, 1024? 1 established hv_sock connection takes less than 20 pages, including 10 pages for VMBus ringbuffer, 6 pages for send/recv buffers(I'll use vmalloc() for this), etc. Here the recv buf needs a size of 5 pages because potentially the host can send the guest a VMBus packet with an up-to-5-page payload, i..e, the VMBus inbound ringbuffer size. 1024 hv_sock connections take less than 20*4KB * 1K = 80MB memory. A user who needs more connections can change the module parameter without reboot. hv_sock connection is designed to work only between the host and the guest. I think 1024 connections seem pretty enough. BTW, a user can't create hv_sock connections without enough privilege. Please see +static int hvsock_create(struct net *net, struct socket *sock, +int protocol, int kern) +{ + if (!capable(CAP_SYS_ADMIN) && !capable(CAP_NET_ADMIN)) + return -EPERM; David, does this make sense to you? Thanks, -- Dexuan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel