[PATCH] mm/util.c: add a none zero check of len

2015-01-19 Thread Pan Xinhui
Although this check should have been done by caller. But as it's exported to others, It's better to add a none zero check of len like other functions. Signed-off-by: xinhuix.pan xinhuix@intel.com --- mm/util.c | 5 + 1 file changed, 5 insertions(+) diff --git a/mm/util.c b/mm/util.c

Re: [PATCH] mm/util.c: add a none zero check of len

2015-01-21 Thread Pan Xinhui
On 2015年01月22日 07:09, David Rientjes wrote: On Tue, 20 Jan 2015, Pan Xinhui wrote: Although this check should have been done by caller. But as it's exported to others, It's better to add a none zero check of len like other functions. Signed-off-by: xinhuix.pan xinhuix@intel.com --- mm

[PATCH v2 RESEND] tty/n_gsm.c: fix a memory leak when gsmtty is removed

2015-03-26 Thread Pan Xinhui
; | tty_kref_put --- release_one_tty - gsmtty_cleanup (added by our patch) So our patch fix the memory leak by doing the cleanup work after tty core did. Signed-off-by: Pan Xinhui xinhuix@intel.com --- Changes in v2: Don't use schedule_work to put dlci. Replace

[PATCH] tty/n_gsm.c: fix a memory leak when gsmtty is removed

2015-03-23 Thread Pan Xinhui
In gsmtty_remove, we will put dlci. when dlci's ref-count is zero, tty_port_destructor will be called, and it will check if port-itty is NULL. However port-itty will be set to NULL in release_tty after gsmtty_remove. that may cause memory leak. so we use queue_work to put the dlci later.

[PATCH v2] tty/n_gsm.c: fix a memory leak when gsmtty is removed

2015-03-24 Thread Pan Xinhui
when gsmtty_remove put dlci, it will cause memory leak if dlci-port's refcount is zero. So we do the cleanup work in .cleanup callback instead. dlci will be last put in two call chains. 1) gsmld_close - gsm_cleanup_mux - gsm_dlci_release - dlci_put 2) gsmld_remove - dlci_put so there is a race.

[PATCH] tty/n_gsm.c: fix a memory leak when gsmtty is removed

2015-03-23 Thread Pan Xinhui
In gsmtty_remove, we will put dlci. when dlci's ref-count is zero, tty_port_destructor will be called, and it will check if port-itty is NULL. However port-itty will be set to NULL in release_tty after gsmtty_remove. that may cause memory leak. so we use queue_work to put the dlci later.

Re: [PATCH] tty/n_gsm.c: fix a memory leak when gsmtty is removed

2015-03-23 Thread Pan Xinhui
hi, Jiri thanks for your kind reply, and the nice advices. :) On 2015年03月23日 23:23, Jiri Slaby wrote: On 03/24/2015, 08:22 AM, Pan Xinhui wrote: In gsmtty_remove, we will put dlci. when dlci's ref-count is zero, tty_port_destructor will be called, and it will check if port-itty is NULL

[PATCH] touchscreen:atmel_mxt_ts: suspend/resume cause panic if input_dev fails to init

2015-04-22 Thread Pan Xinhui
input_dev may be NULL if mxt_initialize_input_device fails. But pm ops is still available and suspend/resume assume input_dev is not NULL. To fix this issue, we add a check if (!input_dev). Signed-off-by: xinhui.pan xinhuix@intel.com --- drivers/input/touchscreen/atmel_mxt_ts.c | 6 ++

[PATCH] atmel: fix an error handle in mxt_probe

2015-04-21 Thread Pan Xinhui
mxt_probe() may fail at last step, and the queue_work scheduled by request_firmware_nowait may run later and then access some data which is freed. To handle this error, add one mutex_lock to cover such case. It may cause module load delay only when the probe fails. here is the detail. module

Re: [PATCH V2] atmel: fix a race between fw_load and data free

2015-05-14 Thread Pan Xinhui
hi, yes, we can't guarantee MXT_FW_RESET_TIME is enough. patch v3 is sent out :) thanks xinhui On 2015年05月14日 19:31, Nick Dyer wrote: Hi- This looks like a good tidy up, one minor comment: On 15/05/15 12:19, Pan Xinhui wrote: +mxt_wait_for_completion(data, data

[PATCH V3] atmel: fix a race between fw_load and data free

2015-05-14 Thread Pan Xinhui
mxt_probe() may fail at last step, or we jsut unload mxt module soon. the queue_work scheduled by request_firmware_nowait may run later, and then access some data which is freed. To handle this issue, add fw_load_completion field in mxt_data. then we wait for it complete both in probe error path

[PATCH V2] atmel: fix a race between fw_load and data free

2015-05-14 Thread Pan Xinhui
mxt_probe() may fail at last step, or we jsut unload mxt module soon. the queue_work scheduled by request_firmware_nowait may run later, and then access some data which is freed. To handle this issue, add fw_load_completion field in mxt_data. then we wait for it complete both in probe error path

Re: [PATCH] atmel: fix an error handle in mxt_probe

2015-05-13 Thread Pan Xinhui
HI, Dmitry thanks for your reply :) On 2015年05月14日 01:41, Dmitry Torokhov wrote: Hi, On Wed, Apr 22, 2015 at 06:46:58PM +0800, Pan Xinhui wrote: mxt_probe() may fail at last step, and the queue_work scheduled by request_firmware_nowait may run later and then access some data which

[PATCH] lib/bitmap.c: add some check to correct the parse result

2015-06-26 Thread Pan Xinhui
. Signed-off-by: Pan Xinhui xinhuix@intel.com --- lib/bitmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/bitmap.c b/lib/bitmap.c index 64c0926..3c489c1 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -561,6 +561,8 @@ static int __bitmap_parselist(const char *buf, unsigned int

Re: [PATCH] ACPI / osl: add acpi_os_down_wait to avoid a schedule BUG

2015-06-02 Thread Pan Xinhui
[ 1148.606208, 1] [810ab8d0] ? kthread_create_on_node+0x190/0x190 [ 1148.613721, 1] [81a044c8] ret_from_fork+0x58/0x90 [ 1148.619967, 1] [810ab8d0] ? kthread_create_on_node+0x190/0x190 Signed-off-by: Pan Xinhui xinhuix@intel.com --- drivers/acpi/osl.c | 28

[PATCH] ACPI / osl: add acpi_os_down_wait to avoid a schedule BUG

2015-05-27 Thread Pan Xinhui
[ 1148.600455, 1] [810ab9b4] kthread+0xe4/0x100 [ 1148.606208, 1] [810ab8d0] ? kthread_create_on_node+0x190/0x190 [ 1148.613721, 1] [81a044c8] ret_from_fork+0x58/0x90 [ 1148.619967, 1] [810ab8d0] ? kthread_create_on_node+0x190/0x190 Signed-off-by: Pan Xinhui xinhuix

Re: [PATCH] ACPI / osl: add acpi_os_down_wait to avoid a schedule BUG

2015-05-27 Thread Pan Xinhui
] cpu_notify+0x23/0x50 [ 722.033757, 2] [81089068] notify_cpu_starting+0x28/0x30 [ 722.040569, 2] [8102fcff] start_secondary+0x15f/0x2d0 [ 722.047185, 2]bad: scheduling from the idle thread! any comments are welcome. :) thanks, xinhui On 2015年05月28日 14:33, Pan Xinhui wrote

[PATCH 1/3, RESEND] lib/bitmap.c: correct a code style and do some, optimization

2015-07-01 Thread Pan Xinhui
We can avoid in-loop incrementation of ndigits. Save current totaldigits to ndigits before loop, and check ndigits against totaldigits after the loop. Signed-off-by: Pan Xinhui xinhuix@intel.com Cc: Yury Norov yury.no...@gmail.com --- lib/bitmap.c | 7 --- 1 file changed, 4 insertions

[PATCH 2/3, RESEND] lib/bitmap.c: fix a special string handling bug in __bitmap_parselist

2015-07-01 Thread Pan Xinhui
If string end with '-', for exapmle, bitmap_parselist(1,0-,mask, nmaskbits), It is not in a valid pattern, so add a check after loop. Return -EINVAL on such condition. Signed-off-by: Pan Xinhui xinhuix@intel.com --- lib/bitmap.c | 4 1 file changed, 4 insertions(+) diff --git a/lib

[PATCH 3/3, RESEND] lib/bitmap.c: bitmap_parselist can accept string with whitespaces on head or tail

2015-07-01 Thread Pan Xinhui
and reasonable to accept such string as long as the parsing result is correct. Signed-off-by: Pan Xinhui xinhuix@intel.com Cc: Yury Norov yury.no...@gmail.com --- lib/bitmap.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/bitmap.c b/lib

Re: [PATCH V3] lib/bitmap.c: rewrite __bitmap_parse __bitmap_parselist

2015-07-01 Thread Pan Xinhui
-by: Pan Xinhui xinhuix@intel.com --- lib/bitmap.c | 238 +-- 1 file changed, 134 insertions(+), 104 deletions(-) --- change log v3: __bitmap_parselist now allow some extra input, like ,2, 3 5-8, at least one digit inside

[PATCH V2] lib/bitmap.c: rewrite __bitmap_parse __bitmap_parselist

2015-06-30 Thread Pan Xinhui
add __bitmap_parse_common to match any contents and return expected reslut. as __bitmap_parse_common need NULL-terminated string, we alloc a new buf. this patch also fix some parse issues in __bitmap_parselist. now it can handle grouping errors with input like , ,, etc. Signed-off-by: Pan

Re: [PATCH] lib/bitmap.c: return -EINVAL for grouping errors in __bitmap_parselist

2015-06-30 Thread Pan Xinhui
hi, Yury On 2015年06月30日 16:32, Yury Norov wrote: 2015-07-01 4:37 GMT+03:00 Pan Xinhui xinhuix@intel.com: hi, Yury thanks for your nice reply. On 2015年06月29日 21:39, Yury Norov wrote: Sometimes the input from user may cause an unexpected result. Could you please provide

[PATCH] lib/bitmap.c: rewrite __bitmap_parse __bitmap_parselist

2015-06-30 Thread Pan Xinhui
add __bitmap_parse_common to match any contents and return expected result. as __bitmap_parse_common need NULL-terminated string, we alloc a new buf. this patch also fix some parse issues in __bitmap_parselist. now it can handle grouping errors with input like , ,, etc. Signed-off-by:

[PATCH] lib/bitmap.c: fix some parsing issues and code style

2015-06-30 Thread Pan Xinhui
) if input has '0-', bit 0 might be set unexpectedly, now we return -EINVAL as this kind of input is definitely wrong. 3) minor code style fix in __bitmap_parse. and avoid in-loop incrementation of ndigits. Signed-off-by: Pan Xinhui xinhuix@intel.com --- lib/bitmap.c | 34

Re: [PATCH V3] lib/bitmap.c: rewrite __bitmap_parse __bitmap_parselist

2015-06-30 Thread Pan Xinhui
hi, all after a deep think, allocing a new buf is ugly. new patch lib/bitmap.c: fix some parsing issues and code style is sent out. any comments is welcome. :) thanks xinhui On 2015年06月30日 18:02, Pan Xinhui wrote: add __bitmap_parse_common to match any contents and return expected

[PATCH 1/3] lib/bitmap.c: correct a code style and do some optimization in __bitmap_parse

2015-07-01 Thread Pan Xinhui
We can avoid in-loop incrementation of ndigits. Save current totaldigits to ndigits before loop, and check ndigits against totaldigits after the loop. Signed-off-by: Pan Xinhui xinhuix@intel.com Cc: Yury Norov yury.no...@gmail.com --- lib/bitmap.c | 7 --- 1 file changed, 4 insertions

[PATCH 3/3] lib/bitmap.c: bitmap_parselist can accept string with whitespaces on head or tail

2015-07-01 Thread Pan Xinhui
and reasonable to accept such string as long as the parsing result is correct. Signed-off-by: Pan Xinhui xinhuix@intel.com Cc: Yury Norov yury.no...@gmail.com --- lib/bitmap.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/bitmap.c b/lib

[PATCH 2/3] lib/bitmap.c: fix a special string handling bug in __bitmap_parselist

2015-07-01 Thread Pan Xinhui
If string end with '-', for exapmle, bitmap_parselist(1,0-,mask, nmaskbits), It is not in a valid pattern, so add a check after loop. Return -EINVAL on such condition. Signed-off-by: Pan Xinhui xinhuix@intel.com --- lib/bitmap.c | 4 1 file changed, 4 insertions(+) diff --git a/lib

[PATCH] acpi-cpufreq: use same acpi_cpufreq_data if policy is shared

2015-07-03 Thread Pan Xinhui
cpufreq core will mark all cpus in policy-cpus as initialized by setting percpu cpufreq_cpu_data = policy. However in acpi-cpufreq, we did not set percpu acpi_cpufreq_data for all cpus in policy-cpus. That will cause a issue that when we call get_cur_freq_on_cpu for a cpu, it returns zero instead

[PATCH V3] lib/bitmap.c: rewrite __bitmap_parse __bitmap_parselist

2015-06-30 Thread Pan Xinhui
add __bitmap_parse_common to match any contents and return expected reslut. as __bitmap_parse_common need NULL-terminated string, we alloc a new buf. this patch also fix an unexpected parse result issue in __bitmap_parselist. Signed-off-by: Pan Xinhui xinhuix@intel.com --- lib/bitmap.c

[PATCH V2] lib/bitmap.c: fix some parsing issues and code style

2015-06-30 Thread Pan Xinhui
1 above. Signed-off-by: Pan Xinhui xinhuix@intel.com --- lib/bitmap.c | 43 ++- 1 file changed, 26 insertions(+), 17 deletions(-) --- change log V2 from v1: solve the codes conflicts --- diff --git a/lib/bitmap.c b/lib/bitmap.c index a578a01..b0e3afc

Re: [PATCH V2] lib/bitmap.c: fix some parsing issues and code style

2015-07-01 Thread Pan Xinhui
hello, Frans thanks for your reply :) On 2015年07月01日 14:17, Frans Klaver wrote: On Wed, Jul 1, 2015 at 6:15 AM, Pan Xinhui xinhuix@intel.com wrote: In __bitmap_parselist we can accept whitespaces on head or tail during every parsing procedure. If input has valid ranges

[PATCH] acpi-cpufreq.c: fix a memory leak in acpi_cpufreq_cpu_exit

2015-07-06 Thread Pan Xinhui
of acpi_cpufreq_data. Add field *cpu* in acpi_cpufreq_data to do some proper cleanup work. Signed-off-by: Pan Xinhui xinhuix@intel.com --- drivers/cpufreq/acpi-cpufreq.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi

Re: [PATCH] acpi-cpufreq.c: fix a memory leak in acpi_cpufreq_cpu_exit

2015-07-07 Thread Pan Xinhui
hi, Viresh thanks for your reply. On 2015年07月07日 14:54, Viresh Kumar wrote: On 06-07-15, 14:30, Pan Xinhui wrote: policy-cpu in acpi_cpufreq_cpu_init/exit is the same cpu in most cases. However during cpu hotplug, cpufreq core might nominate a new cpu for policy-cpu. Why aren't

Re: [PATCH] printk: rebalance printk

2015-08-11 Thread Pan Xinhui
Hi, Greg thanks for your reply! On 2015年08月12日 02:16, Greg Kroah-Hartman wrote: On Tue, Aug 11, 2015 at 07:23:01PM +0800, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com printk can be called in any context, It's very useful to output debug info. But it might cause very bad

Re: [PATCH] printk: rebalance printk

2015-08-11 Thread Pan Xinhui
On 2015年08月12日 10:04, Greg Kroah-Hartman wrote: On Wed, Aug 12, 2015 at 09:53:58AM +0800, Pan Xinhui wrote: Hi, Greg thanks for your reply! On 2015年08月12日 02:16, Greg Kroah-Hartman wrote: On Tue, Aug 11, 2015 at 07:23:01PM +0800, Pan Xinhui wrote: From: Pan Xinhui xinhuix

Re: [PATCH] printk: rebalance printk

2015-08-12 Thread Pan Xinhui
On 2015年08月12日 20:31, Peter Hurley wrote: On 08/11/2015 02:16 PM, Greg Kroah-Hartman wrote: On Tue, Aug 11, 2015 at 07:23:01PM +0800, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com printk can be called in any context, It's very useful to output debug info. But it might cause

[PATCH] lib/bitmap.c: return -EINVAL for grouping errors in __bitmap_parselist

2015-06-29 Thread Pan Xinhui
Sometimes the input from user may cause an unexpected result. just like __bitmap_parse, we return -EINVAL if there is no avaiable digit in each parsing procedures. Signed-off-by: Pan Xinhui xinhuix@intel.com --- lib/bitmap.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions

Re: [PATCH] lib/bitmap.c: return -EINVAL for grouping errors in __bitmap_parselist

2015-06-29 Thread Pan Xinhui
this command ends with ',' by mistake. actually __bitmap_parselist() will report 0-3 for the final result which is wrong. just like __bitmap_parse, we return -EINVAL if there is no avaiable digit in each parsing procedures. Signed-off-by: Pan Xinhui xinhuix@intel.com Hello, Pan. (Adding Alexey

[PATCH V2] cpufreq: Add scaling frequency range support

2015-07-28 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com Userspace at most time do cpufreq tests very much inconveniently. Currently they have to echo min and max cpu freq separately like below: echo 48 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq echo 224 /sys/devices/system/cpu/cpu0/cpufreq

Re: [PATCH] cpufreq: Add scaling frequency range support

2015-07-29 Thread Pan Xinhui
hi, Rafael thanks for you reply. On 2015年07月29日 08:18, Rafael J. Wysocki wrote: On Tuesday, July 28, 2015 12:53:33 PM Pan Xinhui wrote: hi, Viresh thanks for your reply :) On 2015年07月28日 12:29, Viresh Kumar wrote: On 28-07-15, 11:32, Pan Xinhui wrote: From: Pan Xinhui xinhuix

Re: [PATCH] cpufreq: Add scaling frequency range support

2015-07-29 Thread Pan Xinhui
On 2015年07月29日 17:59, Pan Xinhui wrote: hi, Rafael thanks for you reply. On 2015年07月29日 08:18, Rafael J. Wysocki wrote: On Tuesday, July 28, 2015 12:53:33 PM Pan Xinhui wrote: hi, Viresh thanks for your reply :) On 2015年07月28日 12:29, Viresh Kumar wrote: On 28-07-15, 11:32, Pan

[PATCH V2] cpufreq: Correct a freq check in cpufreq_set_policy

2015-07-30 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com This check was originally added by commit 9c9a43ed2734 ([CPUFREQ] return error when failing to set minfreq).It attempt to return an error on obviously incorrect limits when we echo xxx .../scaling_max,min_freq Actually we just need check if new_policy-min

[PATCH] printk: rebalance printk

2015-08-11 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com printk can be called in any context, It's very useful to output debug info. But it might cause very bad issues on some special cases. For example, some driver hit errors, and it dumps many messages like reg values, etc. Sometimes, printk is called when

Re: [PATCH] printk: rebalance printk

2015-08-11 Thread Pan Xinhui
, 0664); + thanks xinhui On 2015年08月11日 19:23, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com printk can be called in any context, It's very useful to output debug info. But it might cause very bad issues on some special cases. For example, some driver hit errors, and it dumps

Re: [PATCH] printk: rebalance printk

2015-08-11 Thread Pan Xinhui
hi, Peter thanks for your reply! On 2015年08月11日 20:00, Peter Hurley wrote: On 08/11/2015 07:23 AM, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com printk can be called in any context, It's very useful to output debug info. But it might cause very bad issues on some special

[PATCH V3] printk: rebalance printk

2015-08-12 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com printk can be called in any context, It's very useful to output debug info. But it might cause very bad issues on some special cases. For example, some driver hit errors, and it dumps many messages like reg values, etc. Sometimes, printk is called when

[PATCH V2] printk: rebalance printk

2015-08-12 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com printk can be called in any context, It's very useful to output debug info. But it might cause very bad issues on some special cases. For example, some driver hit errors, and it dumps many messages like reg values, etc. Sometimes, printk is called when

Re: [PATCH V2] printk: rebalance printk

2015-08-12 Thread Pan Xinhui
(auto_printk, 0, XH_T0); +} +module_param_call(th, NULL, xh_th, NULL, 0664); + thanks xinhui On 2015年08月12日 17:37, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com printk can be called in any context, It's very useful to output debug info. But it might cause very bad issues on some

Re: [PATCH] cpufreq: Add scaling frequency range support

2015-07-27 Thread Pan Xinhui
hi, Viresh thanks for your reply :) On 2015年07月28日 12:29, Viresh Kumar wrote: On 28-07-15, 11:32, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com Userspace at most time do cpufreq tests very much inconveniently. Currently they have to echo min and max cpu freq separately like

Re: [PATCH] cpufreq: Correct a freq check in cpufreq_set_policy

2015-07-27 Thread Pan Xinhui
hi, Viresh thanks for your quick reply! :) On 2015年07月28日 12:41, Viresh Kumar wrote: On 28-07-15, 11:34, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com This check was originally added by commit 9c9a43ed2734 ([CPUFREQ] return error when failing to set minfreq).It attempt

[PATCH] cpufreq: Correct a freq check in cpufreq_set_policy

2015-07-27 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com This check was originally added by commit 9c9a43ed2734 ([CPUFREQ] return error when failing to set minfreq).It attempt to return an error on obviously incorrect limits when we echo xxx .../scaling_max,min_freq Actually we just need check if new_policy-min

[PATCH] cpufreq: Add scaling frequency range support

2015-07-27 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com Userspace at most time do cpufreq tests very much inconveniently. Currently they have to echo min and max cpu freq separately like below: echo 48 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq echo 224 /sys/devices/system/cpu/cpu0/cpufreq

Re: [PATCH] x86/mm/pat: Do a small optimization when dump PAT memtype list

2015-07-23 Thread Pan Xinhui
hi, Elliott thanks for your reply. :) On 2015年07月23日 22:53, Elliott, Robert (Server Storage) wrote: -Original Message- From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- ow...@vger.kernel.org] On Behalf Of Pan Xinhui Sent: Thursday, July 23, 2015 4:54 AM To: linux

[PATCH] x86/mm/pat: Do a small optimization when dump PAT memtype list

2015-07-23 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com There are many nodes in the PAT memtype rb-tree. When we dump this tree we call kzalloc every time to copy nodes. Actually these kzalloc are not necessary. Lets do a optimization now. Let seq_file core create an *entry* when open and free it when release

Re: [PATCH V3] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-22 Thread Pan Xinhui
hi, Borislav thanks for your kind reply. :) On 2015年07月22日 15:46, Borislav Petkov wrote: On Wed, Jul 22, 2015 at 01:38:48PM +0800, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com It's more reasonable to unlock memtype_lock right after rbt_memtype_check_insert. memtype_lock

[PATCH V3] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com It's more reasonable to unlock memtype_lock right after rbt_memtype_check_insert. memtype_lock protects all data stored in rb-tree from multiple access. It's not cool to call kfree, pr_info, etc with this lock held. So move spin_unlock a little ahead

[PATCH V4] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-22 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com It's more reasonable to unlock memtype_lock right after rbt_memtype_check_insert. All pat_rbtree operations need to be performed while holding the memtype_lock. But codes like kfree, pr_info, etc have nothing to do with this lock. So move spin_unlock

Re: [PATCH V3] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-22 Thread Pan Xinhui
hi, Borislav thanks for your reply. :) On 2015年07月22日 18:46, Borislav Petkov wrote: On Wed, Jul 22, 2015 at 05:06:04PM +0800, Pan Xinhui wrote: how about: memtype_lock protects the rb-tree root and the rb-nodes which is a field of memtype from delete/add/lookup in a race. Use

[PATCH V5] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-22 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com It's more reasonable to unlock memtype_lock right after rbt_memtype_check_insert. All pat_rbtree operations need to be performed while holding the memtype_lock. But codes like kfree, pr_info, etc have nothing to do with this lock. So move spin_unlock

Re: [PATCH V4] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-22 Thread Pan Xinhui
hi, Borislav very kind of you. :) On 2015年07月22日 22:45, Borislav Petkov wrote: On Wed, Jul 22, 2015 at 02:38:28PM +, Elliott, Robert (Server Storage) wrote: With each branch now just one line, the {} can be removed. ... and I had suggested it without the {}. hmm, sorry for my

Re: [PATCH V4] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-22 Thread Pan Xinhui
hi, Elliot thanks for your reply. On 2015年07月22日 22:38, Elliott, Robert (Server Storage) wrote: --- Robert Elliott, HP Server Storage -Original Message- From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- ow...@vger.kernel.org] On Behalf Of Pan Xinhui Sent

[PATCH] x86/mm/pat: Do a small optimization when dump PAT memtype list

2015-07-23 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com There are many nodes in the PAT memtype rb-tree. When we dump this tree we call kzalloc every time to copy nodes. Actually these kzalloc are not necessary. Lets do a optimization now. Create an *entry* in memtype_seq_start(), and free it in memtype_seq_stop

Re: [PATCH] acpi-cpufreq: Add a miss ifdef CONFIG_X86_ACPI_CPUFREQ_CPB

2015-07-13 Thread Pan Xinhui
hi, Rafael, let me do more explanation :) On 2015年07月14日 10:09, Pan Xinhui wrote: hi, Rafael, thanks for you reply :) On 2015年07月14日 07:26, Rafael J. Wysocki wrote: On Monday, July 13, 2015 02:33:08 PM Pan Xinhui wrote: hi, Rafeal thanks for your reply. :) On 2015年07月11日

[PATCH] x86/mm/pat: let level meaningful even NULL return in, lookup_address_in_pgd

2015-07-14 Thread Pan Xinhui
behavior because level is set to PG_LEVEL_4K even when pte is NULL. So let *level* meaningful even lookup_address_in_pgd return NULL by moving the assignment before pud/pmd_offset. Signed-off-by: Pan Xinhui xinhuix@intel.com --- arch/x86/mm/pageattr.c | 4 ++-- 1 file changed, 2 insertions

Re: [PATCH] acpi-cpufreq: Add a miss ifdef CONFIG_X86_ACPI_CPUFREQ_CPB

2015-07-13 Thread Pan Xinhui
hi, Rafael, thanks for you reply :) On 2015年07月14日 07:26, Rafael J. Wysocki wrote: On Monday, July 13, 2015 02:33:08 PM Pan Xinhui wrote: hi, Rafeal thanks for your reply. :) On 2015年07月11日 04:44, Rafael J. Wysocki wrote: Hi, On Fri, Jul 10, 2015 at 7:50 AM, Pan Xinhui xinhuix

Re: [PATCH 1/2] ACPI / processor: Drop an unused argument of a cleanup routine

2015-07-19 Thread Pan Xinhui
hi, Rafael thanks for your nice work :) On 2015年07月18日 09:14, Rafael J. Wysocki wrote: From: Rafael J. Wysocki rafael.j.wyso...@intel.com acpi_processor_unregister_performance() actually doesn't use its first argument, so drop it and update the callers accordingly. Signed-off-by:

[PATCH] cpufreq: ia64: remove redundant freq_table of acpi_cpufreq_data

2015-07-20 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com freq_table is now stored as policy-freq_table, so drop the redundant freq_table from struct cpufreq_acpi_io. Signed-off-by: Pan Xinhui xinhuix@intel.com --- drivers/cpufreq/ia64-acpi-cpufreq.c | 15 --- 1 file changed, 8 insertions(+), 7

Re: [PATCH] cpufreq: ia64: Fix a memory leak in acpi_cpufreq_cpu_exit

2015-07-20 Thread Pan Xinhui
On 2015年07月20日 14:24, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com freq_table should be alloced in -init and freed in -exit. However it does not be freed. Fix this memory leak in acpi_cpufreq_cpu_exit. Signed-off-by: Pan Xinhui xinhuix@intel.com --- drivers/cpufreq/ia64

Re: [PATCH] x86/mm/pat: let level meaningful even NULL return in, lookup_address_in_pgd

2015-07-19 Thread Pan Xinhui
hi, tglx thanks for your reply. On 2015年07月17日 22:50, Thomas Gleixner wrote: On Tue, 14 Jul 2015, Pan Xinhui wrote: If pmd or pud is not set, we may set a wrong page mapping level. No. The behaviour is simply undefined, if the return value of the function is NULL. So what you

[PATCH] cpufreq: ia64: Fix a memory leak in acpi_cpufreq_cpu_exit

2015-07-20 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com freq_table should be alloced in -init and freed in -exit. However it does not be freed. Fix this memory leak in acpi_cpufreq_cpu_exit. Signed-off-by: Pan Xinhui xinhuix@intel.com --- drivers/cpufreq/ia64-acpi-cpufreq.c | 1 + 1 file changed, 1

Re: [PATCH] acpi-cpufreq: Add a miss ifdef CONFIG_X86_ACPI_CPUFREQ_CPB

2015-07-19 Thread Pan Xinhui
hi, Rafael thanks for your reply :) On 2015年07月18日 08:34, Rafael J. Wysocki wrote: On Tuesday, July 14, 2015 10:52:35 AM Pan Xinhui wrote: hi, Rafael, let me do more explanation :) On 2015年07月14日 10:09, Pan Xinhui wrote: hi, Rafael, thanks for you reply :) On 2015年07月14日

Re: [PATCH] acpi-cpufreq: Add a miss ifdef CONFIG_X86_ACPI_CPUFREQ_CPB

2015-07-13 Thread Pan Xinhui
hi, Rafeal thanks for your reply. :) On 2015年07月11日 04:44, Rafael J. Wysocki wrote: Hi, On Fri, Jul 10, 2015 at 7:50 AM, Pan Xinhui xinhuix@intel.com wrote: If CONFIG_X86_ACPI_CPUFREQ_CPB has not been defined, the placeholder for cpb is not needed. Add ifdef around it. Signed

Re: [PATCH V2] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Pan Xinhui
hi, tglx thanks for your reply :) On 2015年07月21日 16:10, Thomas Gleixner wrote: On Tue, 21 Jul 2015, Pan Xinhui wrote: diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 188e3e0..f3c49fa 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c @@ -538,22 +538,20 @@ int

[PATCH V2] x86/mm/pat: Do a small optimization and fix in reserve_memtype

2015-07-21 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com It's safe and more reasonable to unlock memtype_lock right after rbt_memtype_check_insert. It's not cool to call kfree, pr_info, etc with this lock held. So move spin_unlock a little ahead. memory_lock protects data stored in rb-tree, if *new* succeed

[PATCH] x86/mm/pat: Do a small optimization in reserve_memtype

2015-07-21 Thread Pan Xinhui
From: Pan Xinhui xinhuix@intel.com It's safe and more reasonable to unlock memtype_lock right after rbt_memtype_check_insert. Signed-off-by: Pan Xinhui xinhuix@intel.com --- arch/x86/mm/pat.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/mm/pat.c b

Re: [PATCH] x86/mm/pat: Do a small optimization in reserve_memtype

2015-07-21 Thread Pan Xinhui
hi, Borislav thanks for your reply :) On 2015年07月21日 14:55, Borislav Petkov wrote: On Tue, Jul 21, 2015 at 02:29:35PM +0800, Pan Xinhui wrote: From: Pan Xinhui xinhuix@intel.com It's safe and more reasonable to unlock memtype_lock right after rbt_memtype_check_insert. Signed

Re: [PATCH] gfp: GFP_RECLAIM_MASK should include __GFP_NO_KSWAPD

2015-10-14 Thread Pan Xinhui
s many available flags as possible. :) thanks xinhui On 2015年10月14日 13:36, Pan Xinhui wrote: > From: Pan Xinhui <xinhuix@intel.com> > > GFP_RECLAIM_MASK was introduced in commit 6cb062296f73 ("Categorize GFP > flags"). In slub subsystem, this macro controls slub's allo

[PATCH] gfp: GFP_RECLAIM_MASK should include __GFP_NO_KSWAPD

2015-10-13 Thread Pan Xinhui
From: Pan Xinhui <xinhuix@intel.com> GFP_RECLAIM_MASK was introduced in commit 6cb062296f73 ("Categorize GFP flags"). In slub subsystem, this macro controls slub's allocation behavior. In particular, some flags which are not in GFP_RECLAIM_MASK will be cleared. So when sl

Re: [PATCH] gfp: GFP_RECLAIM_MASK should include __GFP_NO_KSWAPD

2015-10-14 Thread Pan Xinhui
hello, Michal thanks for your kind reply! On 2015年10月14日 15:41, Michal Hocko wrote: > On Wed 14-10-15 13:58:05, Pan Xinhui wrote: >> Hi, all >> I am working on some debug features' development. >> I use kmalloc in some places of *scheduler*. > > This

Re: [PATCH] gfp: GFP_RECLAIM_MASK should include __GFP_NO_KSWAPD

2015-10-14 Thread Pan Xinhui
hi, Michal thanks for your reply :) On 2015年10月14日 15:34, Michal Hocko wrote: > On Wed 14-10-15 13:36:51, Pan Xinhui wrote: >> From: Pan Xinhui <xinhuix@intel.com> >> >> GFP_RECLAIM_MASK was introduced in commit 6cb062296f73 ("Categorize GFP >>

Re: [PATCH] gfp: GFP_RECLAIM_MASK should include __GFP_NO_KSWAPD

2015-10-14 Thread Pan Xinhui
On 2015年10月14日 16:38, Michal Hocko wrote: > On Wed 14-10-15 16:17:31, Pan Xinhui wrote: > [...] >> I have a look at Mel's patchset. yes, it can help fix my kswapd issue. >> :) So I just need change my kmalloc's gfp_flag to GFP_ATOMIC &~ >> __GFP_KSWAPD_RECLAIM, then

Re: [PATCH V2] acpi-cpufreq: replace per_cpu with driver_data of policy

2015-07-08 Thread Pan Xinhui
hi, Dmitry thanks for your reply On 2015年07月08日 01:11, Dmitry Torokhov wrote: Hi Pan, On Tue, Jul 07, 2015 at 08:43:26PM +0800, Pan Xinhui wrote: @@ -364,19 +363,24 @@ static u32 get_cur_val(const struct cpumask *mask) static unsigned int get_cur_freq_on_cpu(unsigned int

[PATCH] acpi-cpufreq: Fix an acpi perf unregister issue

2015-07-09 Thread Pan Xinhui
acpi_processor_register_performance call, it may also fail thanks to the internal check of pr-performace. So we add a field *perf_cpu* to fix this issue. Signed-off-by: Pan Xinhui xinhuix@intel.com --- drivers/cpufreq/acpi-cpufreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion

[PATCH] acpi-cpufreq: Add a miss ifdef CONFIG_X86_ACPI_CPUFREQ_CPB

2015-07-09 Thread Pan Xinhui
If CONFIG_X86_ACPI_CPUFREQ_CPB has not been defined, the placeholder for cpb is not needed. Add ifdef around it. Signed-off-by: Pan Xinhui xinhuix@intel.com --- drivers/cpufreq/acpi-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers

Re: [PATCH] lib/bitmap.c: add some check to correct the parse result

2015-07-10 Thread Pan Xinhui
hi, Andrew thanks for you kind reply :) On 2015年07月10日 06:57, Andrew Morton wrote: On Sat, 27 Jun 2015 14:36:18 +0800 Pan Xinhui xinhuix@intel.com wrote: Sometimes the input from user may cause an unexpected result. for example, echo 1-3, /proc/irq/xxx/smp_affinity_list

[PATCH V2] acpi-cpufreq: Fix an acpi perf unregister issue

2015-07-10 Thread Pan Xinhui
acpi_processor_register_performance call, it may also fail thanks to the internal check of pr-performace. So we add a field *acpi_perf_cpu* to fix this issue. Signed-off-by: Pan Xinhui xinhuix@intel.com --- Change from V1: comments update --- drivers/cpufreq/acpi-cpufreq.c | 4 +++- 1

Re: [PATCH] acpi-cpufreq: replace per_cpu with driver_data of policy

2015-07-07 Thread Pan Xinhui
hi, Viresh thanks for your reply. :) On 2015年07月07日 18:45, Viresh Kumar wrote: On 07-07-15, 18:29, Pan Xinhui wrote: Now policy has field of driver_data, we can use it to get rid of per_cpu acpi_cpufreq_data. Instead: Drivers can store their internal per-policy information

Re: [PATCH V2] acpi-cpufreq: replace per_cpu with driver_data of policy

2015-07-07 Thread Pan Xinhui
hi, all thanks for reviewing. any comments or advices are welcome :) I am OOO tomorrow, so response may arrive later. thanks xinhui On 2015年07月07日 20:43, Pan Xinhui wrote: Drivers can store their internal per-policy information in policy-driver_data, lets use it. we have benefits

[PATCH V2] acpi-cpufreq: replace per_cpu with driver_data of policy

2015-07-07 Thread Pan Xinhui
*driver_data* to fix it. Signed-off-by: Pan Xinhui xinhuix@intel.com --- Changes from V1: codes style fix, comments update move cpufreq_cpu_put(policy) after we get *driver_data* --- drivers/cpufreq/acpi-cpufreq.c | 40 ++-- 1 file changed, 22

Re: [PATCH] acpi-cpufreq.c: fix a memory leak in acpi_cpufreq_cpu_exit

2015-07-07 Thread Pan Xinhui
hi, Viresh thanks for your quick reply :) On 2015年07月07日 16:53, Viresh Kumar wrote: On 07-07-15, 15:52, Pan Xinhui wrote: I have latest codes. codes in cpufreq.c are below. 1436 down_write(policy-rwsem); 1437 cpumask_clear_cpu(cpu, policy-cpus); 1438 1439

[PATCH] acpi-cpufreq: replace per_cpu with driver_data of policy

2015-07-07 Thread Pan Xinhui
*driver_data* to fix it. Signed-off-by: Pan Xinhui xinhuix@intel.com --- drivers/cpufreq/acpi-cpufreq.c | 38 +++--- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 0136dfc

Re: [PATCH V2] acpi-cpufreq: replace per_cpu with driver_data of policy

2015-07-08 Thread Pan Xinhui
hi, Rafael thanks for your kind reply. :) On 2015年07月09日 08:20, Rafael J. Wysocki wrote: On Tuesday, July 07, 2015 08:04:43 PM Viresh Kumar wrote: On 07-07-15, 20:43, Pan Xinhui wrote: Drivers can store their internal per-policy information in policy-driver_data, lets use it. we

Re: [PATCH] tty/n_gsm.c: fix false positive WARN_ON and do some codes improvement

2015-12-14 Thread Pan Xinhui
oop traverse. Reported-by: Dmitry Vyukov <dvyu...@google.com> Fixes: 5a64096700dc ("tty/n_gsm.c: fix a memory leak in gsmld_open") Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> the signed-off-by name has to match your from: name :( -- To unsubscribe from this list

[PATCH resend ] tty/n_gsm.c: use gsm->num to remove mux itself from gsm_mux[]

2015-12-13 Thread Pan Xinhui
From: Pan Xinhui <xinhui@linux.vnet.ibm.com> There is one filed gsm->num to store mux's index of gsm_mux[]. So use gsm->num to remove itself from gsm_mux[] instead of the for-loop traverse in gsm_cleanup_mux(). Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com>

Re: [PATCH resend ] tty/n_gsm.c: use gsm->num to remove mux itself from gsm_mux[]

2016-01-04 Thread Pan Xinhui
you are right. i still have many confusion. but tears came out several times:( when i am back, i will reply you again. thx xinhui On 2015-12-14 23:40 , One Thousand Gnomes Wrote: On Mon, 14 Dec 2015 15:08:03 +0800 Pan Xinhui <xinhui@linux.vnet.ibm.com> wrote: From: Pan Xinhu

[PATCH V2] tty/n_gsm.c: use gsm->num to remove mux itself from gsm_mux[]

2016-01-04 Thread Pan Xinhui
From: Pan Xinhui <xinhui@linux.vnet.ibm.com> There is one filed gsm->num to store mux's index of gsm_mux[]. So use gsm->num to remove itself from gsm_mux[] instead of the for-loop traverse in gsm_cleanup_mux(). Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com>

[PATCH] locking/qspinlock: Use atomic_sub_return_release in queued_spin_unlock

2016-06-03 Thread Pan Xinhui
The existing version uses a heavy barrier while only release semantics is required. So use atomic_sub_return_release instead. Suggested-by: Peter Zijlstra (Intel) <pet...@infradead.org> Signed-off-by: Pan Xinhui <xinhui@linux.vnet.ibm.com> --- include/asm-generic/qspinlock.h |

[PATCH] locking/qspinlock: Use this_cpu_ptr instead of this_cpu_dec

2016-06-03 Thread Pan Xinhui
queued_spin_lock_slowpath should not worry about interrupt change node->count by accident because ->count is inc and dec when we enter/leave queued_spin_lock_slowpath. So this_cpu_dec() does some no point things here, lets use this_cpu_ptr for a small optimization. Signed-off-by: Pan

  1   2   3   4   5   6   7   >