[PATCH] vfs: check i_count under lock in evict_inodes

2016-07-11 Thread Chunwei Chen
We need to check i_count again with i_lock held, because iput might re-add
i_count when lazytime is on. Without this check, we could end up with
double-free or use-after-free.

Cc: Alexander Viro <v...@zeniv.linux.org.uk>
Cc: linux-fsde...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: sta...@vger.kernel.org
Signed-off-by: Chunwei Chen <david.c...@osnexus.com>
---
 fs/inode.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/inode.c b/fs/inode.c
index 4ccbc21..10bb020 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -607,7 +607,12 @@ again:
continue;
 
spin_lock(>i_lock);
-   if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) {
+   /*
+* check i_count again with lock, because iput might re-add
+* it when lazytime is on.
+*/
+   if (atomic_read(>i_count) ||
+   (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE))) {
spin_unlock(>i_lock);
continue;
}
-- 
2.7.4



[PATCH] vfs: check i_count under lock in evict_inodes

2016-07-11 Thread Chunwei Chen
We need to check i_count again with i_lock held, because iput might re-add
i_count when lazytime is on. Without this check, we could end up with
double-free or use-after-free.

Cc: Alexander Viro 
Cc: linux-fsde...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: sta...@vger.kernel.org
Signed-off-by: Chunwei Chen 
---
 fs/inode.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/inode.c b/fs/inode.c
index 4ccbc21..10bb020 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -607,7 +607,12 @@ again:
continue;
 
spin_lock(>i_lock);
-   if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) {
+   /*
+* check i_count again with lock, because iput might re-add
+* it when lazytime is on.
+*/
+   if (atomic_read(>i_count) ||
+   (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE))) {
spin_unlock(>i_lock);
continue;
}
-- 
2.7.4



Re: [uas/3.16.1] panic in uas_data_cmplt()

2014-09-02 Thread Chunwei Chen


On 西元2014年09月02日 14:50, Hans de Goede wrote:
> Hi,
> 
> On 09/02/2014 06:18 AM, Chunwei Chen wrote:
>> Dear all:
>>
>> The kernel version is 3.16.1-1-ARCH
>>
>> Today I keep getting this panic when booting up.
>> http://i.imgur.com/0Rx93Kr.jpg
>>
>> It might be that the UAS device was in some strange state,
>> because that after I unplugged and power-cycled the UAS,
>> everything went normal again.
>>
>> Does anyone know what's the root cause of this issue?
>> Or could anyone provide some instruction on how to debug this issue?
> 
> There seem to be some issues in the error handling paths of the uas
> driver. I plan to rewrite them completely for robustness and go
> through them with a fine comb to fix any possible bugs while at it.
> 
> I'll send out a mail when I've a new version ready for testing.
> 
> Regards,
> 
> Hans
> 

Hi Hans,

Thanks for looking into this.

Kind regards,
Chunwei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [uas/3.16.1] panic in uas_data_cmplt()

2014-09-02 Thread Chunwei Chen


On 西元2014年09月02日 14:50, Hans de Goede wrote:
 Hi,
 
 On 09/02/2014 06:18 AM, Chunwei Chen wrote:
 Dear all:

 The kernel version is 3.16.1-1-ARCH

 Today I keep getting this panic when booting up.
 http://i.imgur.com/0Rx93Kr.jpg

 It might be that the UAS device was in some strange state,
 because that after I unplugged and power-cycled the UAS,
 everything went normal again.

 Does anyone know what's the root cause of this issue?
 Or could anyone provide some instruction on how to debug this issue?
 
 There seem to be some issues in the error handling paths of the uas
 driver. I plan to rewrite them completely for robustness and go
 through them with a fine comb to fix any possible bugs while at it.
 
 I'll send out a mail when I've a new version ready for testing.
 
 Regards,
 
 Hans
 

Hi Hans,

Thanks for looking into this.

Kind regards,
Chunwei
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[uas/3.16.1] panic in uas_data_cmplt()

2014-09-01 Thread Chunwei Chen
Dear all:

The kernel version is 3.16.1-1-ARCH

Today I keep getting this panic when booting up.
http://i.imgur.com/0Rx93Kr.jpg

It might be that the UAS device was in some strange state,
because that after I unplugged and power-cycled the UAS,
everything went normal again.

Does anyone know what's the root cause of this issue?
Or could anyone provide some instruction on how to debug this issue?

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[uas/3.16.1] panic in uas_data_cmplt()

2014-09-01 Thread Chunwei Chen
Dear all:

The kernel version is 3.16.1-1-ARCH

Today I keep getting this panic when booting up.
http://i.imgur.com/0Rx93Kr.jpg

It might be that the UAS device was in some strange state,
because that after I unplugged and power-cycled the UAS,
everything went normal again.

Does anyone know what's the root cause of this issue?
Or could anyone provide some instruction on how to debug this issue?

Thanks
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ceph: fix corruption when using page_count 0 page in rbd

2014-04-22 Thread Chunwei Chen
It has been reported that using ZFSonLinux on rbd will result in memory
corruption. The bug report can be found here:

https://github.com/zfsonlinux/spl/issues/241
http://tracker.ceph.com/issues/7790

The reason is that ZFS will send pages with page_count 0 into rbd, which in
turns send them to tcp_sendpage. However, tcp_sendpage cannot deal with
page_count 0, as it will do get_page and put_page, and erroneously free the
page.

This type of issue has been noted before, and handled in iscsi, drbd,
etc. So, rbd should also handle this. This fix address this issue by fall back
to slower sendmsg when page_count 0 detected.

Cc: Sage Weil 
Cc: Yehuda Sadeh 
Cc: sta...@vger.kernel.org
Signed-off-by: Chunwei Chen 
---
 net/ceph/messenger.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 4f55f9c..9a964e7 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -557,7 +557,7 @@ static int ceph_tcp_sendmsg(struct socket *sock, struct 
kvec *iov,
return r;
 }
 
-static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
+static int __ceph_tcp_sendpage(struct socket *sock, struct page *page,
 int offset, size_t size, bool more)
 {
int flags = MSG_DONTWAIT | MSG_NOSIGNAL | (more ? MSG_MORE : MSG_EOR);
@@ -570,6 +570,24 @@ static int ceph_tcp_sendpage(struct socket *sock, struct 
page *page,
return ret;
 }
 
+static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
+int offset, size_t size, bool more)
+{
+   int ret;
+   struct kvec iov;
+
+   /* sendpage cannot properly handle pages with page_count == 0,
+* we need to fallback to sendmsg if that's the case */
+   if (page_count(page) >= 1)
+   return __ceph_tcp_sendpage(sock, page, offset, size, more);
+
+   iov.iov_base = kmap(page) + offset;
+   iov.iov_len = size;
+   ret = ceph_tcp_sendmsg(sock, , 1, size, more);
+   kunmap(page);
+
+   return ret;
+}
 
 /*
  * Shutdown/close the socket for the given connection.
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ceph: fix corruption when using page_count 0 page in rbd

2014-04-22 Thread Chunwei Chen
It has been reported that using ZFSonLinux on rbd will result in memory
corruption. The bug report can be found here:

https://github.com/zfsonlinux/spl/issues/241
http://tracker.ceph.com/issues/7790

The reason is that ZFS will send pages with page_count 0 into rbd, which in
turns send them to tcp_sendpage. However, tcp_sendpage cannot deal with
page_count 0, as it will do get_page and put_page, and erroneously free the
page.

This type of issue has been noted before, and handled in iscsi, drbd,
etc. So, rbd should also handle this. This fix address this issue by fall back
to slower sendmsg when page_count 0 detected.

Cc: Sage Weil s...@inktank.com
Cc: Yehuda Sadeh yeh...@inktank.com
Cc: sta...@vger.kernel.org
Signed-off-by: Chunwei Chen tux...@gmail.com
---
 net/ceph/messenger.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 4f55f9c..9a964e7 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -557,7 +557,7 @@ static int ceph_tcp_sendmsg(struct socket *sock, struct 
kvec *iov,
return r;
 }
 
-static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
+static int __ceph_tcp_sendpage(struct socket *sock, struct page *page,
 int offset, size_t size, bool more)
 {
int flags = MSG_DONTWAIT | MSG_NOSIGNAL | (more ? MSG_MORE : MSG_EOR);
@@ -570,6 +570,24 @@ static int ceph_tcp_sendpage(struct socket *sock, struct 
page *page,
return ret;
 }
 
+static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
+int offset, size_t size, bool more)
+{
+   int ret;
+   struct kvec iov;
+
+   /* sendpage cannot properly handle pages with page_count == 0,
+* we need to fallback to sendmsg if that's the case */
+   if (page_count(page) = 1)
+   return __ceph_tcp_sendpage(sock, page, offset, size, more);
+
+   iov.iov_base = kmap(page) + offset;
+   iov.iov_len = size;
+   ret = ceph_tcp_sendmsg(sock, iov, 1, size, more);
+   kunmap(page);
+
+   return ret;
+}
 
 /*
  * Shutdown/close the socket for the given connection.
-- 
1.8.5.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf config: Ignore generated files in feature-checks

2014-01-12 Thread tip-bot for Chunwei Chen
Commit-ID:  56560ec692c142bb9ee404764e3b67999031ad19
Gitweb: http://git.kernel.org/tip/56560ec692c142bb9ee404764e3b67999031ad19
Author: Chunwei Chen 
AuthorDate: Sat, 21 Dec 2013 13:48:11 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 23 Dec 2013 16:49:51 -0300

perf config: Ignore generated files in feature-checks

1. Rename the test-* binary files to test-*.bin for easier pattern matching as
   suggested by Ingo.
2. Ignore *.bin and *.d files.

Signed-off-by: Chunwei Chen 
Reviewed-by: Ingo Molnar 
Acked-by: Jiri Olsa 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Link: http://lkml.kernel.org/r/52b52b9b.50...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/config/Makefile  |   6 +-
 tools/perf/config/feature-checks/.gitignore |   2 +
 tools/perf/config/feature-checks/Makefile   | 110 ++--
 3 files changed, 60 insertions(+), 58 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5a1f4df..14faeeb 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -126,7 +126,7 @@ endif
 
 feature_check = $(eval $(feature_check_code))
 define feature_check_code
-  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) 
$(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1 >/dev/null 
2>/dev/null && echo 1 || echo 0)
+  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) 
$(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1.bin >/dev/null 
2>/dev/null && echo 1 || echo 0)
 endef
 
 feature_set = $(eval $(feature_set_code))
@@ -173,7 +173,7 @@ CORE_FEATURE_TESTS =\
 # to skip the print-out of the long features list if the file
 # existed before and after it was built:
 #
-ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all),)
+ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all.bin),)
   test-all-failed := 1
 else
   test-all-failed := 0
@@ -203,7 +203,7 @@ ifeq ($(feature-all), 1)
   #
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
 else
-  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) 
>/dev/null 2>&1)
+  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix 
.bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
 endif
 
diff --git a/tools/perf/config/feature-checks/.gitignore 
b/tools/perf/config/feature-checks/.gitignore
new file mode 100644
index 000..80f3da0
--- /dev/null
+++ b/tools/perf/config/feature-checks/.gitignore
@@ -0,0 +1,2 @@
+*.d
+*.bin
diff --git a/tools/perf/config/feature-checks/Makefile 
b/tools/perf/config/feature-checks/Makefile
index bc86462..7cf6fcd 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -1,90 +1,90 @@
 
 FILES= \
-   test-all\
-   test-backtrace  \
-   test-bionic \
-   test-dwarf  \
-   test-fortify-source \
-   test-glibc  \
-   test-gtk2   \
-   test-gtk2-infobar   \
-   test-hello  \
-   test-libaudit   \
-   test-libbfd \
-   test-liberty\
-   test-liberty-z  \
-   test-cplus-demangle \
-   test-libelf \
-   test-libelf-getphdrnum  \
-   test-libelf-mmap\
-   test-libnuma\
-   test-libperl\
-   test-libpython  \
-   test-libpython-version  \
-   test-libslang   \
-   test-libunwind  \
-   test-libunwind-debug-frame  \
-   test-on-exit\
-   test-stackprotector-all \
-   test-timerfd
+   test-all.bin\
+   test-backtrace.bin  \
+   test-bionic.bin \
+   test-dwarf.bin  \
+   test-fortify-source.bin \
+   test-glibc.bin  \
+   test-gtk2.bin   \
+   test-gtk2-infobar.bin   \
+   test-hello.bin  \
+   test-libaudit.bin   \
+   test-libbfd.bin \
+   test-liberty.bin\
+   test-liberty-z.bin  \
+   test-cplus-demangle.bin \
+   

[tip:perf/core] perf config: Ignore generated files in feature-checks

2014-01-12 Thread tip-bot for Chunwei Chen
Commit-ID:  56560ec692c142bb9ee404764e3b67999031ad19
Gitweb: http://git.kernel.org/tip/56560ec692c142bb9ee404764e3b67999031ad19
Author: Chunwei Chen tux...@gmail.com
AuthorDate: Sat, 21 Dec 2013 13:48:11 +0800
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Mon, 23 Dec 2013 16:49:51 -0300

perf config: Ignore generated files in feature-checks

1. Rename the test-* binary files to test-*.bin for easier pattern matching as
   suggested by Ingo.
2. Ignore *.bin and *.d files.

Signed-off-by: Chunwei Chen tux...@gmail.com
Reviewed-by: Ingo Molnar mi...@kernel.org
Acked-by: Jiri Olsa jo...@redhat.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Jiri Olsa jo...@redhat.com
Link: http://lkml.kernel.org/r/52b52b9b.50...@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/config/Makefile  |   6 +-
 tools/perf/config/feature-checks/.gitignore |   2 +
 tools/perf/config/feature-checks/Makefile   | 110 ++--
 3 files changed, 60 insertions(+), 58 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5a1f4df..14faeeb 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -126,7 +126,7 @@ endif
 
 feature_check = $(eval $(feature_check_code))
 define feature_check_code
-  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS=$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1)) LDFLAGS=$(LDFLAGS) 
$(FEATURE_CHECK_LDFLAGS-$(1)) -C config/feature-checks test-$1 /dev/null 
2/dev/null  echo 1 || echo 0)
+  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS=$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1)) LDFLAGS=$(LDFLAGS) 
$(FEATURE_CHECK_LDFLAGS-$(1)) -C config/feature-checks test-$1.bin /dev/null 
2/dev/null  echo 1 || echo 0)
 endef
 
 feature_set = $(eval $(feature_set_code))
@@ -173,7 +173,7 @@ CORE_FEATURE_TESTS =\
 # to skip the print-out of the long features list if the file
 # existed before and after it was built:
 #
-ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all),)
+ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all.bin),)
   test-all-failed := 1
 else
   test-all-failed := 0
@@ -203,7 +203,7 @@ ifeq ($(feature-all), 1)
   #
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
 else
-  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS=$(EXTRA_CFLAGS) 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) 
/dev/null 21)
+  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS=$(EXTRA_CFLAGS) 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix 
.bin,$(CORE_FEATURE_TESTS)) /dev/null 21)
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
 endif
 
diff --git a/tools/perf/config/feature-checks/.gitignore 
b/tools/perf/config/feature-checks/.gitignore
new file mode 100644
index 000..80f3da0
--- /dev/null
+++ b/tools/perf/config/feature-checks/.gitignore
@@ -0,0 +1,2 @@
+*.d
+*.bin
diff --git a/tools/perf/config/feature-checks/Makefile 
b/tools/perf/config/feature-checks/Makefile
index bc86462..7cf6fcd 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -1,90 +1,90 @@
 
 FILES= \
-   test-all\
-   test-backtrace  \
-   test-bionic \
-   test-dwarf  \
-   test-fortify-source \
-   test-glibc  \
-   test-gtk2   \
-   test-gtk2-infobar   \
-   test-hello  \
-   test-libaudit   \
-   test-libbfd \
-   test-liberty\
-   test-liberty-z  \
-   test-cplus-demangle \
-   test-libelf \
-   test-libelf-getphdrnum  \
-   test-libelf-mmap\
-   test-libnuma\
-   test-libperl\
-   test-libpython  \
-   test-libpython-version  \
-   test-libslang   \
-   test-libunwind  \
-   test-libunwind-debug-frame  \
-   test-on-exit\
-   test-stackprotector-all \
-   test-timerfd
+   test-all.bin\
+   test-backtrace.bin  \
+   test-bionic.bin \
+   test-dwarf.bin  \
+   test-fortify-source.bin \
+   test-glibc.bin  \
+   test-gtk2.bin   \
+   test-gtk2-infobar.bin   \
+   test-hello.bin  \
+   test-libaudit.bin   \
+   test-libbfd.bin \
+   test-liberty.bin\
+   test-liberty-z.bin  \
+   test-cplus-demangle.bin \
+   test-libelf.bin

Re: [PATCH] perf config: ignore generated files in feature-checks

2013-12-20 Thread Chunwei Chen
>From ce62a386df25ec50e13487c7b56e09c71c2abf4c Mon Sep 17 00:00:00 2001
From: Chunwei Chen 
Date: Sat, 21 Dec 2013 13:15:07 +0800
Subject: [PATCH] perf config: ignore generated files in feature-checks

1. Rename the test-* binary files to test-*.bin for easier pattern matching as
   suggested by Ingo.
2. Ignore *.bin and *.d files.

Signed-off-by: Chunwei Chen 
---
 tools/perf/config/Makefile  |   6 +-
 tools/perf/config/feature-checks/.gitignore |   2 +
 tools/perf/config/feature-checks/Makefile   | 110 ++--
 3 files changed, 60 insertions(+), 58 deletions(-)
 create mode 100644 tools/perf/config/feature-checks/.gitignore

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5a1f4df..14faeeb 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -126,7 +126,7 @@ endif
 
 feature_check = $(eval $(feature_check_code))
 define feature_check_code
-  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) 
$(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1 >/dev/null 
2>/dev/null && echo 1 || echo 0)
+  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) 
$(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1.bin >/dev/null 
2>/dev/null && echo 1 || echo 0)
 endef
 
 feature_set = $(eval $(feature_set_code))
@@ -173,7 +173,7 @@ CORE_FEATURE_TESTS =\
 # to skip the print-out of the long features list if the file
 # existed before and after it was built:
 #
-ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all),)
+ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all.bin),)
   test-all-failed := 1
 else
   test-all-failed := 0
@@ -203,7 +203,7 @@ ifeq ($(feature-all), 1)
   #
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
 else
-  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) 
>/dev/null 2>&1)
+  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix 
.bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
 endif
 
diff --git a/tools/perf/config/feature-checks/.gitignore 
b/tools/perf/config/feature-checks/.gitignore
new file mode 100644
index 000..80f3da0
--- /dev/null
+++ b/tools/perf/config/feature-checks/.gitignore
@@ -0,0 +1,2 @@
+*.d
+*.bin
diff --git a/tools/perf/config/feature-checks/Makefile 
b/tools/perf/config/feature-checks/Makefile
index bc86462..7cf6fcd 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -1,90 +1,90 @@
 
 FILES= \
-   test-all\
-   test-backtrace  \
-   test-bionic \
-   test-dwarf  \
-   test-fortify-source \
-   test-glibc  \
-   test-gtk2   \
-   test-gtk2-infobar   \
-   test-hello  \
-   test-libaudit   \
-   test-libbfd \
-   test-liberty\
-   test-liberty-z  \
-   test-cplus-demangle \
-   test-libelf \
-   test-libelf-getphdrnum  \
-   test-libelf-mmap\
-   test-libnuma\
-   test-libperl\
-   test-libpython  \
-   test-libpython-version  \
-   test-libslang   \
-   test-libunwind  \
-   test-libunwind-debug-frame  \
-   test-on-exit\
-   test-stackprotector-all \
-   test-timerfd
+   test-all.bin\
+   test-backtrace.bin  \
+   test-bionic.bin \
+   test-dwarf.bin  \
+   test-fortify-source.bin \
+   test-glibc.bin  \
+   test-gtk2.bin   \
+   test-gtk2-infobar.bin   \
+   test-hello.bin  \
+   test-libaudit.bin   \
+   test-libbfd.bin \
+   test-liberty.bin\
+   test-liberty-z.bin  \
+   test-cplus-demangle.bin \
+   test-libelf.bin \
+   test-libelf-getphdrnum.bin  \
+   test-libelf-mmap.bin\
+   test-libnuma.bin\
+   test-libperl.bin\
+   test-libpython.bin  \

Re: [PATCH] perf config: ignore generated files in feature-checks

2013-12-20 Thread Chunwei Chen
From ce62a386df25ec50e13487c7b56e09c71c2abf4c Mon Sep 17 00:00:00 2001
From: Chunwei Chen tux...@gmail.com
Date: Sat, 21 Dec 2013 13:15:07 +0800
Subject: [PATCH] perf config: ignore generated files in feature-checks

1. Rename the test-* binary files to test-*.bin for easier pattern matching as
   suggested by Ingo.
2. Ignore *.bin and *.d files.

Signed-off-by: Chunwei Chen tux...@gmail.com
---
 tools/perf/config/Makefile  |   6 +-
 tools/perf/config/feature-checks/.gitignore |   2 +
 tools/perf/config/feature-checks/Makefile   | 110 ++--
 3 files changed, 60 insertions(+), 58 deletions(-)
 create mode 100644 tools/perf/config/feature-checks/.gitignore

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5a1f4df..14faeeb 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -126,7 +126,7 @@ endif
 
 feature_check = $(eval $(feature_check_code))
 define feature_check_code
-  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS=$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1)) LDFLAGS=$(LDFLAGS) 
$(FEATURE_CHECK_LDFLAGS-$(1)) -C config/feature-checks test-$1 /dev/null 
2/dev/null  echo 1 || echo 0)
+  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS=$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1)) LDFLAGS=$(LDFLAGS) 
$(FEATURE_CHECK_LDFLAGS-$(1)) -C config/feature-checks test-$1.bin /dev/null 
2/dev/null  echo 1 || echo 0)
 endef
 
 feature_set = $(eval $(feature_set_code))
@@ -173,7 +173,7 @@ CORE_FEATURE_TESTS =\
 # to skip the print-out of the long features list if the file
 # existed before and after it was built:
 #
-ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all),)
+ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all.bin),)
   test-all-failed := 1
 else
   test-all-failed := 0
@@ -203,7 +203,7 @@ ifeq ($(feature-all), 1)
   #
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
 else
-  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS=$(EXTRA_CFLAGS) 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) 
/dev/null 21)
+  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS=$(EXTRA_CFLAGS) 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix 
.bin,$(CORE_FEATURE_TESTS)) /dev/null 21)
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
 endif
 
diff --git a/tools/perf/config/feature-checks/.gitignore 
b/tools/perf/config/feature-checks/.gitignore
new file mode 100644
index 000..80f3da0
--- /dev/null
+++ b/tools/perf/config/feature-checks/.gitignore
@@ -0,0 +1,2 @@
+*.d
+*.bin
diff --git a/tools/perf/config/feature-checks/Makefile 
b/tools/perf/config/feature-checks/Makefile
index bc86462..7cf6fcd 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -1,90 +1,90 @@
 
 FILES= \
-   test-all\
-   test-backtrace  \
-   test-bionic \
-   test-dwarf  \
-   test-fortify-source \
-   test-glibc  \
-   test-gtk2   \
-   test-gtk2-infobar   \
-   test-hello  \
-   test-libaudit   \
-   test-libbfd \
-   test-liberty\
-   test-liberty-z  \
-   test-cplus-demangle \
-   test-libelf \
-   test-libelf-getphdrnum  \
-   test-libelf-mmap\
-   test-libnuma\
-   test-libperl\
-   test-libpython  \
-   test-libpython-version  \
-   test-libslang   \
-   test-libunwind  \
-   test-libunwind-debug-frame  \
-   test-on-exit\
-   test-stackprotector-all \
-   test-timerfd
+   test-all.bin\
+   test-backtrace.bin  \
+   test-bionic.bin \
+   test-dwarf.bin  \
+   test-fortify-source.bin \
+   test-glibc.bin  \
+   test-gtk2.bin   \
+   test-gtk2-infobar.bin   \
+   test-hello.bin  \
+   test-libaudit.bin   \
+   test-libbfd.bin \
+   test-liberty.bin\
+   test-liberty-z.bin  \
+   test-cplus-demangle.bin \
+   test-libelf.bin \
+   test-libelf-getphdrnum.bin  \
+   test-libelf-mmap.bin\
+   test-libnuma.bin\
+   test-libperl.bin\
+   test-libpython.bin  \
+   test-libpython-version.bin  \
+   test-libslang.bin   \
+   test-libunwind.bin

Re: [PATCH] perf config: ignore generated files in feature-checks

2013-12-19 Thread Chunwei Chen
>From 362201bf3259cc01c99531766395fdba0c0f3789 Mon Sep 17 00:00:00 2001
From: Chunwei Chen 
Date: Thu, 19 Dec 2013 15:41:22 +0800
Subject: [PATCH] perf config: ignore generated files in feature-checks

1. Rename the test-* binary files to test-*.bin for easier pattern matching as
   suggested by Ingo.
2. Ignore *.bin and *.d files.

Signed-off-by: Chunwei Chen 
---
 tools/perf/config/Makefile  |   6 +-
 tools/perf/config/feature-checks/.gitignore |   2 +
 tools/perf/config/feature-checks/Makefile   | 114 ++--
 3 files changed, 62 insertions(+), 60 deletions(-)
 create mode 100644 tools/perf/config/feature-checks/.gitignore

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index f7d11a8..40e08d1 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -102,7 +102,7 @@ endif
 
 feature_check = $(eval $(feature_check_code))
 define feature_check_code
-  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS="$(LDFLAGS)" 
LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 
2>/dev/null && echo 1 || echo 0)
+  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS="$(LDFLAGS)" 
LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1.bin 
>/dev/null 2>/dev/null && echo 1 || echo 0)
 endef
 
 feature_set = $(eval $(feature_set_code))
@@ -150,7 +150,7 @@ CORE_FEATURE_TESTS =\
 # to skip the print-out of the long features list if the file
 # existed before and after it was built:
 #
-ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all),)
+ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all.bin),)
   test-all-failed := 1
 else
   test-all-failed := 0
@@ -180,7 +180,7 @@ ifeq ($(feature-all), 1)
   #
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
 else
-  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) 
>/dev/null 2>&1)
+  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix 
.bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
 endif
 
diff --git a/tools/perf/config/feature-checks/.gitignore 
b/tools/perf/config/feature-checks/.gitignore
new file mode 100644
index 000..80f3da0
--- /dev/null
+++ b/tools/perf/config/feature-checks/.gitignore
@@ -0,0 +1,2 @@
+*.d
+*.bin
diff --git a/tools/perf/config/feature-checks/Makefile 
b/tools/perf/config/feature-checks/Makefile
index 87e7900..e2bc0ed 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -1,94 +1,94 @@
 
 FILES= \
-   test-all\
-   test-backtrace  \
-   test-bionic \
-   test-dwarf  \
-   test-fortify-source \
-   test-glibc  \
-   test-gtk2   \
-   test-gtk2-infobar   \
-   test-hello  \
-   test-libaudit   \
-   test-libbfd \
-   test-liberty\
-   test-liberty-z  \
-   test-cplus-demangle \
-   test-libelf \
-   test-libelf-getphdrnum  \
-   test-libelf-mmap\
-   test-libnuma\
-   test-libperl\
-   test-libpython  \
-   test-libpython-version  \
-   test-libslang   \
-   test-libunwind  \
-   test-libunwind-debug-frame  \
-   test-on-exit\
-   test-stackprotector-all \
-   test-stackprotector \
-   test-timerfd
+   test-all.bin\
+   test-backtrace.bin  \
+   test-bionic.bin \
+   test-dwarf.bin  \
+   test-fortify-source.bin \
+   test-glibc.bin  \
+   test-gtk2.bin   \
+   test-gtk2-infobar.bin   \
+   test-hello.bin  \
+   test-libaudit.bin   \
+   test-libbfd.bin \
+   test-liberty.bin\
+   test-liberty-z.bin  \
+   test-cplus-demangle.bin \
+   test-libelf.bin \
+   test-libelf-getphdrnum.bin  \
+   test-libelf-mmap.bin\
+   test-libnuma.bin\
+   test-libperl.bin\
+   test-libpytho

[PATCH] perf config: ignore generated files in feature-checks

2013-12-19 Thread Chunwei Chen
Signed-off-by: Chunwei Chen 
---
 tools/perf/config/feature-checks/.gitignore |2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tools/perf/config/feature-checks/.gitignore

diff --git a/tools/perf/config/feature-checks/.gitignore 
b/tools/perf/config/feature-checks/.gitignore
new file mode 100644
index 000..9662c68
--- /dev/null
+++ b/tools/perf/config/feature-checks/.gitignore
@@ -0,0 +1,2 @@
+test-all
+*.d
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] perf config: ignore generated files in feature-checks

2013-12-19 Thread Chunwei Chen
Signed-off-by: Chunwei Chen tux...@gmail.com
---
 tools/perf/config/feature-checks/.gitignore |2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tools/perf/config/feature-checks/.gitignore

diff --git a/tools/perf/config/feature-checks/.gitignore 
b/tools/perf/config/feature-checks/.gitignore
new file mode 100644
index 000..9662c68
--- /dev/null
+++ b/tools/perf/config/feature-checks/.gitignore
@@ -0,0 +1,2 @@
+test-all
+*.d
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] perf config: ignore generated files in feature-checks

2013-12-19 Thread Chunwei Chen
From 362201bf3259cc01c99531766395fdba0c0f3789 Mon Sep 17 00:00:00 2001
From: Chunwei Chen tux...@gmail.com
Date: Thu, 19 Dec 2013 15:41:22 +0800
Subject: [PATCH] perf config: ignore generated files in feature-checks

1. Rename the test-* binary files to test-*.bin for easier pattern matching as
   suggested by Ingo.
2. Ignore *.bin and *.d files.

Signed-off-by: Chunwei Chen tux...@gmail.com
---
 tools/perf/config/Makefile  |   6 +-
 tools/perf/config/feature-checks/.gitignore |   2 +
 tools/perf/config/feature-checks/Makefile   | 114 ++--
 3 files changed, 62 insertions(+), 60 deletions(-)
 create mode 100644 tools/perf/config/feature-checks/.gitignore

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index f7d11a8..40e08d1 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -102,7 +102,7 @@ endif
 
 feature_check = $(eval $(feature_check_code))
 define feature_check_code
-  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS=$(EXTRA_CFLAGS) LDFLAGS=$(LDFLAGS) 
LIBUNWIND_LIBS=$(LIBUNWIND_LIBS) -C config/feature-checks test-$1 /dev/null 
2/dev/null  echo 1 || echo 0)
+  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) 
CFLAGS=$(EXTRA_CFLAGS) LDFLAGS=$(LDFLAGS) 
LIBUNWIND_LIBS=$(LIBUNWIND_LIBS) -C config/feature-checks test-$1.bin 
/dev/null 2/dev/null  echo 1 || echo 0)
 endef
 
 feature_set = $(eval $(feature_set_code))
@@ -150,7 +150,7 @@ CORE_FEATURE_TESTS =\
 # to skip the print-out of the long features list if the file
 # existed before and after it was built:
 #
-ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all),)
+ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all.bin),)
   test-all-failed := 1
 else
   test-all-failed := 0
@@ -180,7 +180,7 @@ ifeq ($(feature-all), 1)
   #
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
 else
-  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS=$(EXTRA_CFLAGS) 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) 
/dev/null 21)
+  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS=$(EXTRA_CFLAGS) 
LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix 
.bin,$(CORE_FEATURE_TESTS)) /dev/null 21)
   $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
 endif
 
diff --git a/tools/perf/config/feature-checks/.gitignore 
b/tools/perf/config/feature-checks/.gitignore
new file mode 100644
index 000..80f3da0
--- /dev/null
+++ b/tools/perf/config/feature-checks/.gitignore
@@ -0,0 +1,2 @@
+*.d
+*.bin
diff --git a/tools/perf/config/feature-checks/Makefile 
b/tools/perf/config/feature-checks/Makefile
index 87e7900..e2bc0ed 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -1,94 +1,94 @@
 
 FILES= \
-   test-all\
-   test-backtrace  \
-   test-bionic \
-   test-dwarf  \
-   test-fortify-source \
-   test-glibc  \
-   test-gtk2   \
-   test-gtk2-infobar   \
-   test-hello  \
-   test-libaudit   \
-   test-libbfd \
-   test-liberty\
-   test-liberty-z  \
-   test-cplus-demangle \
-   test-libelf \
-   test-libelf-getphdrnum  \
-   test-libelf-mmap\
-   test-libnuma\
-   test-libperl\
-   test-libpython  \
-   test-libpython-version  \
-   test-libslang   \
-   test-libunwind  \
-   test-libunwind-debug-frame  \
-   test-on-exit\
-   test-stackprotector-all \
-   test-stackprotector \
-   test-timerfd
+   test-all.bin\
+   test-backtrace.bin  \
+   test-bionic.bin \
+   test-dwarf.bin  \
+   test-fortify-source.bin \
+   test-glibc.bin  \
+   test-gtk2.bin   \
+   test-gtk2-infobar.bin   \
+   test-hello.bin  \
+   test-libaudit.bin   \
+   test-libbfd.bin \
+   test-liberty.bin\
+   test-liberty-z.bin  \
+   test-cplus-demangle.bin \
+   test-libelf.bin \
+   test-libelf-getphdrnum.bin  \
+   test-libelf-mmap.bin\
+   test-libnuma.bin\
+   test-libperl.bin\
+   test-libpython.bin  \
+   test-libpython-version.bin  \
+   test-libslang.bin   \
+   test-libunwind.bin