Stephan Müller | 14 Sep 19:35 2014

[PATCH] Change userspace MKDEV, MAJOR, MINOR-macros from 8+8 bit, to 12+20 bit layout

Delete old userspace-only versions (8+8 bit). Instead expose the kernel-space
definitions (12+20 bit).

Signed-off-by: Stephan Mueller <fruktopus@...>

Browsing some code I found that user-space and kernel-space macros for (un-)packing major/minor device
numbers differ. The user-space ones using still the old 16 bit scheme. There was no explaining comment
around and most libraries have their own macros anyway so it should not be a problematic UAPI change. So
IMHO we could win some coherence in abandon this discrepancy.
Please correct me if I am wrong.

 include/linux/kdev_t.h      |  7 -------
 include/uapi/linux/kdev_t.h | 16 +++++++---------
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h
index c838abe..0b09c12 100644
--- a/include/linux/kdev_t.h
+++ b/include/linux/kdev_t.h
 <at>  <at>  -3,13 +3,6  <at>  <at> 

 #include <uapi/linux/kdev_t.h>

-#define MINORBITS	20
-#define MINORMASK	((1U << MINORBITS) - 1)
-#define MAJOR(dev)	((unsigned int) ((dev) >> MINORBITS))
-#define MINOR(dev)	((unsigned int) ((dev) & MINORMASK))
-#define MKDEV(ma,mi)	(((ma) << MINORBITS) | (mi))
(Continue reading)

Krzysztof Kozlowski | 12 Sep 08:53 2014

[PATCH v6 0/8] charger/mfd: max14577: Add support for MAX77836


This is a sixth version of patches adding support for
MAX77836 device to the max14577 drivers.

This patchset has been on the lists for quite long time and was already
reviewed by all necessary maintainers except power supply.
I need acks from power supply subsystem (patches: 3, 5-8).

Generally this should be pulled at once but some parts may be split
and pulled separately in following batches:
 - Patches 1 and 2: as MFD prerequisites,
 - Patches 3-5: adding actual charger code, depends on 1 and 2,
 - Patch 6: fuel-gauge, independent,
 - Patches 7 and 8: only documentation.

Lee Jones said he can take the set through his tree. Still I need acks
from power subsystem.

Everything rebased on Linus' tree (v3.17-rc2-9-g68e370289c29).

Changes since v5
1. 5/8: Remove 'inline' from functions (suggested by Andrew Morton).
2. Add Andrew Morton's acks.

Changes since v4
1. Add Lee Jones' acks to patch 1 and 2 (mfd).
2. power max17040 6/8: Remove duplicated (and not used) value of id
(Continue reading)

Alexei Starovoitov | 10 Sep 07:09 2014

[PATCH v11 net-next 00/12] eBPF syscall, verifier, testsuite

Hi David,

I've managed to reduce this set to 12:
Patches 1-4 establish BPF syscall shell for maps and programs.
Patches 5-10 add verifier step by step
Patch 11 exposes existing instruction macros to user space
Patch 12 adds test stubs and verifier testsuite from user space

I don't know how to reduce it further. Drop verifier and
have programs loaded without verification? Sounds wrong.
If anyone has other ideas, I'll gladly reduce it further.

Note that patches 1,3,4,7 add commands and attributes to the syscall
while being backwards compatible from each other, which should demonstrate
how other commands can be added in the future.

bpf_common.h patch (that we discussed earlier) I didn't include here
to reduce the number of patches. It can come next.

For those who have looked at the last set of 28 patches, the difference is:
- moved attaching to tracing and sockets to future patches
- moved hash table map type implementation to future
- split verifier further and moved LD_ABS checks and state prunning to future
- instead of running verifier testsuite on real tracing programs added
  test_stub.c with fake maps, context and helper functions to test verifier only
- rebased

Note, after this set the programs can be loaded for testing only. They cannot
be attached to any events. This will come in the next set.
(Continue reading)

Pranith Kumar | 4 Sep 17:58 2014

[PATCH Resend] memfd_test: Add missing argument to printf()

Add a missing path argument buf to printf() 

Signed-off-by: Pranith Kumar <bobby.prani@...>
Reviewed-by: David Herrmann <dh.herrmann@...>
 tools/testing/selftests/memfd/memfd_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index 3634c90..c343df8 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
 <at>  <at>  -205,7 +205,7  <at>  <at>  static void mfd_fail_open(int fd, int flags, mode_t mode)
 	sprintf(buf, "/proc/self/fd/%d", fd);
 	r = open(buf, flags, mode);
 	if (r >= 0) {
-		printf("open(%s) didn't fail as expected\n");
+		printf("open(%s) didn't fail as expected\n", buf);


Shuah Khan | 4 Sep 17:07 2014

[PATCH] selftests/memfd: fix mfd_fail_open() to pass in buf to printf

mfd_fail_open() doesn't pass in the buffer to printf resulting
in the following warning:

memfd_test.c: In function ‘mfd_fail_open’:
memfd_test.c:208:3: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
   printf("open(%s) didn't fail as expected\n");

This change fixes the problem.

Signed-off-by: Shuah Khan <shuahkh@...>
 tools/testing/selftests/memfd/memfd_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index cb5001b..0b9eafb 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
 <at>  <at>  -203,7 +203,7  <at>  <at>  static void mfd_fail_open(int fd, int flags, mode_t mode)
 	sprintf(buf, "/proc/self/fd/%d", fd);
 	r = open(buf, flags, mode);
 	if (r >= 0) {
-		printf("open(%s) didn't fail as expected\n");
+		printf("open(%s) didn't fail as expected\n", buf);

(Continue reading)

Pranith Kumar | 3 Sep 16:31 2014

[PATCH v3] memfd_test: Make it work on 32-bit systems

This test currently fails on 32-bit systems since we use u64 type to pass the
flags to fcntl.

This commit changes this to use 'unsigned int' type for flags to fcntl making it
work on 32-bit systems.

Signed-off-by: Pranith Kumar <bobby.prani@...>
Reviewed-by: David Herrmann <dh.herrmann@...>
 tools/testing/selftests/memfd/memfd_test.c | 34 ++++++++++++++----------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index 3634c90..cb5001b 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
 <at>  <at>  -59,9 +59,9  <at>  <at>  static void mfd_fail_new(const char *name, unsigned int flags)

-static __u64 mfd_assert_get_seals(int fd)
+static unsigned int mfd_assert_get_seals(int fd)
-	long r;
+	int r;

 	r = fcntl(fd, F_GET_SEALS);
 	if (r < 0) {
 <at>  <at>  -69,50 +69,48  <at>  <at>  static __u64 mfd_assert_get_seals(int fd)
(Continue reading)

Alexei Starovoitov | 3 Sep 05:17 2014

[PATCH v9 net-next 0/4] load imm64 insn and uapi/linux/bpf.h


- rebase on top of Hannes's patch in the same area [1]
- no changes to patches 1 and 2
- added patches 3 and 4 as RFC to address Daniel's concern.
  patch 3 moves eBPF instruction macros and
  patch 4 split macros which are shared between classic and eBPF
  into bpf_common.h
  3 and 4 will be used by verifier testsuite and will be reposted later
  during stage III

V8 thread with 'why' reasoning and end goal:

Original set [2] of ~28 patches I'm planning to present in 4 stages:

  I. this 2 patches to fork off llvm upstreaming
 II. bpf syscall with manpage and map implementation
III. bpf program load/unload with verifier testsuite (1st user of
     instruction macros from bpf.h and 1st user of load imm64 insn)
 IV. tracing, etc


Pavel Emelyanov | 2 Sep 19:17 2014

[PATCH] locks: Ability to test for flock presence on fd


There's a problem with getting information about who has a flock on
a specific file. The thing is that the "owner" field, that is shown in
/proc/locks is the pid of the task who created the flock, not the one
who _may_ hold it.

If the flock creator shared the file with some other task (by forking
or via scm_rights) and then died or closed the file, the information
shown in proc no longer corresponds to the reality.

This is critical for CRIU project, that tries to dump (and restore)
the state of running tasks. For example, let's take two tasks A and B
both opened a file "/foo", one of tasks places a LOCK_SH lock on the 
file and then "obfuscated" the owner field in /proc/locks. After this
we have no ways to find out who is the lock holder.

I'd like to note, that for LOCK_EX this problem is not critical -- we
may go to both tasks and "ask" them to LOCK_EX the file again (we can
do it in CRIU, I can tell more if required). The one who succeeds is 
the lock holder. With LOCK_SH this doesn't work. Trying to drop the
lock doesn't work either, as flock(LOCK_UN) reports 0 in both cases:
if the file is locked and if it is not.

That said, I'd like to propose the LOCK_TEST flag to the flock call,
that would check whether the lock of the given type (LOCK_SH or LOCK_EX)
exists on the file we test. It's not the same as the existing in-kernel
FL_ACCESS flag, which checks whether the new lock is possible, but
it's a new FL_TEST flag, that checks whether the existing lock is there.

(Continue reading)

Zhuang Jin Can | 2 Sep 08:58 2014

[PATCH] usb: gadget: f_fs: add usb_functionfs_descs_head_v2

Add usb_functionfs_descs_head_v2 structure for the new layout of

Signed-off-by: Zhuang Jin Can <jin.can.zhuang@...>
 include/uapi/linux/usb/functionfs.h |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
index 0154b28..0b3f9fc 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
 <at>  <at>  -32,6 +32,15  <at>  <at>  struct usb_endpoint_descriptor_no_audio {
 	__u8  bInterval;
 } __attribute__((packed));

+struct usb_functionfs_descs_head_v2 {
+	__le32 magic;
+	__le32 length;
+	__le32 flags;
+	__le32 fs_count;
+	__le32 hs_count;
+	__le32 ss_count;
+} __attribute__((packed));
 /* Legacy format, deprecated as of 3.14. */
 struct usb_functionfs_descs_head {
 	__le32 magic;

(Continue reading)

Minchan Kim | 1 Sep 09:20 2014

[PATCH v16 0/7] MADV_FREE support

This patch enable MADV_FREE hint for madvise syscall, which have
been supported by other OSes. [PATCH 1] includes the details.

[1] support MADVISE_FREE for !THP page so if VM encounter
THP page in syscall context, it splits THP page.
[2-6] is to preparing to call madvise syscall without THP plitting
[7] enable THP page support for MADV_FREE.

* from v15
 * Add more Acked-by - Rik van Riel
 * Rebased on mmotom-08-29-15-15

* from v14
 * Add more Ackedy-by from arch people(sparc, arm64 and arm)
 * Drop s390 since pmd_dirty/clean was merged

* from v13
 * Add more Ackedy-by from arch people(arm, arm64 and ppc)
 * Rebased on mmotm 2014-08-13-14-29

* from v12
 * Fix - skip to mark free pte on try_to_free_swap failed page - Kirill
 * Add more Acked-by from arch maintainers and Kirill

* From v11
 * Fix arm build - Steve
 * Separate patch for arm and arm64 - Steve
 * Remove unnecessary check - Kirill
 * Skip non-vm_normal page - Kirill
 * Add Acked-by - Zhang
(Continue reading)

Bird, Tim | 30 Aug 03:09 2014

[kselftest] kselftest wiki (was RE: [Ksummit-discuss] Fwd: Rough notes from testing unconference)

On Saturday, August 23, 2014 6:35 AM, Bird, Tim wrote:
> Also, I've requested a 'test' wiki on, where we can place
> notes, ideas, and lists of things to work on, or things in progress
> (like possible output format guidelines).
> I'll let everyone know when the wiki is set up.

There is now a kselftest wiki on at:

I believe anyone with a Linux Foundation account can edit it.
I have put together a main page, along with a few sub-pages for
some of the sub-projects (as I call them) that were discussed at
the kernel summit.

Please feel free to directly edit the wiki, or to let me know if
there's any content you'd like to see placed on the wiki.

 -- Tim

P.S.  I have copied lkml and linux-api on this.  I believe this is the first 
use of linux-api for discussions about kselftest.  If the linux-api maintainers
would prefer we get our own list, please let me know.--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo@...
More majordomo info at