Linux block layer
 help / color / mirror / Atom feed
* Re: [PATCH v3] block: trace completion of all bios.
From: NeilBrown @ 2017-03-26 23:17 UTC (permalink / raw)
  To: Ming Lei
  Cc: Christoph Hellwig, Jens Axboe, linux-block,
	open list:SOFTWARE RAID (Multiple Disks) SUPPORT,
	open list:DEVICE-MAPPER (LVM), Alasdair Kergon, Mike Snitzer,
	Shaohua Li, Linux Kernel Mailing List, Martin K . Petersen
In-Reply-To: <CACVXFVNC=-_f1jYo5bYw7X6TT8-g7UThw3zzzfrMaKVarnJvSQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4825 bytes --]

On Fri, Mar 24 2017, Ming Lei wrote:

> On Fri, Mar 24, 2017 at 8:07 AM, NeilBrown <neilb@suse.com> wrote:
...
>> @@ -102,6 +102,8 @@ struct bio {
>>  #define BIO_REFFED     8       /* bio has elevated ->bi_cnt */
>>  #define BIO_THROTTLED  9       /* This bio has already been subjected to
>>                                  * throttling rules. Don't do it again. */
>> +#define BIO_TRACE_COMPLETION 10        /* bio_endio() should trace the final completion
>> +                                * of this bio. */
>
> This may not be a good idea, since the flag space is quite small(12).

which means there are 2 unused bits and I only want to use 1.  It should
fit.
I'm a bit perplexed why 4 bits a reserved for the BVEC_POOL number which
ranges from 0 to 7....

But if these bits really are a scarce resource, we should stop wasting
them.
The patch below makes bit 7 (BIO_CHAIN) available.  We could probably make
bit 8 (BIO_REFFED) available using a similar technique.
BIO_QUIET is only relevant if bi_error is non-zero and bi_error has a
limited range, so a bit in there could be used instead. In fact,
MAX_ERRNO is 4096, so bi_error could be a 'short'.  That could save 2
whole bytes ... or make 16 more flag bits available.

So I don't think you concern about a shortage of spare flag bits is valid.

Thanks,
NeilBrown

diff --git a/block/bio.c b/block/bio.c
index c1272986133e..1703786a206a 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -274,7 +274,7 @@ void bio_init(struct bio *bio, struct bio_vec *table,
 	      unsigned short max_vecs)
 {
 	memset(bio, 0, sizeof(*bio));
-	atomic_set(&bio->__bi_remaining, 1);
+	atomic_set(&bio->__bi_remaining, 0);
 	atomic_set(&bio->__bi_cnt, 1);
 
 	bio->bi_io_vec = table;
@@ -300,7 +300,7 @@ void bio_reset(struct bio *bio)
 
 	memset(bio, 0, BIO_RESET_BYTES);
 	bio->bi_flags = flags;
-	atomic_set(&bio->__bi_remaining, 1);
+	atomic_set(&bio->__bi_remaining, 0);
 }
 EXPORT_SYMBOL(bio_reset);
 
@@ -1794,20 +1794,15 @@ EXPORT_SYMBOL(bio_flush_dcache_pages);
 static inline bool bio_remaining_done(struct bio *bio)
 {
 	/*
-	 * If we're not chaining, then ->__bi_remaining is always 1 and
+	 * If we're not chaining, then ->__bi_remaining is always 0 and
 	 * we always end io on the first invocation.
 	 */
-	if (!bio_flagged(bio, BIO_CHAIN))
+	if (atomic_read(&bio->__bi_remaining) == 0)
 		return true;
 
 	BUG_ON(atomic_read(&bio->__bi_remaining) <= 0);
 
-	if (atomic_dec_and_test(&bio->__bi_remaining)) {
-		bio_clear_flag(bio, BIO_CHAIN);
-		return true;
-	}
-
-	return false;
+	return atomic_dec_and_test(&bio->__bi_remaining);
 }
 
 /**
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 8e521194f6fc..d15245544111 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -664,13 +664,19 @@ static inline struct bio *bio_list_get(struct bio_list *bl)
 }
 
 /*
- * Increment chain count for the bio. Make sure the CHAIN flag update
- * is visible before the raised count.
+ * Increment chain count for the bio.
  */
 static inline void bio_inc_remaining(struct bio *bio)
 {
-	bio_set_flag(bio, BIO_CHAIN);
-	smp_mb__before_atomic();
+	/*
+	 * Calls to bio_inc_remaining() cannot race
+	 * with the final call to bio_end_io(), and
+	 * the first call cannot race with other calls,
+	 * so if __bi_remaining appears to be zero, there
+	 * can be no race which might change it.
+	 */
+	if (atomic_read(&bio->__bi_remaining) == 0)
+		atomic_set(&bio->__bi_remaining, 1);
 	atomic_inc(&bio->__bi_remaining);
 }
 
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index db7a57ee0e58..2deea4501d14 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -46,6 +46,15 @@ struct bio {
 	unsigned int		bi_seg_front_size;
 	unsigned int		bi_seg_back_size;
 
+	/* __bi_remaining records the number of completion events
+	 * (i.e. calls to bi_end_io()) that need to happen before this
+	 * bio is truly complete.
+	 * A value of '0' means that there will only ever be one completion
+	 * event, so there will be no racing and no need for an atomic operation
+	 * to detect the last event.
+	 * Any other value represents a simple count subject to atomic_inc() and
+	 * atomic_dec_and_test().
+	 */
 	atomic_t		__bi_remaining;
 
 	bio_end_io_t		*bi_end_io;
@@ -98,7 +107,7 @@ struct bio {
 #define BIO_USER_MAPPED 4	/* contains user pages */
 #define BIO_NULL_MAPPED 5	/* contains invalid user pages */
 #define BIO_QUIET	6	/* Make BIO Quiet */
-#define BIO_CHAIN	7	/* chained bio, ->bi_remaining in effect */
+/* 7 unused */
 #define BIO_REFFED	8	/* bio has elevated ->bi_cnt */
 #define BIO_THROTTLED	9	/* This bio has already been subjected to
 				 * throttling rules. Don't do it again. */

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related

* [BUG] Deadlock due due to interactions of block, RCU, and cpu offline
From: Jeffrey Hugo @ 2017-03-26 23:10 UTC (permalink / raw)
  To: linux-kernel, linux-block
  Cc: pprakash, Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Jens Axboe,
	Sebastian Andrzej Siewior, Thomas Gleixner, Richard Cochran,
	Boris Ostrovsky, Richard Weinberger

Hello,

I observe that running stress-ng with the cpu-online and fstat tests 
results in a deadlock of hung tasks:

[  366.810486] INFO: task stress-ng-cpu-o:2590 blocked for more than 120 
seconds.
[  366.817689]       Not tainted 4.9.0 #39
[  366.821504] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" 
disables this message.
[  366.829320] stress-ng-cpu-o D    0  2590   2589 0x00000008
[  366.834803] Call trace:
[  366.837222] [<ffff000008085dd0>] __switch_to+0x60/0x70
[  366.842338] [<ffff000008a23c18>] __schedule+0x178/0x648
[  366.847550] [<ffff000008a24120>] schedule+0x38/0x98
[  366.852408] [<ffff00000848b774>] blk_mq_freeze_queue_wait+0x64/0x1a8
[  366.858749] [<ffff00000848e9d4>] blk_mq_queue_reinit_work+0x74/0x110
[  366.865081] [<ffff00000848ea94>] blk_mq_queue_reinit_dead+0x24/0x30
[  366.871335] [<ffff0000080c9898>] cpuhp_invoke_callback+0x98/0x4a8
[  366.877411] [<ffff0000080cb084>] cpuhp_down_callbacks+0x114/0x150
[  366.883484] [<ffff000008a22578>] _cpu_down+0x100/0x1d8
[  366.888609] [<ffff0000080cbfdc>] do_cpu_down+0x4c/0x78
[  366.893727] [<ffff0000080cc02c>] cpu_down+0x24/0x30
[  366.898593] [<ffff0000086aaf28>] cpu_subsys_offline+0x20/0x30
[  366.904318] [<ffff0000086a53d8>] device_offline+0xa8/0xd8
[  366.909704] [<ffff0000086a550c>] online_store+0x4c/0xa8
[  366.914907] [<ffff0000086a241c>] dev_attr_store+0x44/0x60
[  366.920294] [<ffff0000082b6a24>] sysfs_kf_write+0x5c/0x78
[  366.925672] [<ffff0000082b5cec>] kernfs_fop_write+0xbc/0x1e8
[  366.931318] [<ffff000008238320>] __vfs_write+0x48/0x138
[  366.936526] [<ffff000008239078>] vfs_write+0xa8/0x1c0
[  366.941557] [<ffff00000823a08c>] SyS_write+0x54/0xb0
[  366.946511] [<ffff000008083370>] el0_svc_naked+0x24/0x28
[  366.951800] INFO: task stress-ng-fstat:2591 blocked for more than 120 
seconds.
[  366.959008]       Not tainted 4.9.0 #39
[  366.962823] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" 
disables this message.
[  366.970640] stress-ng-fstat D    0  2591   2589 0x00000000
[  366.976105] Call trace:
[  366.978540] [<ffff000008085dd0>] __switch_to+0x60/0x70
[  366.983658] [<ffff000008a23c18>] __schedule+0x178/0x648
[  366.988870] [<ffff000008a24120>] schedule+0x38/0x98
[  366.993727] [<ffff00000848b774>] blk_mq_freeze_queue_wait+0x64/0x1a8
[  367.000068] [<ffff00000848e2d0>] blk_mq_freeze_queue+0x28/0x38
[  367.005880] [<ffff0000086d480c>] lo_release+0x64/0x90
[  367.010919] [<ffff000008278bd4>] __blkdev_put+0x26c/0x2c8
[  367.016300] [<ffff000008278fec>] blkdev_put+0x54/0x128
[  367.021418] [<ffff0000082790ec>] blkdev_close+0x2c/0x40
[  367.026631] [<ffff00000823ab58>] __fput+0xa0/0x1e0
[  367.031401] [<ffff00000823ad10>] ____fput+0x20/0x30
[  367.036266] [<ffff0000080e7a40>] task_work_run+0xc8/0xe8
[  367.041557] [<ffff0000080882b4>] do_notify_resume+0xac/0xb8
[  367.047116] [<ffff000008083294>] work_pending+0x8/0x10

I have tested and found this issue to be reproducible on both x86 and 
ARM64 architectures on 4.7, 4.8, 4.9, 4.10, and 4.11-rc3 kernels.

Using the below test methodology [1], the issue reproduces within a few 
minutes.

Using ftrace, I have analyzed the issue on 4.9 and I believe I've found 
the root cause [2].

Based on my analysis, I have developed a fix [3], which addresses the 
issue as I am able to run stress-ng for over an hour where I was unable 
to do so before, however I do not know the full extend of impacts from 
this fix, and look for guidance from the community to determine the 
final fix.


[1] Test methodology
--------------------
Boot a multicore system such as a desktop i5 system with nr_cpus=2

Enable all logging to determine when the deadlock occurs (prints from 
test stop flowing out of the serial port)
      echo 1 > /sys/module/printk/parameters/ignore_loglevel

Run stress-ng
      stress-ng --fstat 1 --cpu-online 1 -t 3600

Wait for the test output to stop, and the hung task watchdog to fire.


[2] Analysis
------------
Again, this analysis is based upon the 4.9 kernel, but believe it to 
still apply to newer kernels.

I conclude that the hung tasks occur due to a race condition which 
results in a deadlock.

The race condition occurs between "normal" work in the block layer on a 
core (the stress-ng-fstat task in the above dump) and cpu offline of 
that core (the stress-ng-cpu-o task in the above dump).

The fput() from userspace in the fstat task results in a call to 
blk_mq_freeze_queue(), which drops the last reference to the queue via 
percpu_ref_kill(), and then waits for the ref count of the queue to hit 
0 in blk_mq_freeze_queue_wait().  percpu_ref_kill() will result in 
__percpu_ref_switch_to_atomic() which will use call_rcu_sched() to setup 
delayed work to finalize the percpu_ref cleanup and drop the ref count to 0.

Note that call_rcu_sched() queues the work to a per-cpu queue, thus the 
work can only be run on the core it is queued on, by the work thread 
that is pinned to that core.

It is a race between this work running, and the cpu offline processing.

If the cpu offline processing is able to get to and process the 
RCU/tree:online state before the queued work from the block layer,  then 
the pinned work thread will be migrated to another core via 
rcutree_offline_cpu(), and the work will not be able to execute.

This race condition does not result in deadlock until later in the cpu 
offline processing.  Once we hit the block/mq:prepare state the block 
layer freezes all the queues and waits for the ref counts to hit 0. 
This normally works because at this point the cpu being offlined is dead 
from cpu:teardown, and the offline processing is occuring on another 
active cpu, so call_rcu_sched() will queue work to an active cpu where 
it can get processed.  However the fstat process already did that work 
for one of the queues to be frozen in the block layer, so the processing 
of the block/mq:prepare state waits on the same ref count as fstat to 
hit 0.  Thus we see the result of this as the stress-ng-cpu-o task above.

The block/mq:prepare processing stalls the cpu offline processing which 
causes a deadlock because the processing does not get to the 
RCU/tree:prepare state which migrates all of the queued work from the 
offline cpu to another cpu, which would allow the work that the fstat 
task queued to execute, drop the ref count to 0, and unblock both 
stalled tasks.

By reordering the cpu offline states such the shutdown processing of 
RCU/tree:prepare occurs before block/mq:prepare [3], we prevent deadlock 
by enabling the queued work in the RCU framework to run elsewhere, and 
eventually unblock the tasks waiting on the ref count.

However, it is not entirely clear what are the full ramifications of 
this reorder.  I assume the ordering of these cpu online/offline states 
is carefully considered, and without that knowledge, I could not say for 
certain that my fix [3] is safe.

What is the opinion of the domain experts?

-- 
Jeffrey Hugo
Qualcomm Datacenter Technologies as an affiliate of Qualcomm 
Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.


[3] Proposed fix
---8>---
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index afe641c..9b86db9 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -49,6 +49,7 @@ enum cpuhp_state {
         CPUHP_ARM_SHMOBILE_SCU_PREPARE,
         CPUHP_SH_SH3X_PREPARE,
         CPUHP_BLK_MQ_PREPARE,
+       CPUHP_RCUTREE_PREP2,
         CPUHP_TIMERS_DEAD,
         CPUHP_NOTF_ERR_INJ_PREPARE,
         CPUHP_MIPS_SOC_PREPARE,
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 29de1a9..b46c573 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1289,6 +1289,11 @@ static int __init cpu_hotplug_pm_sync_init(void)
         [CPUHP_RCUTREE_PREP] = {
                 .name                   = "RCU/tree:prepare",
                 .startup.single         = rcutree_prepare_cpu,
+               .teardown.single        = NULL,
+       },
+       [CPUHP_RCUTREE_PREP2] = {
+               .name                   = "RCU/tree:dead",
+               .startup.single         = NULL,
                 .teardown.single        = rcutree_dead_cpu,
         },
         /*

^ permalink raw reply related

* Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock
From: Julia Lawall @ 2017-03-26 10:54 UTC (permalink / raw)
  To: Tahsin Erdogan
  Cc: Tejun Heo, Jens Axboe, linux-block, David Rientjes, linux-kernel,
	linux-block, David Rientjes, linux-kernel

Is an unlock needed before line 848?  Or does blkg_lookup_check take care
of it?

julia

---------- Forwarded message ----------
Date: Sun, 26 Mar 2017 07:50:17 +0800
From: kbuild test robot <fengguang.wu@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue
    spinlock

CC: kbuild-all@01.org
In-Reply-To: <20170324215627.12831-1-tahsin@google.com>
TO: Tahsin Erdogan <tahsin@google.com>
CC: Tejun Heo <tj@kernel.org>, Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org, David Rientjes <rientjes@google.com>, linux-kernel@vger.kernel.org, Tahsin Erdogan <tahsin@google.com>
CC: linux-block@vger.kernel.org, David Rientjes <rientjes@google.com>, linux-kernel@vger.kernel.org, Tahsin Erdogan <tahsin@google.com>

Hi Tahsin,

[auto build test WARNING on block/for-next]
[also build test WARNING on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Tahsin-Erdogan/blkcg-allocate-struct-blkcg_gq-outside-request-queue-spinlock/20170326-020755
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago

>> block/blk-cgroup.c:901:1-7: preceding lock on line 839
   block/blk-cgroup.c:901:1-7: preceding lock on line 876

git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d6344a76907e470f483dcb19998d438d19f6432d
vim +901 block/blk-cgroup.c

d6344a76 Tahsin Erdogan 2017-03-24  833  		goto fail;
5f6c2d2b Tejun Heo      2015-07-22  834  	}
e56da7e2 Tejun Heo      2012-03-05  835
d6344a76 Tahsin Erdogan 2017-03-24  836  	q = disk->queue;
d6344a76 Tahsin Erdogan 2017-03-24  837
e56da7e2 Tejun Heo      2012-03-05  838  	rcu_read_lock();
d6344a76 Tahsin Erdogan 2017-03-24 @839  	spin_lock_irq(q->queue_lock);
da8b0662 Tejun Heo      2012-04-13  840
d6344a76 Tahsin Erdogan 2017-03-24  841  	blkg = blkg_lookup_check(blkcg, pol, q);
d6344a76 Tahsin Erdogan 2017-03-24  842  	if (IS_ERR(blkg)) {
d6344a76 Tahsin Erdogan 2017-03-24  843  		ret = PTR_ERR(blkg);
d6344a76 Tahsin Erdogan 2017-03-24  844  		goto fail_unlock;
d6344a76 Tahsin Erdogan 2017-03-24  845  	}
d6344a76 Tahsin Erdogan 2017-03-24  846
d6344a76 Tahsin Erdogan 2017-03-24  847  	if (blkg)
d6344a76 Tahsin Erdogan 2017-03-24  848  		goto success;
d6344a76 Tahsin Erdogan 2017-03-24  849
d6344a76 Tahsin Erdogan 2017-03-24  850  	/*
d6344a76 Tahsin Erdogan 2017-03-24  851  	 * Create blkgs walking down from blkcg_root to @blkcg, so that all
d6344a76 Tahsin Erdogan 2017-03-24  852  	 * non-root blkgs have access to their parents.
d6344a76 Tahsin Erdogan 2017-03-24  853  	 */
d6344a76 Tahsin Erdogan 2017-03-24  854  	while (true) {
d6344a76 Tahsin Erdogan 2017-03-24  855  		struct blkcg *pos = blkcg;
d6344a76 Tahsin Erdogan 2017-03-24  856  		struct blkcg *parent;
d6344a76 Tahsin Erdogan 2017-03-24  857  		struct blkcg_gq *new_blkg;
e56da7e2 Tejun Heo      2012-03-05  858
d6344a76 Tahsin Erdogan 2017-03-24  859  		parent = blkcg_parent(blkcg);
d6344a76 Tahsin Erdogan 2017-03-24  860  		while (parent && !__blkg_lookup(parent, q, false)) {
d6344a76 Tahsin Erdogan 2017-03-24  861  			pos = parent;
d6344a76 Tahsin Erdogan 2017-03-24  862  			parent = blkcg_parent(parent);
d6344a76 Tahsin Erdogan 2017-03-24  863  		}
d6344a76 Tahsin Erdogan 2017-03-24  864
d6344a76 Tahsin Erdogan 2017-03-24  865  		/* Drop locks to do new blkg allocation with GFP_KERNEL. */
d6344a76 Tahsin Erdogan 2017-03-24  866  		spin_unlock_irq(q->queue_lock);
d6344a76 Tahsin Erdogan 2017-03-24  867  		rcu_read_unlock();
d6344a76 Tahsin Erdogan 2017-03-24  868
d6344a76 Tahsin Erdogan 2017-03-24  869  		new_blkg = blkg_alloc(pos, q, GFP_KERNEL);
d6344a76 Tahsin Erdogan 2017-03-24  870  		if (unlikely(!new_blkg)) {
d6344a76 Tahsin Erdogan 2017-03-24  871  			ret = -ENOMEM;
d6344a76 Tahsin Erdogan 2017-03-24  872  			goto fail;
d6344a76 Tahsin Erdogan 2017-03-24  873  		}
d6344a76 Tahsin Erdogan 2017-03-24  874
d6344a76 Tahsin Erdogan 2017-03-24  875  		rcu_read_lock();
d6344a76 Tahsin Erdogan 2017-03-24  876  		spin_lock_irq(q->queue_lock);
d6344a76 Tahsin Erdogan 2017-03-24  877
d6344a76 Tahsin Erdogan 2017-03-24  878  		blkg = blkg_lookup_check(pos, pol, q);
e56da7e2 Tejun Heo      2012-03-05  879  		if (IS_ERR(blkg)) {
e56da7e2 Tejun Heo      2012-03-05  880  			ret = PTR_ERR(blkg);
d6344a76 Tahsin Erdogan 2017-03-24  881  			goto fail_unlock;
d6344a76 Tahsin Erdogan 2017-03-24  882  		}
d6344a76 Tahsin Erdogan 2017-03-24  883
d6344a76 Tahsin Erdogan 2017-03-24  884  		if (blkg) {
d6344a76 Tahsin Erdogan 2017-03-24  885  			blkg_free(new_blkg);
d6344a76 Tahsin Erdogan 2017-03-24  886  		} else {
d6344a76 Tahsin Erdogan 2017-03-24  887  			blkg = blkg_create(pos, q, new_blkg);
d6344a76 Tahsin Erdogan 2017-03-24  888  			if (unlikely(IS_ERR(blkg))) {
d6344a76 Tahsin Erdogan 2017-03-24  889  				ret = PTR_ERR(blkg);
d6344a76 Tahsin Erdogan 2017-03-24  890  				goto fail_unlock;
d6344a76 Tahsin Erdogan 2017-03-24  891  			}
d6344a76 Tahsin Erdogan 2017-03-24  892  		}
d6344a76 Tahsin Erdogan 2017-03-24  893
d6344a76 Tahsin Erdogan 2017-03-24  894  		if (pos == blkcg)
d6344a76 Tahsin Erdogan 2017-03-24  895  			goto success;
d6344a76 Tahsin Erdogan 2017-03-24  896  	}
d6344a76 Tahsin Erdogan 2017-03-24  897  success:
d6344a76 Tahsin Erdogan 2017-03-24  898  	ctx->disk = disk;
d6344a76 Tahsin Erdogan 2017-03-24  899  	ctx->blkg = blkg;
d6344a76 Tahsin Erdogan 2017-03-24  900  	ctx->body = body;
d6344a76 Tahsin Erdogan 2017-03-24 @901  	return 0;
d6344a76 Tahsin Erdogan 2017-03-24  902
d6344a76 Tahsin Erdogan 2017-03-24  903  fail_unlock:
d6344a76 Tahsin Erdogan 2017-03-24  904  	spin_unlock_irq(q->queue_lock);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply

* [PATCH] fs: remove _submit_bh()
From: Eric Biggers @ 2017-03-26  4:02 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-block, Alexander Viro, Eric Biggers, Darrick J . Wong

From: Eric Biggers <ebiggers@google.com>

_submit_bh() allowed submitting a buffer_head for I/O using custom
bio_flags.  It used to be used by jbd to set BIO_SNAP_STABLE, introduced
by commit 713685111774 ("mm: make snapshotting pages for stable writes a
per-bio operation").  However, the code and flag has since been removed
and no _submit_bh() users remain.

These days, bio_flags are mostly used internally by the block layer to
track the state of bio's.  As such, it doesn't really make sense for
filesystems to use them instead of op_flags when wanting special
behavior for block requests.

Therefore, remove _submit_bh() and trim the bio_flags argument from
submit_bh_wbc().

Cc: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/buffer.c                 | 19 +++++--------------
 include/linux/buffer_head.h |  2 --
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 9196f2a270da..68dc05ce06a5 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -49,7 +49,6 @@
 
 static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
 static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
-			 unsigned long bio_flags,
 			 struct writeback_control *wbc);
 
 #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
@@ -1830,7 +1829,7 @@ int __block_write_full_page(struct inode *inode, struct page *page,
 	do {
 		struct buffer_head *next = bh->b_this_page;
 		if (buffer_async_write(bh)) {
-			submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc);
+			submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, wbc);
 			nr_underway++;
 		}
 		bh = next;
@@ -1884,7 +1883,7 @@ int __block_write_full_page(struct inode *inode, struct page *page,
 		struct buffer_head *next = bh->b_this_page;
 		if (buffer_async_write(bh)) {
 			clear_buffer_dirty(bh);
-			submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc);
+			submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, wbc);
 			nr_underway++;
 		}
 		bh = next;
@@ -3095,7 +3094,7 @@ void guard_bio_eod(int op, struct bio *bio)
 }
 
 static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
-			 unsigned long bio_flags, struct writeback_control *wbc)
+			 struct writeback_control *wbc)
 {
 	struct bio *bio;
 
@@ -3130,7 +3129,6 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
 
 	bio->bi_end_io = end_bio_bh_io_sync;
 	bio->bi_private = bh;
-	bio->bi_flags |= bio_flags;
 
 	/* Take care of bh's that straddle the end of the device */
 	guard_bio_eod(op, bio);
@@ -3145,16 +3143,9 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
 	return 0;
 }
 
-int _submit_bh(int op, int op_flags, struct buffer_head *bh,
-	       unsigned long bio_flags)
+int submit_bh(int op, int op_flags, struct buffer_head *bh)
 {
-	return submit_bh_wbc(op, op_flags, bh, bio_flags, NULL);
-}
-EXPORT_SYMBOL_GPL(_submit_bh);
-
-int submit_bh(int op, int op_flags,  struct buffer_head *bh)
-{
-	return submit_bh_wbc(op, op_flags, bh, 0, NULL);
+	return submit_bh_wbc(op, op_flags, bh, NULL);
 }
 EXPORT_SYMBOL(submit_bh);
 
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 79591c3660cc..bd029e52ef5e 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -196,8 +196,6 @@ void ll_rw_block(int, int, int, struct buffer_head * bh[]);
 int sync_dirty_buffer(struct buffer_head *bh);
 int __sync_dirty_buffer(struct buffer_head *bh, int op_flags);
 void write_dirty_buffer(struct buffer_head *bh, int op_flags);
-int _submit_bh(int op, int op_flags, struct buffer_head *bh,
-	       unsigned long bio_flags);
 int submit_bh(int, int, struct buffer_head *);
 void write_boundary_block(struct block_device *bdev,
 			sector_t bblock, unsigned blocksize);
-- 
2.12.1

^ permalink raw reply related

* Re: [PATCH 1/2] blk-stat: convert blk-stat bucket callback to signed
From: Omar Sandoval @ 2017-03-26  2:49 UTC (permalink / raw)
  To: sbates; +Cc: axboe, linux-block, linux-nvme, Damien.LeMoal
In-Reply-To: <1490494692-2416-2-git-send-email-sbates@raithlin.com>

Hey, Stephen,

On Sat, Mar 25, 2017 at 08:18:11PM -0600, sbates@raithlin.com wrote:
> From: Stephen Bates <sbates@raithlin.com>
> 
> In order to allow for filtering of IO based on some other properties
> of the request than direction we allow the bucket function to return
> an int.
> 
> If the bucket callback returns a negative do no count it in the stats
> accumulation.

This is great, I had it this way at first but didn't know if anyone
would want to omit stats in this way. A couple of comments below.

> Signed-off-by: Stephen Bates <sbates@raithlin.com>
> ---
>  block/blk-stat.c | 8 +++++---
>  block/blk-stat.h | 9 +++++----
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/block/blk-stat.c b/block/blk-stat.c
> index 188b535..936adfb 100644
> --- a/block/blk-stat.c
> +++ b/block/blk-stat.c
> @@ -17,9 +17,9 @@ struct blk_queue_stats {
>  	spinlock_t lock;
>  };
>  
> -unsigned int blk_stat_rq_ddir(const struct request *rq)
> +int blk_stat_rq_ddir(const struct request *rq)
>  {
> -	return rq_data_dir(rq);
> +	return (int)rq_data_dir(rq);

The cast here here isn't necessary, let's leave it off.

>  }
>  EXPORT_SYMBOL_GPL(blk_stat_rq_ddir);
>  
> @@ -100,6 +100,8 @@ void blk_stat_add(struct request *rq)
>  	list_for_each_entry_rcu(cb, &q->stats->callbacks, list) {
>  		if (blk_stat_is_active(cb)) {
>  			bucket = cb->bucket_fn(rq);
> +			if (bucket < 0)
> +				continue;

You also need to change the declaration of bucket to int above.

>  			stat = &this_cpu_ptr(cb->cpu_stat)[bucket];
>  			__blk_stat_add(stat, value);
>  		}
> @@ -131,7 +133,7 @@ static void blk_stat_timer_fn(unsigned long data)
>  
>  struct blk_stat_callback *
>  blk_stat_alloc_callback(void (*timer_fn)(struct blk_stat_callback *),
> -			unsigned int (*bucket_fn)(const struct request *),
> +			int (*bucket_fn)(const struct request *),
>  			unsigned int buckets, void *data)
>  {
>  	struct blk_stat_callback *cb;
> diff --git a/block/blk-stat.h b/block/blk-stat.h
> index 6ad5b8c..7417805 100644
> --- a/block/blk-stat.h
> +++ b/block/blk-stat.h
> @@ -41,9 +41,10 @@ struct blk_stat_callback {
>  
>  	/**
>  	 * @bucket_fn: Given a request, returns which statistics bucket it
> -	 * should be accounted under.
> +	 * should be accounted under. Return -1 for no bucket for this
> +	 * request.
>  	 */
> -	unsigned int (*bucket_fn)(const struct request *);
> +	int (*bucket_fn)(const struct request *);
>  
>  	/**
>  	 * @buckets: Number of statistics buckets.
> @@ -98,7 +99,7 @@ static inline u64 blk_stat_time(struct blk_issue_stat *stat)
>   *
>   * Return: Data direction of the request, either READ or WRITE.
>   */
> -unsigned int blk_stat_rq_ddir(const struct request *rq);
> +int blk_stat_rq_ddir(const struct request *rq);
>  
>  /**
>   * blk_stat_alloc_callback() - Allocate a block statistics callback.
> @@ -113,7 +114,7 @@ unsigned int blk_stat_rq_ddir(const struct request *rq);
>   */
>  struct blk_stat_callback *
>  blk_stat_alloc_callback(void (*timer_fn)(struct blk_stat_callback *),
> -			unsigned int (*bucket_fn)(const struct request *),
> +			int (*bucket_fn)(const struct request *),
>  			unsigned int buckets, void *data);
>  
>  /**
> -- 
> 2.7.4
> 

^ permalink raw reply

* [PATCH 2/2] blk-stat: add a poll_size value to the request_queue struct
From: sbates @ 2017-03-26  2:18 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-nvme, Damien.LeMoal, osandov, sbates
In-Reply-To: <1490494692-2416-1-git-send-email-sbates@raithlin.com>

From: Stephen Bates <sbates@raithlin.com>

In order to bucket IO for the polling algorithm we use a sysfs entry
to set the filter value. It is signed and we will use that as follows:

 0   : No filtering. All IO are considered in stat generation
 > 0 : Filtering based on IO of exactly this size only.
 < 0 : Filtering based on IO less than or equal to -1 time this value.

Use this member to implement a new bucket function for the io polling
stats.

Signed-off-by: Stephen Bates <sbates@raithlin.com>
---
 block/blk-mq.c         | 17 +++++++++++++++--
 block/blk-sysfs.c      | 30 ++++++++++++++++++++++++++++++
 include/linux/blkdev.h |  1 +
 3 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 5ff66f2..5ea9481 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2327,6 +2327,18 @@ static void blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set,
 	blk_mq_sysfs_register(q);
 }
 
+int blk_mq_poll_stats_bucket(const struct request *rq)
+{
+	int val = rq->q->poll_size;
+
+	if ((val == 0) ||
+	    (val > 0 && blk_rq_bytes(rq) == val) ||
+	    (val < 0 && blk_rq_bytes(rq) <= -val))
+		return (int)rq_data_dir(rq);
+
+	return -1;
+}
+
 struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
 						  struct request_queue *q)
 {
@@ -2338,7 +2350,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
 		goto err_exit;
 
 	q->poll_cb = blk_stat_alloc_callback(blk_mq_poll_stats_fn,
-					     blk_stat_rq_ddir, 2, q);
+					     blk_mq_poll_stats_bucket, 2, q);
 	if (!q->poll_cb)
 		goto err_exit;
 
@@ -2387,9 +2399,10 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
 	q->nr_requests = set->queue_depth;
 
 	/*
-	 * Default to classic polling
+	 * Default to classic polling. Default to considering all IO.
 	 */
 	q->poll_nsec = -1;
+	q->poll_size = 0;
 
 	if (set->ops->complete)
 		blk_queue_softirq_done(q, set->ops->complete);
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index fa831cb..000d5db 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -394,6 +394,29 @@ static ssize_t queue_poll_delay_store(struct request_queue *q, const char *page,
 	return count;
 }
 
+static ssize_t queue_poll_size_show(struct request_queue *q, char *page)
+{
+	return sprintf(page, "%d\n", q->poll_size);
+}
+
+static ssize_t queue_poll_size_store(struct request_queue *q, const char *page,
+				     size_t count)
+{
+	int err, val;
+
+	if (!q->mq_ops || !q->mq_ops->poll)
+		return -EINVAL;
+
+	err = kstrtoint(page, 10, &val);
+	if (err < 0)
+		return err;
+
+	q->poll_size = val;
+
+	return count;
+}
+
+
 static ssize_t queue_poll_show(struct request_queue *q, char *page)
 {
 	return queue_var_show(test_bit(QUEUE_FLAG_POLL, &q->queue_flags), page);
@@ -654,6 +677,12 @@ static struct queue_sysfs_entry queue_poll_entry = {
 	.store = queue_poll_store,
 };
 
+static struct queue_sysfs_entry queue_poll_size_entry = {
+	.attr = {.name = "io_poll_size", .mode = S_IRUGO | S_IWUSR },
+	.show = queue_poll_size_show,
+	.store = queue_poll_size_store,
+};
+
 static struct queue_sysfs_entry queue_poll_delay_entry = {
 	.attr = {.name = "io_poll_delay", .mode = S_IRUGO | S_IWUSR },
 	.show = queue_poll_delay_show,
@@ -710,6 +739,7 @@ static struct attribute *default_attrs[] = {
 	&queue_dax_entry.attr,
 	&queue_wb_lat_entry.attr,
 	&queue_poll_delay_entry.attr,
+	&queue_poll_size_entry.attr,
 	NULL,
 };
 
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 1a7dc42..7ff5388 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -517,6 +517,7 @@ struct request_queue {
 
 	unsigned int		rq_timeout;
 	int			poll_nsec;
+	int			poll_size;
 
 	struct blk_stat_callback	*poll_cb;
 	struct blk_rq_stat	poll_stat[2];
-- 
2.7.4

^ permalink raw reply related

* [PATCH 1/2] blk-stat: convert blk-stat bucket callback to signed
From: sbates @ 2017-03-26  2:18 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-nvme, Damien.LeMoal, osandov, sbates
In-Reply-To: <1490494692-2416-1-git-send-email-sbates@raithlin.com>

From: Stephen Bates <sbates@raithlin.com>

In order to allow for filtering of IO based on some other properties
of the request than direction we allow the bucket function to return
an int.

If the bucket callback returns a negative do no count it in the stats
accumulation.

Signed-off-by: Stephen Bates <sbates@raithlin.com>
---
 block/blk-stat.c | 8 +++++---
 block/blk-stat.h | 9 +++++----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/block/blk-stat.c b/block/blk-stat.c
index 188b535..936adfb 100644
--- a/block/blk-stat.c
+++ b/block/blk-stat.c
@@ -17,9 +17,9 @@ struct blk_queue_stats {
 	spinlock_t lock;
 };
 
-unsigned int blk_stat_rq_ddir(const struct request *rq)
+int blk_stat_rq_ddir(const struct request *rq)
 {
-	return rq_data_dir(rq);
+	return (int)rq_data_dir(rq);
 }
 EXPORT_SYMBOL_GPL(blk_stat_rq_ddir);
 
@@ -100,6 +100,8 @@ void blk_stat_add(struct request *rq)
 	list_for_each_entry_rcu(cb, &q->stats->callbacks, list) {
 		if (blk_stat_is_active(cb)) {
 			bucket = cb->bucket_fn(rq);
+			if (bucket < 0)
+				continue;
 			stat = &this_cpu_ptr(cb->cpu_stat)[bucket];
 			__blk_stat_add(stat, value);
 		}
@@ -131,7 +133,7 @@ static void blk_stat_timer_fn(unsigned long data)
 
 struct blk_stat_callback *
 blk_stat_alloc_callback(void (*timer_fn)(struct blk_stat_callback *),
-			unsigned int (*bucket_fn)(const struct request *),
+			int (*bucket_fn)(const struct request *),
 			unsigned int buckets, void *data)
 {
 	struct blk_stat_callback *cb;
diff --git a/block/blk-stat.h b/block/blk-stat.h
index 6ad5b8c..7417805 100644
--- a/block/blk-stat.h
+++ b/block/blk-stat.h
@@ -41,9 +41,10 @@ struct blk_stat_callback {
 
 	/**
 	 * @bucket_fn: Given a request, returns which statistics bucket it
-	 * should be accounted under.
+	 * should be accounted under. Return -1 for no bucket for this
+	 * request.
 	 */
-	unsigned int (*bucket_fn)(const struct request *);
+	int (*bucket_fn)(const struct request *);
 
 	/**
 	 * @buckets: Number of statistics buckets.
@@ -98,7 +99,7 @@ static inline u64 blk_stat_time(struct blk_issue_stat *stat)
  *
  * Return: Data direction of the request, either READ or WRITE.
  */
-unsigned int blk_stat_rq_ddir(const struct request *rq);
+int blk_stat_rq_ddir(const struct request *rq);
 
 /**
  * blk_stat_alloc_callback() - Allocate a block statistics callback.
@@ -113,7 +114,7 @@ unsigned int blk_stat_rq_ddir(const struct request *rq);
  */
 struct blk_stat_callback *
 blk_stat_alloc_callback(void (*timer_fn)(struct blk_stat_callback *),
-			unsigned int (*bucket_fn)(const struct request *),
+			int (*bucket_fn)(const struct request *),
 			unsigned int buckets, void *data);
 
 /**
-- 
2.7.4

^ permalink raw reply related

* [PATCH 0/2] blk-stat: Add ability to not bucket IO, add this to IO poling.
From: sbates @ 2017-03-26  2:18 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-nvme, Damien.LeMoal, osandov, sbates

From: Stephen Bates <sbates@raithlin.com>

Omar recently developed some patches for block layer stats that use
callbacks to determine which bucket an IO should be considered for. At
the same time there was discussion at LSF/MM that we might not want to
consider all IO when generating stats for certain algorithms (e.g. IO
completion polling).

This set does two things. It makes the bucket callback for stats
signed so we can now ignore IO that cause a negative to be returned
from the bucket function. It then uses this new functionality to
filter IO for the IO completion polling algorithms.

This patchset applies cleanly on a83b576c9c25cf (block: fix stacked
driver stats init and free) in Jens' for-next tree.

I've lightly tested this using QEMU and a real NVMe low-latency
device. I do not have performance number yet. Feedback would be
appreciated!

[BTW this is my first submission for an all new setup so apologies if
this does not come through correctly!]

Cc: Damien.LeMoal@wdc.com
Cc: osandov@osandov.com

Stephen Bates (2):
  blk-stat: convert blk-stat bucket callback to signed
  blk-stat: add a poll_size value to the request_queue struct

 block/blk-mq.c         | 17 +++++++++++++++--
 block/blk-stat.c       |  8 +++++---
 block/blk-stat.h       |  9 +++++----
 block/blk-sysfs.c      | 30 ++++++++++++++++++++++++++++++
 include/linux/blkdev.h |  1 +
 5 files changed, 56 insertions(+), 9 deletions(-)

-- 
2.7.4

^ permalink raw reply

* Re: [PATCH 20/28] ibnbd_clt: add Makefile and Kconfig
From: kbuild test robot @ 2017-03-25 11:17 UTC (permalink / raw)
  To: Jack Wang
  Cc: kbuild-all, linux-block, linux-rdma, dledford, axboe, hch, mail,
	Milind.dumbare, yun.wang, Jack Wang
In-Reply-To: <1490352343-20075-21-git-send-email-jinpu.wangl@profitbricks.com>

[-- Attachment #1: Type: text/plain, Size: 14414 bytes --]

Hi Jack,

[auto build test WARNING on linus/master]
[also build test WARNING on next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jack-Wang/INFINIBAND-NETWORK-BLOCK-DEVICE-IBNBD/20170325-101629
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:6:0,
                    from include/linux/kernel.h:13,
                    from arch/x86/include/asm/percpu.h:44,
                    from arch/x86/include/asm/current.h:5,
                    from include/linux/sched.h:11,
                    from include/linux/blkdev.h:4,
                    from drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/ibnbd.h:50,
                    from drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/ibnbd-proto.h:50,
                    from drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:47:
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_sess_info':
>> include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:54:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Sess info message with unexpected length received"
      ^~~~~~
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:54:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Sess info message with unexpected length received"
      ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_sess_info_rsp':
>> include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:67:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Sess info message with unexpected length received"
      ^~~~~~
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:67:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Sess info message with unexpected length received"
      ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_open_resp':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:82:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Open Response msg received with unexpected length"
      ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_revalidate':
>> include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:114:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Device resize message with unexpected length received"
      ^~~~~~
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:114:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Device resize message with unexpected length received"
      ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_open':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:126:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Open msg received with unexpected length"
      ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_close':
>> include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:151:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Close msg received with unexpected length %lu instead"
      ^~~~~~
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:151:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Close msg received with unexpected length %lu instead"
      ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_close_rsp':
>> include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:163:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Close_rsp msg received with unexpected length %lu"
      ^~~~~~
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/../ibnbd_inc/log.h:50:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibnbd L%d ERR: " fmt, \
                             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:163:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Close_rsp msg received with unexpected length %lu"
      ^~~~~~

vim +4 include/linux/kern_levels.h

314ba352 Joe Perches 2012-07-30   1  #ifndef __KERN_LEVELS_H__
314ba352 Joe Perches 2012-07-30   2  #define __KERN_LEVELS_H__
314ba352 Joe Perches 2012-07-30   3  
04d2c8c8 Joe Perches 2012-07-30  @4  #define KERN_SOH	"\001"		/* ASCII Start Of Header */
04d2c8c8 Joe Perches 2012-07-30   5  #define KERN_SOH_ASCII	'\001'
04d2c8c8 Joe Perches 2012-07-30   6  
04d2c8c8 Joe Perches 2012-07-30   7  #define KERN_EMERG	KERN_SOH "0"	/* system is unusable */
04d2c8c8 Joe Perches 2012-07-30   8  #define KERN_ALERT	KERN_SOH "1"	/* action must be taken immediately */
04d2c8c8 Joe Perches 2012-07-30   9  #define KERN_CRIT	KERN_SOH "2"	/* critical conditions */
04d2c8c8 Joe Perches 2012-07-30  10  #define KERN_ERR	KERN_SOH "3"	/* error conditions */
04d2c8c8 Joe Perches 2012-07-30  11  #define KERN_WARNING	KERN_SOH "4"	/* warning conditions */
04d2c8c8 Joe Perches 2012-07-30  12  #define KERN_NOTICE	KERN_SOH "5"	/* normal but significant condition */

:::::: The code at line 4 was first introduced by commit
:::::: 04d2c8c83d0e3ac5f78aeede51babb3236200112 printk: convert the format for KERN_<LEVEL> to a 2 byte pattern

:::::: TO: Joe Perches <joe@perches.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59015 bytes --]

^ permalink raw reply

* Re: [PATCH 13/28] ibtrs_srv: add Makefile and Kconfig
From: kbuild test robot @ 2017-03-25 10:54 UTC (permalink / raw)
  To: Jack Wang
  Cc: kbuild-all, linux-block, linux-rdma, dledford, axboe, hch, mail,
	Milind.dumbare, yun.wang, Jack Wang
In-Reply-To: <1490352343-20075-14-git-send-email-jinpu.wangl@profitbricks.com>

[-- Attachment #1: Type: text/plain, Size: 5997 bytes --]

Hi Jack,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jack-Wang/INFINIBAND-NETWORK-BLOCK-DEVICE-IBNBD/20170325-101629
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ib_con_destroy':
>> common.c:(.text+0x81bc): multiple definition of `ib_con_destroy'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xcca8): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_malloc':
>> common.c:(.text+0x8f0c): multiple definition of `ibtrs_malloc'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xd9f8): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_write_empty_imm':
>> common.c:(.text+0x7f34): multiple definition of `ibtrs_write_empty_imm'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xca20): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ib_post_rdma_write':
>> common.c:(.text+0x8044): multiple definition of `ib_post_rdma_write'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xcb30): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `fill_ibtrs_msg_sess_open':
>> common.c:(.text+0x86dc): multiple definition of `fill_ibtrs_msg_sess_open'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xd1c8): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_addr_to_str':
>> common.c:(.text+0x7e80): multiple definition of `ibtrs_addr_to_str'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xc96c): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_post_send':
>> common.c:(.text+0x7f94): multiple definition of `ibtrs_post_send'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xca80): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_iu_put':
>> common.c:(.text+0x87d8): multiple definition of `ibtrs_iu_put'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xd2c4): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ib_session_init':
>> common.c:(.text+0x80e0): multiple definition of `ib_session_init'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xcbcc): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `post_beacon':
>> common.c:(.text+0x8244): multiple definition of `post_beacon'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xcd30): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_request_cq_notifications':
>> common.c:(.text+0x8194): multiple definition of `ibtrs_request_cq_notifications'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xcc80): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_iu_get':
>> common.c:(.text+0x8818): multiple definition of `ibtrs_iu_get'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xd304): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_heartbeat_set_send_ts':
>> common.c:(.text+0x8b30): multiple definition of `ibtrs_heartbeat_set_send_ts'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xd61c): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_iu_free':
>> common.c:(.text+0x8a60): multiple definition of `ibtrs_iu_free'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xd54c): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_heartbeat_send_ts_diff_ms':
>> common.c:(.text+0x8bf0): multiple definition of `ibtrs_heartbeat_send_ts_diff_ms'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xd6dc): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ib_get_max_wr_queue_size':
>> common.c:(.text+0x80c4): multiple definition of `ib_get_max_wr_queue_size'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xcbb0): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `fill_ibtrs_msg_con_open':
>> common.c:(.text+0x8730): multiple definition of `fill_ibtrs_msg_con_open'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xd21c): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_set_last_heartbeat':
>> common.c:(.text+0x8b90): multiple definition of `ibtrs_set_last_heartbeat'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xd67c): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_zalloc':
>> common.c:(.text+0x8f44): multiple definition of `ibtrs_zalloc'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xda30): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ibtrs_heartbeat_warn':
>> common.c:(.text+0x8c4c): multiple definition of `ibtrs_heartbeat_warn'
   drivers/infiniband/ulp/ibtrs_client/built-in.o:common.c:(.text+0xd738): first defined here
   drivers/infiniband/ulp/ibtrs_server/built-in.o: In function `ib_session_destroy':

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 60767 bytes --]

^ permalink raw reply

* Re: [PATCH 26/28] ibnbd_srv: add Makefile and Kconfig
From: kbuild test robot @ 2017-03-25  9:27 UTC (permalink / raw)
  To: Jack Wang
  Cc: kbuild-all, linux-block, linux-rdma, dledford, axboe, hch, mail,
	Milind.dumbare, yun.wang, Jack Wang
In-Reply-To: <1490352343-20075-27-git-send-email-jinpu.wangl@profitbricks.com>

[-- Attachment #1: Type: text/plain, Size: 6782 bytes --]

Hi Jack,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jack-Wang/INFINIBAND-NETWORK-BLOCK-DEVICE-IBNBD/20170325-101629
config: i386-allyesconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/block/ibnbd_server/ibnbd_srv.c: In function 'ibnbd_srv_revalidate_sess_dev':
>> drivers/block/ibnbd_server/ibnbd_srv.c:994:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat=]
      INFO(sess_dev, "notified client about device size change"
             ^~~~~~
   drivers/block/ibnbd_server/ibnbd_srv.c:994:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Wformat=]
--
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_sess_info':
>> drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:54:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
      ERR_NP("Sess info message with unexpected length received"
             ^~~~~~
>> drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:54:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_sess_info_rsp':
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:67:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
      ERR_NP("Sess info message with unexpected length received"
             ^~~~~~
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:67:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_open_resp':
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:82:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("Open Response msg received with unexpected length"
             ^~~~~~
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_revalidate':
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:114:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
      ERR_NP("Device resize message with unexpected length received"
             ^~~~~~
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:114:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_open':
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:126:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("Open msg received with unexpected length"
             ^~~~~~
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_close':
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:151:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
      ERR_NP("Close msg received with unexpected length %lu instead"
             ^~~~~~
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:151:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_close_rsp':
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:163:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
      ERR_NP("Close_rsp msg received with unexpected length %lu"
             ^~~~~~
   drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.c:163:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
   warning: __mcount_loc already exists: drivers/block/ibnbd_server/../ibnbd_lib/ibnbd-proto.o

vim +994 drivers/block/ibnbd_server/ibnbd_srv.c

346428ec Jack Wang 2017-03-24   978  	msg.nsectors		= nsectors;
346428ec Jack Wang 2017-03-24   979  
346428ec Jack Wang 2017-03-24   980  	if (unlikely(sess_dev->sess->state == SESS_STATE_DISCONNECTED))
346428ec Jack Wang 2017-03-24   981  		return -ENODEV;
346428ec Jack Wang 2017-03-24   982  
346428ec Jack Wang 2017-03-24   983  	if (!sess_dev->is_visible) {
346428ec Jack Wang 2017-03-24   984  		INFO(sess_dev, "revalidate device failed, wait for sending "
346428ec Jack Wang 2017-03-24   985  		     "open reply first\n");
346428ec Jack Wang 2017-03-24   986  		return -EAGAIN;
346428ec Jack Wang 2017-03-24   987  	}
346428ec Jack Wang 2017-03-24   988  
346428ec Jack Wang 2017-03-24   989  	ret = ibtrs_srv_send(sess_dev->sess->ibtrs_sess, &vec, 1);
346428ec Jack Wang 2017-03-24   990  	if (unlikely(ret)) {
346428ec Jack Wang 2017-03-24   991  		ERR(sess_dev, "revalidate: Sending new device size"
346428ec Jack Wang 2017-03-24   992  		    " to client failed, errno: %d\n", ret);
346428ec Jack Wang 2017-03-24   993  	} else {
346428ec Jack Wang 2017-03-24  @994  		INFO(sess_dev, "notified client about device size change"
346428ec Jack Wang 2017-03-24   995  		     " (old nsectors: %lu, new nsectors: %lu)\n",
346428ec Jack Wang 2017-03-24   996  		     sess_dev->nsectors, nsectors);
346428ec Jack Wang 2017-03-24   997  		sess_dev->nsectors = nsectors;
346428ec Jack Wang 2017-03-24   998  	}
346428ec Jack Wang 2017-03-24   999  
346428ec Jack Wang 2017-03-24  1000  	return ret;
346428ec Jack Wang 2017-03-24  1001  }
346428ec Jack Wang 2017-03-24  1002  

:::::: The code at line 994 was first introduced by commit
:::::: 346428ec19d9ec225850f10b7fc26d98051d5f58 ibnbd_srv: add main functionality

:::::: TO: Jack Wang <jinpu.wang@profitbricks.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 58354 bytes --]

^ permalink raw reply

* Re: [PATCH 20/28] ibnbd_clt: add Makefile and Kconfig
From: kbuild test robot @ 2017-03-25  8:38 UTC (permalink / raw)
  To: Jack Wang
  Cc: kbuild-all, linux-block, linux-rdma, dledford, axboe, hch, mail,
	Milind.dumbare, yun.wang, Jack Wang
In-Reply-To: <1490352343-20075-21-git-send-email-jinpu.wangl@profitbricks.com>

[-- Attachment #1: Type: text/plain, Size: 6230 bytes --]

Hi Jack,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jack-Wang/INFINIBAND-NETWORK-BLOCK-DEVICE-IBNBD/20170325-101629
config: i386-allyesconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_sess_info':
>> drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:54:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
      ERR_NP("Sess info message with unexpected length received"
             ^~~~~~
>> drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:54:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_sess_info_rsp':
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:67:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
      ERR_NP("Sess info message with unexpected length received"
             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:67:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_open_resp':
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:82:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("Open Response msg received with unexpected length"
             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_revalidate':
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:114:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
      ERR_NP("Device resize message with unexpected length received"
             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:114:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_open':
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:126:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("Open msg received with unexpected length"
             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_close':
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:151:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
      ERR_NP("Close msg received with unexpected length %lu instead"
             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:151:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c: In function 'ibnbd_validate_msg_close_rsp':
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:163:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat=]
      ERR_NP("Close_rsp msg received with unexpected length %lu"
             ^~~~~~
   drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c:163:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]

vim +54 drivers/block/ibnbd_client/../ibnbd_lib/ibnbd-proto.c

46a31b32 Jack Wang 2017-03-24  38   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46a31b32 Jack Wang 2017-03-24  39   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46a31b32 Jack Wang 2017-03-24  40   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
46a31b32 Jack Wang 2017-03-24  41   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
46a31b32 Jack Wang 2017-03-24  42   * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46a31b32 Jack Wang 2017-03-24  43   * POSSIBILITY OF SUCH DAMAGES.
46a31b32 Jack Wang 2017-03-24  44   *
46a31b32 Jack Wang 2017-03-24  45   */
46a31b32 Jack Wang 2017-03-24  46  
46a31b32 Jack Wang 2017-03-24  47  #include "../ibnbd_inc/ibnbd-proto.h"
46a31b32 Jack Wang 2017-03-24  48  #include "../ibnbd_inc/log.h"
46a31b32 Jack Wang 2017-03-24  49  
46a31b32 Jack Wang 2017-03-24  50  static int ibnbd_validate_msg_sess_info(const struct ibnbd_msg_sess_info *msg,
46a31b32 Jack Wang 2017-03-24  51  					size_t len)
46a31b32 Jack Wang 2017-03-24  52  {
46a31b32 Jack Wang 2017-03-24  53  	if (unlikely(len != sizeof(*msg))) {
46a31b32 Jack Wang 2017-03-24 @54  		ERR_NP("Sess info message with unexpected length received"
46a31b32 Jack Wang 2017-03-24  55  		       " %lu instead of %lu\n", len, sizeof(*msg));
46a31b32 Jack Wang 2017-03-24  56  		return -EINVAL;
46a31b32 Jack Wang 2017-03-24  57  	}
46a31b32 Jack Wang 2017-03-24  58  
46a31b32 Jack Wang 2017-03-24  59  	return 0;
46a31b32 Jack Wang 2017-03-24  60  }
46a31b32 Jack Wang 2017-03-24  61  
46a31b32 Jack Wang 2017-03-24  62  static int

:::::: The code at line 54 was first introduced by commit
:::::: 46a31b323d8198184e9325139e4906941d9ef007 ibnbd: add shared library functions

:::::: TO: Jack Wang <jinpu.wang@profitbricks.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 58350 bytes --]

^ permalink raw reply

* Re: [PATCH 13/28] ibtrs_srv: add Makefile and Kconfig
From: kbuild test robot @ 2017-03-25  7:55 UTC (permalink / raw)
  To: Jack Wang
  Cc: kbuild-all, linux-block, linux-rdma, dledford, axboe, hch, mail,
	Milind.dumbare, yun.wang, Jack Wang
In-Reply-To: <1490352343-20075-14-git-send-email-jinpu.wangl@profitbricks.com>

[-- Attachment #1: Type: text/plain, Size: 17817 bytes --]

Hi Jack,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jack-Wang/INFINIBAND-NETWORK-BLOCK-DEVICE-IBNBD/20170325-101629
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:6:0,
                    from drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c:48:
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_sess_open_resp':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
   include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
>> drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c:59:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Session open resp msg received with unexpected length"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_rdma_write':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
   include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c:99:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("RDMA-Write msg received with invalid length %d"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_req_rdma_write':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
   include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c:112:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Request-RDMA-Write msg request received with invalid"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_con_open':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
   include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c:125:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Con Open msg received with invalid length: %d"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_sess_open':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
   include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c:137:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Sess open msg received with invalid length: %d"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_sess_info':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
   include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c:153:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Error message received with invalid length: %d,"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_error':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
   include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c:164:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Error message received with invalid length: %d,"
      ^~~~~~
   warning: __mcount_loc already exists: drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.o
--
   In file included from include/linux/kernel.h:13:0,
                    from include/linux/uio.h:12,
                    from include/rdma/ibtrs.h:50,
                    from drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/heartbeat.c:47:
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/heartbeat.c: In function 'ibtrs_heartbeat_warn':
   include/rdma/ibtrs_log.h:51:32: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'long long int' [-Wformat=]
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                                   ^
   include/linux/printk.h:285:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
   include/rdma/ibtrs_log.h:51:23: note: in expansion of macro 'pr_debug'
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                          ^~~~~~~~
>> drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/heartbeat.c:84:2: note: in expansion of macro 'DEB'
     DEB("last heartbeat message from %s was received %lu, %llums"
     ^~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/heartbeat.c: In function 'ibtrs_heartbeat_timeout_is_expired':
   include/rdma/ibtrs_log.h:51:32: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'long long int' [-Wformat=]
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                                   ^
   include/linux/printk.h:285:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
   include/rdma/ibtrs_log.h:51:23: note: in expansion of macro 'pr_debug'
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                          ^~~~~~~~
   drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/heartbeat.c:101:2: note: in expansion of macro 'DEB'
     DEB("last heartbeat message from %s received %lu, %llums ago\n",
     ^~~
--
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c: In function 'ibtrs_srv_stats_rdma_to_str':
>> drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:605:33: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'long long int' [-Wformat=]
     return scnprintf(page, len, "%ld %ld %ld %ld %u %ld\n",
                                    ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:605:37: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'long long int' [-Wformat=]
     return scnprintf(page, len, "%ld %ld %ld %ld %u %ld\n",
                                        ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:605:41: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'long long int' [-Wformat=]
     return scnprintf(page, len, "%ld %ld %ld %ld %u %ld\n",
                                            ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:605:45: warning: format '%ld' expects argument of type 'long int', but argument 7 has type 'long long int' [-Wformat=]
     return scnprintf(page, len, "%ld %ld %ld %ld %u %ld\n",
                                                ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:605:52: warning: format '%ld' expects argument of type 'long int', but argument 9 has type 'long long int' [-Wformat=]
     return scnprintf(page, len, "%ld %ld %ld %ld %u %ld\n",
                                                       ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c: In function 'ibtrs_srv_stats_user_ib_msgs_to_str':
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:632:31: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'long long int' [-Wformat=]
     return snprintf(buf, len, "%ld %ld %ld %ld\n",
                                  ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:632:35: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'long long int' [-Wformat=]
     return snprintf(buf, len, "%ld %ld %ld %ld\n",
                                      ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:632:39: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'long long int' [-Wformat=]
     return snprintf(buf, len, "%ld %ld %ld %ld\n",
                                          ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:632:43: warning: format '%ld' expects argument of type 'long int', but argument 7 has type 'long long int' [-Wformat=]
     return snprintf(buf, len, "%ld %ld %ld %ld\n",
                                              ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c: In function 'ibtrs_srv_stats_wc_completion_to_str':
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:652:34: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'long long int' [-Wformat=]
     return snprintf(buf, len, "%d %ld %ld\n",
                                     ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:652:38: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'long long int' [-Wformat=]
     return snprintf(buf, len, "%d %ld %ld\n",
                                         ^
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c: In function 'process_err_wc':
>> drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:2065:7: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     iu = (struct ibtrs_iu *)wc->wr_id;
          ^
   In file included from include/linux/printk.h:6:0,
                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:47:
   drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c: In function 'rdma_con_establish':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
   include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
>> drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:2617:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Establishing connection failed, "
      ^~~~~~
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
   include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
>> drivers/infiniband/ulp/ibtrs_server/ibtrs_srv.c:2617:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Establishing connection failed, "
      ^~~~~~

vim +/ERR_NP +59 drivers/infiniband/ulp/ibtrs_server/../ibtrs_lib/ibtrs-proto.c

f2a5844d Jack Wang 2017-03-24  43   * POSSIBILITY OF SUCH DAMAGES.
f2a5844d Jack Wang 2017-03-24  44   *
f2a5844d Jack Wang 2017-03-24  45   */
f2a5844d Jack Wang 2017-03-24  46  
f2a5844d Jack Wang 2017-03-24  47  #include <linux/errno.h>
f2a5844d Jack Wang 2017-03-24  48  #include <linux/printk.h>
f2a5844d Jack Wang 2017-03-24  49  #include <rdma/ibtrs.h>
f2a5844d Jack Wang 2017-03-24  50  #include <rdma/ibtrs_log.h>
f2a5844d Jack Wang 2017-03-24  51  
f2a5844d Jack Wang 2017-03-24  52  static int
f2a5844d Jack Wang 2017-03-24  53  ibtrs_validate_msg_sess_open_resp(const struct ibtrs_msg_sess_open_resp *msg)
f2a5844d Jack Wang 2017-03-24  54  {
f2a5844d Jack Wang 2017-03-24  55  	static const int min_bufs = 1;
f2a5844d Jack Wang 2017-03-24  56  
f2a5844d Jack Wang 2017-03-24  57  	if (unlikely(msg->hdr.tsize !=
f2a5844d Jack Wang 2017-03-24  58  				IBTRS_MSG_SESS_OPEN_RESP_LEN(msg->cnt))) {
f2a5844d Jack Wang 2017-03-24 @59  		ERR_NP("Session open resp msg received with unexpected length"
f2a5844d Jack Wang 2017-03-24  60  		       " %dB instead of %luB\n", msg->hdr.tsize,
f2a5844d Jack Wang 2017-03-24  61  		       IBTRS_MSG_SESS_OPEN_RESP_LEN(msg->cnt));
f2a5844d Jack Wang 2017-03-24  62  
f2a5844d Jack Wang 2017-03-24  63  		return -EINVAL;
f2a5844d Jack Wang 2017-03-24  64  	}
f2a5844d Jack Wang 2017-03-24  65  
f2a5844d Jack Wang 2017-03-24  66  	if (msg->max_inflight_msg < min_bufs) {
f2a5844d Jack Wang 2017-03-24  67  		ERR_NP("Sess Open msg received with invalid max_inflight_msg %d"

:::::: The code at line 59 was first introduced by commit
:::::: f2a5844d27aa77dee51bee108f1654f9ca4a3ac6 ibtrs_lib: add common functions shared by client and server

:::::: TO: Jack Wang <jinpu.wang@profitbricks.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59004 bytes --]

^ permalink raw reply

* Re: [PATCH 27/28] ibnbd: add doc for how to use ibnbd and sysfs interface
From: kbuild test robot @ 2017-03-25  7:44 UTC (permalink / raw)
  To: Jack Wang
  Cc: kbuild-all, linux-block, linux-rdma, dledford, axboe, hch, mail,
	Milind.dumbare, yun.wang, Jack Wang
In-Reply-To: <1490352343-20075-28-git-send-email-jinpu.wangl@profitbricks.com>

[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]

Hi Jack,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jack-Wang/INFINIBAND-NETWORK-BLOCK-DEVICE-IBNBD/20170325-101629
config: ia64-allyesconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   drivers/block/ibnbd_server/built-in.o: In function `ibnbd_io_mode_str':
>> (.text+0x5fa0): multiple definition of `ibnbd_io_mode_str'
   drivers/block/ibnbd_client/built-in.o:(.text+0xb7a0): first defined here
   drivers/block/ibnbd_server/built-in.o: In function `ibnbd_validate_message':
>> (.text+0x5a40): multiple definition of `ibnbd_validate_message'
   drivers/block/ibnbd_client/built-in.o:(.text+0xb240): first defined here
   drivers/block/ibnbd_server/built-in.o: In function `rq_cmd_to_ibnbd_io_flags':
>> (.text+0x5880): multiple definition of `rq_cmd_to_ibnbd_io_flags'
   drivers/block/ibnbd_client/built-in.o:(.text+0xb080): first defined here
   drivers/block/ibnbd_server/built-in.o: In function `ibnbd_access_mode_str':
>> (.text+0x6000): multiple definition of `ibnbd_access_mode_str'
   drivers/block/ibnbd_client/built-in.o:(.text+0xb800): first defined here
   drivers/block/ibnbd_server/built-in.o: In function `ibnbd_io_flags_to_bi_rw':
>> (.text+0x57e0): multiple definition of `ibnbd_io_flags_to_bi_rw'
   drivers/block/ibnbd_client/built-in.o:(.text+0xafe0): first defined here

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49726 bytes --]

^ permalink raw reply

* Re: [PATCH 08/28] ibtrs_clt: add Makefile and Kconfig
From: kbuild test robot @ 2017-03-25  6:55 UTC (permalink / raw)
  To: Jack Wang
  Cc: kbuild-all, linux-block, linux-rdma, dledford, axboe, hch, mail,
	Milind.dumbare, yun.wang, Jack Wang
In-Reply-To: <1490352343-20075-9-git-send-email-jinpu.wangl@profitbricks.com>

[-- Attachment #1: Type: text/plain, Size: 8114 bytes --]

Hi Jack,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jack-Wang/INFINIBAND-NETWORK-BLOCK-DEVICE-IBNBD/20170325-101629
config: i386-allyesconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'process_open_rsp':
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:857:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      DEB("Adding contiguous buffer %d, size %u, addr: 0x%p,"
                             ^
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'ibtrs_map_desc':
>> drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:1106:24: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'dma_addr_t {aka unsigned int}' [-Wformat=]
     DEB("dma_addr %llu, key %u, dma_len %u\n", dma_addr, rkey, dma_len);
                           ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'ibtrs_post_send_rdma':
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:1440:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
              addr + off, (u64)req->iu, imm,
                          ^
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'ibtrs_post_send_rdma_desc':
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:1565:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
              addr, (u64)req->iu, imm,
                    ^
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'process_err_wc':
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:1882:7: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     iu = (struct ibtrs_iu *)wc->wr_id;
          ^
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'process_wcs':
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:1922:8: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      iu = (struct ibtrs_iu *)wc.wr_id;
           ^
--
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_sess_open_resp':
>> drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:59:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("Session open resp msg received with unexpected length"
             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_rdma_write':
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:99:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("RDMA-Write msg received with invalid length %d"
             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_req_rdma_write':
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:112:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("Request-RDMA-Write msg request received with invalid"
             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_con_open':
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:125:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("Con Open msg received with invalid length: %d"
             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_sess_open':
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:137:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("Sess open msg received with invalid length: %d"
             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_sess_info':
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:153:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("Error message received with invalid length: %d,"
             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_error':
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:164:10: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
      ERR_NP("Error message received with invalid length: %d,"
             ^~~~~~
--
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/heartbeat.c: In function 'ibtrs_heartbeat_warn':
>> drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/heartbeat.c:84:24: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'long long int' [-Wformat=]
     DEB("last heartbeat message from %s was received %lu, %llums"
                           ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/heartbeat.c: In function 'ibtrs_heartbeat_timeout_is_expired':
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/heartbeat.c:101:24: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'long long int' [-Wformat=]
     DEB("last heartbeat message from %s received %lu, %llums ago\n",
                           ^~~~~~
   warning: __mcount_loc already exists: drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/heartbeat.o

vim +1106 drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c

89b85024 Jack Wang 2017-03-24  1090  		list_add(&desc[i]->entry, &pool->free_list);
89b85024 Jack Wang 2017-03-24  1091  	spin_unlock_bh(&pool->lock);
89b85024 Jack Wang 2017-03-24  1092  }
89b85024 Jack Wang 2017-03-24  1093  
89b85024 Jack Wang 2017-03-24  1094  static inline struct ibtrs_fr_pool *alloc_fr_pool(struct ibtrs_session *sess)
89b85024 Jack Wang 2017-03-24  1095  {
89b85024 Jack Wang 2017-03-24  1096  	return ibtrs_create_fr_pool(sess->ib_device, sess->ib_sess.pd,
89b85024 Jack Wang 2017-03-24  1097  				    sess->queue_depth,
89b85024 Jack Wang 2017-03-24  1098  				    sess->max_pages_per_mr);
89b85024 Jack Wang 2017-03-24  1099  }
89b85024 Jack Wang 2017-03-24  1100  
89b85024 Jack Wang 2017-03-24  1101  static void ibtrs_map_desc(struct ibtrs_map_state *state, dma_addr_t dma_addr,
89b85024 Jack Wang 2017-03-24  1102  			   u32 dma_len, u32 rkey, u32 max_desc)
89b85024 Jack Wang 2017-03-24  1103  {
89b85024 Jack Wang 2017-03-24  1104  	struct ibtrs_sg_desc *desc = state->desc;
89b85024 Jack Wang 2017-03-24  1105  
89b85024 Jack Wang 2017-03-24 @1106  	DEB("dma_addr %llu, key %u, dma_len %u\n", dma_addr, rkey, dma_len);
89b85024 Jack Wang 2017-03-24  1107  	desc->addr	= dma_addr;
89b85024 Jack Wang 2017-03-24  1108  	desc->key	= rkey;
89b85024 Jack Wang 2017-03-24  1109  	desc->len	= dma_len;
89b85024 Jack Wang 2017-03-24  1110  
89b85024 Jack Wang 2017-03-24  1111  	state->total_len += dma_len;
89b85024 Jack Wang 2017-03-24  1112  	if (state->ndesc < max_desc) {
89b85024 Jack Wang 2017-03-24  1113  		state->desc++;
89b85024 Jack Wang 2017-03-24  1114  		state->ndesc++;

:::::: The code at line 1106 was first introduced by commit
:::::: 89b85024b8ff15d239ba06be993378fe6a940693 ibtrs_clt: main functionality of ibtrs_client

:::::: TO: Jack Wang <jinpu.wang@profitbricks.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 58338 bytes --]

^ permalink raw reply

* Re: [PATCH 08/28] ibtrs_clt: add Makefile and Kconfig
From: kbuild test robot @ 2017-03-25  5:51 UTC (permalink / raw)
  To: Jack Wang
  Cc: kbuild-all, linux-block, linux-rdma, dledford, axboe, hch, mail,
	Milind.dumbare, yun.wang, Jack Wang
In-Reply-To: <1490352343-20075-9-git-send-email-jinpu.wangl@profitbricks.com>

[-- Attachment #1: Type: text/plain, Size: 14663 bytes --]

Hi Jack,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.11-rc3 next-20170324]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jack-Wang/INFINIBAND-NETWORK-BLOCK-DEVICE-IBNBD/20170325-101629
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:329:0,
                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:47:
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'process_open_rsp':
>> drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:859:7: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
          (void *)sess->srv_rdma_addr[i],
          ^
   include/linux/dynamic_debug.h:127:10: note: in definition of macro 'dynamic_pr_debug'
           ##__VA_ARGS__);  \
             ^~~~~~~~~~~
>> include/rdma/ibtrs_log.h:51:23: note: in expansion of macro 'pr_debug'
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                          ^~~~~~~~
>> drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:857:3: note: in expansion of macro 'DEB'
      DEB("Adding contiguous buffer %d, size %u, addr: 0x%p,"
      ^~~
   In file included from include/linux/kernel.h:13:0,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:47:
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'ibtrs_map_desc':
>> include/rdma/ibtrs_log.h:51:32: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'dma_addr_t {aka unsigned int}' [-Wformat=]
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                                   ^
   include/linux/printk.h:285:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> include/rdma/ibtrs_log.h:51:23: note: in expansion of macro 'pr_debug'
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                          ^~~~~~~~
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:1106:2: note: in expansion of macro 'DEB'
     DEB("dma_addr %llu, key %u, dma_len %u\n", dma_addr, rkey, dma_len);
     ^~~
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'ibtrs_post_send_rdma':
>> drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:1440:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
              addr + off, (u64)req->iu, imm,
                          ^
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'ibtrs_post_send_rdma_desc':
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:1565:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
              addr, (u64)req->iu, imm,
                    ^
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'process_err_wc':
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:1882:7: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     iu = (struct ibtrs_iu *)wc->wr_id;
          ^
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c: In function 'process_wcs':
   drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c:1922:8: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      iu = (struct ibtrs_iu *)wc.wr_id;
           ^
--
   In file included from include/linux/printk.h:6:0,
                    from drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:48:
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_sess_open_resp':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
>> drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:59:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Session open resp msg received with unexpected length"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_rdma_write':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:99:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("RDMA-Write msg received with invalid length %d"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_req_rdma_write':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:112:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Request-RDMA-Write msg request received with invalid"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_con_open':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:125:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Con Open msg received with invalid length: %d"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_sess_open':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:137:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Sess open msg received with invalid length: %d"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_sess_info':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:153:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Error message received with invalid length: %d,"
      ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c: In function 'ibtrs_validate_msg_error':
   include/linux/kern_levels.h:4:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> include/rdma/ibtrs_log.h:62:26: note: in expansion of macro 'pr_err'
    #define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \
                             ^~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/ibtrs-proto.c:164:3: note: in expansion of macro 'ERR_NP'
      ERR_NP("Error message received with invalid length: %d,"
      ^~~~~~
--
   In file included from include/linux/kernel.h:13:0,
                    from include/linux/uio.h:12,
                    from include/rdma/ibtrs.h:50,
                    from drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/heartbeat.c:47:
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/heartbeat.c: In function 'ibtrs_heartbeat_warn':
>> include/rdma/ibtrs_log.h:51:32: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'long long int' [-Wformat=]
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                                   ^
   include/linux/printk.h:285:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> include/rdma/ibtrs_log.h:51:23: note: in expansion of macro 'pr_debug'
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                          ^~~~~~~~
>> drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/heartbeat.c:84:2: note: in expansion of macro 'DEB'
     DEB("last heartbeat message from %s was received %lu, %llums"
     ^~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/heartbeat.c: In function 'ibtrs_heartbeat_timeout_is_expired':
>> include/rdma/ibtrs_log.h:51:32: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'long long int' [-Wformat=]
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                                   ^
   include/linux/printk.h:285:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
>> include/rdma/ibtrs_log.h:51:23: note: in expansion of macro 'pr_debug'
    #define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__)
                          ^~~~~~~~
   drivers/infiniband/ulp/ibtrs_client/../ibtrs_lib/heartbeat.c:101:2: note: in expansion of macro 'DEB'
     DEB("last heartbeat message from %s received %lu, %llums ago\n",
     ^~~

vim +859 drivers/infiniband/ulp/ibtrs_client/ibtrs_clt.c

89b85024 Jack Wang 2017-03-24  851  			return -ENOMEM;
89b85024 Jack Wang 2017-03-24  852  		}
89b85024 Jack Wang 2017-03-24  853  	}
89b85024 Jack Wang 2017-03-24  854  
89b85024 Jack Wang 2017-03-24  855  	for (i = 0; i < msg->cnt; i++) {
89b85024 Jack Wang 2017-03-24  856  		sess->srv_rdma_addr[i] = msg->addr[i];
89b85024 Jack Wang 2017-03-24 @857  		DEB("Adding contiguous buffer %d, size %u, addr: 0x%p,"
89b85024 Jack Wang 2017-03-24  858  		    " rkey: 0x%x\n", i, sess->chunk_size,
89b85024 Jack Wang 2017-03-24 @859  		    (void *)sess->srv_rdma_addr[i],
89b85024 Jack Wang 2017-03-24  860  		    sess->srv_rdma_buf_rkey);
89b85024 Jack Wang 2017-03-24  861  	}
89b85024 Jack Wang 2017-03-24  862  

:::::: The code at line 859 was first introduced by commit
:::::: 89b85024b8ff15d239ba06be993378fe6a940693 ibtrs_clt: main functionality of ibtrs_client

:::::: TO: Jack Wang <jinpu.wang@profitbricks.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 58998 bytes --]

^ permalink raw reply

* Re: [PATCH] block: constify struct blk_integrity_profile
From: Jens Axboe @ 2017-03-25  2:35 UTC (permalink / raw)
  To: Eric Biggers, linux-block; +Cc: Martin K . Petersen, Eric Biggers
In-Reply-To: <20170325010348.74421-1-ebiggers3@gmail.com>

On 03/24/2017 07:03 PM, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> blk_integrity_profile's are never modified, so mark them 'const' so that
> they are placed in .rodata and benefit from memory protection.

Thanks, that's a nice change. Applied for 4.12.

-- 
Jens Axboe

^ permalink raw reply

* [PATCH] block: constify struct blk_integrity_profile
From: Eric Biggers @ 2017-03-25  1:03 UTC (permalink / raw)
  To: linux-block; +Cc: Jens Axboe, Martin K . Petersen, Eric Biggers

From: Eric Biggers <ebiggers@google.com>

blk_integrity_profile's are never modified, so mark them 'const' so that
they are placed in .rodata and benefit from memory protection.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 block/blk-integrity.c  |  2 +-
 block/t10-pi.c         |  8 ++++----
 include/linux/genhd.h  | 10 +++++-----
 include/linux/t10-pi.h |  8 ++++----
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 9f0ff5ba4f84..b3622cb00fc2 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -389,7 +389,7 @@ static int blk_integrity_nop_fn(struct blk_integrity_iter *iter)
 	return 0;
 }
 
-static struct blk_integrity_profile nop_profile = {
+static const struct blk_integrity_profile nop_profile = {
 	.name = "nop",
 	.generate_fn = blk_integrity_nop_fn,
 	.verify_fn = blk_integrity_nop_fn,
diff --git a/block/t10-pi.c b/block/t10-pi.c
index 2c97912335a9..680c6d636298 100644
--- a/block/t10-pi.c
+++ b/block/t10-pi.c
@@ -160,28 +160,28 @@ static int t10_pi_type3_verify_ip(struct blk_integrity_iter *iter)
 	return t10_pi_verify(iter, t10_pi_ip_fn, 3);
 }
 
-struct blk_integrity_profile t10_pi_type1_crc = {
+const struct blk_integrity_profile t10_pi_type1_crc = {
 	.name			= "T10-DIF-TYPE1-CRC",
 	.generate_fn		= t10_pi_type1_generate_crc,
 	.verify_fn		= t10_pi_type1_verify_crc,
 };
 EXPORT_SYMBOL(t10_pi_type1_crc);
 
-struct blk_integrity_profile t10_pi_type1_ip = {
+const struct blk_integrity_profile t10_pi_type1_ip = {
 	.name			= "T10-DIF-TYPE1-IP",
 	.generate_fn		= t10_pi_type1_generate_ip,
 	.verify_fn		= t10_pi_type1_verify_ip,
 };
 EXPORT_SYMBOL(t10_pi_type1_ip);
 
-struct blk_integrity_profile t10_pi_type3_crc = {
+const struct blk_integrity_profile t10_pi_type3_crc = {
 	.name			= "T10-DIF-TYPE3-CRC",
 	.generate_fn		= t10_pi_type3_generate_crc,
 	.verify_fn		= t10_pi_type3_verify_crc,
 };
 EXPORT_SYMBOL(t10_pi_type3_crc);
 
-struct blk_integrity_profile t10_pi_type3_ip = {
+const struct blk_integrity_profile t10_pi_type3_ip = {
 	.name			= "T10-DIF-TYPE3-IP",
 	.generate_fn		= t10_pi_type3_generate_ip,
 	.verify_fn		= t10_pi_type3_verify_ip,
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 76f39754e7b0..9e11082c7f9b 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -159,11 +159,11 @@ struct badblocks;
 #if defined(CONFIG_BLK_DEV_INTEGRITY)
 
 struct blk_integrity {
-	struct blk_integrity_profile	*profile;
-	unsigned char			flags;
-	unsigned char			tuple_size;
-	unsigned char			interval_exp;
-	unsigned char			tag_size;
+	const struct blk_integrity_profile	*profile;
+	unsigned char				flags;
+	unsigned char				tuple_size;
+	unsigned char				interval_exp;
+	unsigned char				tag_size;
 };
 
 #endif	/* CONFIG_BLK_DEV_INTEGRITY */
diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h
index 9fba9dd33544..9375d23a24e7 100644
--- a/include/linux/t10-pi.h
+++ b/include/linux/t10-pi.h
@@ -34,9 +34,9 @@ struct t10_pi_tuple {
 };
 
 
-extern struct blk_integrity_profile t10_pi_type1_crc;
-extern struct blk_integrity_profile t10_pi_type1_ip;
-extern struct blk_integrity_profile t10_pi_type3_crc;
-extern struct blk_integrity_profile t10_pi_type3_ip;
+extern const struct blk_integrity_profile t10_pi_type1_crc;
+extern const struct blk_integrity_profile t10_pi_type1_ip;
+extern const struct blk_integrity_profile t10_pi_type3_crc;
+extern const struct blk_integrity_profile t10_pi_type3_ip;
 
 #endif
-- 
2.12.1.578.ge9c3154ca4-goog

^ permalink raw reply related

* Re: [PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock
From: Jens Axboe @ 2017-03-24 22:04 UTC (permalink / raw)
  To: Tahsin Erdogan, Tejun Heo; +Cc: linux-block, David Rientjes, linux-kernel
In-Reply-To: <20170324215627.12831-1-tahsin@google.com>

On 03/24/2017 03:56 PM, Tahsin Erdogan wrote:
> blkg_conf_prep() currently calls blkg_lookup_create() while holding
> request queue spinlock. This means allocating memory for struct
> blkcg_gq has to be made non-blocking. This causes occasional -ENOMEM
> failures in call paths like below:
> 
>   pcpu_alloc+0x68f/0x710
>   __alloc_percpu_gfp+0xd/0x10
>   __percpu_counter_init+0x55/0xc0
>   cfq_pd_alloc+0x3b2/0x4e0
>   blkg_alloc+0x187/0x230
>   blkg_create+0x489/0x670
>   blkg_lookup_create+0x9a/0x230
>   blkg_conf_prep+0x1fb/0x240
>   __cfqg_set_weight_device.isra.105+0x5c/0x180
>   cfq_set_weight_on_dfl+0x69/0xc0
>   cgroup_file_write+0x39/0x1c0
>   kernfs_fop_write+0x13f/0x1d0
>   __vfs_write+0x23/0x120
>   vfs_write+0xc2/0x1f0
>   SyS_write+0x44/0xb0
>   entry_SYSCALL_64_fastpath+0x18/0xad
> 
> In the code path above, percpu allocator cannot call vmalloc() due to
> queue spinlock.
> 
> A failure in this call path gives grief to tools which are trying to
> configure io weights. We see occasional failures happen shortly after
> reboots even when system is not under any memory pressure. Machines
> with a lot of cpus are more vulnerable to this condition.
> 
> Do struct blkcg_gq allocations outside the queue spinlock to allow
> blocking during memory allocations.

This looks much simpler/cleaner to me, compared to v5. Tejun, what do
you think?

-- 
Jens Axboe

^ permalink raw reply

* [PATCH] blkcg: allocate struct blkcg_gq outside request queue spinlock
From: Tahsin Erdogan @ 2017-03-24 21:56 UTC (permalink / raw)
  To: Tejun Heo, Jens Axboe
  Cc: linux-block, David Rientjes, linux-kernel, Tahsin Erdogan
In-Reply-To: <CAAeU0aMvuzfkAyhzheYRxfb7NzLk2oJSzUk5+BoVcktrZDtcRw@mail.gmail.com>

blkg_conf_prep() currently calls blkg_lookup_create() while holding
request queue spinlock. This means allocating memory for struct
blkcg_gq has to be made non-blocking. This causes occasional -ENOMEM
failures in call paths like below:

  pcpu_alloc+0x68f/0x710
  __alloc_percpu_gfp+0xd/0x10
  __percpu_counter_init+0x55/0xc0
  cfq_pd_alloc+0x3b2/0x4e0
  blkg_alloc+0x187/0x230
  blkg_create+0x489/0x670
  blkg_lookup_create+0x9a/0x230
  blkg_conf_prep+0x1fb/0x240
  __cfqg_set_weight_device.isra.105+0x5c/0x180
  cfq_set_weight_on_dfl+0x69/0xc0
  cgroup_file_write+0x39/0x1c0
  kernfs_fop_write+0x13f/0x1d0
  __vfs_write+0x23/0x120
  vfs_write+0xc2/0x1f0
  SyS_write+0x44/0xb0
  entry_SYSCALL_64_fastpath+0x18/0xad

In the code path above, percpu allocator cannot call vmalloc() due to
queue spinlock.

A failure in this call path gives grief to tools which are trying to
configure io weights. We see occasional failures happen shortly after
reboots even when system is not under any memory pressure. Machines
with a lot of cpus are more vulnerable to this condition.

Do struct blkcg_gq allocations outside the queue spinlock to allow
blocking during memory allocations.

Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Tahsin Erdogan <tahsin@google.com>
---
v6:
  Due to Jens' objection to conditionally dropping locks based on gfp
  flags, go back to v1 approach.
  Perform queue bypass and policy enabled checks at every iteration.
  Add blkg_lookup_check() to reduce code duplication.

v5:
  Removed stale blkg_alloc() in blkcg_init_queue()

  Pushed down radix_tree_preload() into blkg_create() because it
  disables preemption on return and makes it unsafe to call blocking
  memory allocations.

v4:
  Simplified error checking in blkg_create()
  Factored out __blkg_lookup_create()

v3:
  Pushed down all blkg allocations into blkg_create()

v2:
  Moved blkg creation into blkg_lookup_create() to avoid duplicating
  blkg_lookup_create() logic.

 block/blk-cgroup.c | 123 ++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 98 insertions(+), 25 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index bbe7ee00bd3d..7c2947128f58 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -772,6 +772,27 @@ struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg,
 }
 EXPORT_SYMBOL_GPL(blkg_rwstat_recursive_sum);
 
+/* Performs queue bypass and policy enabled checks then looks up blkg. */
+static struct blkcg_gq *blkg_lookup_check(struct blkcg *blkcg,
+					  const struct blkcg_policy *pol,
+					  struct request_queue *q)
+{
+	WARN_ON_ONCE(!rcu_read_lock_held());
+	lockdep_assert_held(q->queue_lock);
+
+	if (!blkcg_policy_enabled(q, pol))
+		return ERR_PTR(-EOPNOTSUPP);
+
+	/*
+	 * This could be the first entry point of blkcg implementation and
+	 * we shouldn't allow anything to go through for a bypassing queue.
+	 */
+	if (unlikely(blk_queue_bypass(q)))
+		return ERR_PTR(blk_queue_dying(q) ? -ENODEV : -EBUSY);
+
+	return __blkg_lookup(blkcg, q, true /* update_hint */);
+}
+
 /**
  * blkg_conf_prep - parse and prepare for per-blkg config update
  * @blkcg: target block cgroup
@@ -789,6 +810,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
 	__acquires(rcu) __acquires(disk->queue->queue_lock)
 {
 	struct gendisk *disk;
+	struct request_queue *q;
 	struct blkcg_gq *blkg;
 	struct module *owner;
 	unsigned int major, minor;
@@ -807,44 +829,95 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
 	if (!disk)
 		return -ENODEV;
 	if (part) {
-		owner = disk->fops->owner;
-		put_disk(disk);
-		module_put(owner);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto fail;
 	}
 
-	rcu_read_lock();
-	spin_lock_irq(disk->queue->queue_lock);
+	q = disk->queue;
 
-	if (blkcg_policy_enabled(disk->queue, pol))
-		blkg = blkg_lookup_create(blkcg, disk->queue);
-	else
-		blkg = ERR_PTR(-EOPNOTSUPP);
+	rcu_read_lock();
+	spin_lock_irq(q->queue_lock);
 
+	blkg = blkg_lookup_check(blkcg, pol, q);
 	if (IS_ERR(blkg)) {
 		ret = PTR_ERR(blkg);
+		goto fail_unlock;
+	}
+
+	if (blkg)
+		goto success;
+
+	/*
+	 * Create blkgs walking down from blkcg_root to @blkcg, so that all
+	 * non-root blkgs have access to their parents.
+	 */
+	while (true) {
+		struct blkcg *pos = blkcg;
+		struct blkcg *parent;
+		struct blkcg_gq *new_blkg;
+
+		parent = blkcg_parent(blkcg);
+		while (parent && !__blkg_lookup(parent, q, false)) {
+			pos = parent;
+			parent = blkcg_parent(parent);
+		}
+
+		/* Drop locks to do new blkg allocation with GFP_KERNEL. */
+		spin_unlock_irq(q->queue_lock);
 		rcu_read_unlock();
-		spin_unlock_irq(disk->queue->queue_lock);
-		owner = disk->fops->owner;
-		put_disk(disk);
-		module_put(owner);
-		/*
-		 * If queue was bypassing, we should retry.  Do so after a
-		 * short msleep().  It isn't strictly necessary but queue
-		 * can be bypassing for some time and it's always nice to
-		 * avoid busy looping.
-		 */
-		if (ret == -EBUSY) {
-			msleep(10);
-			ret = restart_syscall();
+
+		new_blkg = blkg_alloc(pos, q, GFP_KERNEL);
+		if (unlikely(!new_blkg)) {
+			ret = -ENOMEM;
+			goto fail;
 		}
-		return ret;
-	}
 
+		rcu_read_lock();
+		spin_lock_irq(q->queue_lock);
+
+		blkg = blkg_lookup_check(pos, pol, q);
+		if (IS_ERR(blkg)) {
+			ret = PTR_ERR(blkg);
+			goto fail_unlock;
+		}
+
+		if (blkg) {
+			blkg_free(new_blkg);
+		} else {
+			blkg = blkg_create(pos, q, new_blkg);
+			if (unlikely(IS_ERR(blkg))) {
+				ret = PTR_ERR(blkg);
+				goto fail_unlock;
+			}
+		}
+
+		if (pos == blkcg)
+			goto success;
+	}
+success:
 	ctx->disk = disk;
 	ctx->blkg = blkg;
 	ctx->body = body;
 	return 0;
+
+fail_unlock:
+	spin_unlock_irq(q->queue_lock);
+	rcu_read_unlock();
+fail:
+	owner = disk->fops->owner;
+	put_disk(disk);
+	module_put(owner);
+	/*
+	 * If queue was bypassing, we should retry.  Do so after a
+	 * short msleep().  It isn't strictly necessary but queue
+	 * can be bypassing for some time and it's always nice to
+	 * avoid busy looping.
+	 */
+	if (ret == -EBUSY) {
+		msleep(10);
+		ret = restart_syscall();
+	}
+	return ret;
 }
 EXPORT_SYMBOL_GPL(blkg_conf_prep);
 
-- 
2.12.1.578.ge9c3154ca4-goog

^ permalink raw reply related

* Re: [PATCH] block: correct documentation for blkdev_issue_discard() flags
From: Jens Axboe @ 2017-03-24 21:42 UTC (permalink / raw)
  To: Eric Biggers, linux-block; +Cc: Eric Biggers
In-Reply-To: <20170324213956.GC4986@gmail.com>

On 03/24/2017 03:39 PM, Eric Biggers wrote:
> On Mon, Jan 23, 2017 at 11:41:39AM -0800, Eric Biggers wrote:
>> From: Eric Biggers <ebiggers@google.com>
>>
>> BLKDEV_IFL_* flags no longer exist; blkdev_issue_discard() now actually
>> takes BLKDEV_DISCARD_* flags.
>>
>> Signed-off-by: Eric Biggers <ebiggers@google.com>
>> ---
>>  block/blk-lib.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/block/blk-lib.c b/block/blk-lib.c
>> index ed89c8f4b2a0..463b76dd566f 100644
>> --- a/block/blk-lib.c
>> +++ b/block/blk-lib.c
>> @@ -109,7 +109,7 @@ EXPORT_SYMBOL(__blkdev_issue_discard);
>>   * @sector:	start sector
>>   * @nr_sects:	number of sectors to discard
>>   * @gfp_mask:	memory allocation flags (for bio_alloc)
>> - * @flags:	BLKDEV_IFL_* flags to control behaviour
>> + * @flags:	BLKDEV_DISCARD_* flags to control behaviour
>>   *
>>   * Description:
>>   *    Issue a discard request for the sectors in question.
>> -- 
>> 2.11.0.483.g087da7b7c-goog
>>
> 
> Ping?

Sorry, looks like that got lost. I've applied this, and your other
patch. Thanks for the reminder!

-- 
Jens Axboe

^ permalink raw reply

* Re: [PATCH] block: remove outdated part of blkdev_issue_flush() comment
From: Eric Biggers @ 2017-03-24 21:40 UTC (permalink / raw)
  To: linux-block; +Cc: Jens Axboe, Eric Biggers
In-Reply-To: <20170123194321.51596-1-ebiggers3@gmail.com>

On Mon, Jan 23, 2017 at 11:43:21AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> blkdev_issue_flush() is now always synchronous, and it no longer has a
> flags argument.  So remove the part of the comment about the WAIT flag.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  block/blk-flush.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/blk-flush.c b/block/blk-flush.c
> index 20b7c7a02f1c..3c0ab7361e46 100644
> --- a/block/blk-flush.c
> +++ b/block/blk-flush.c
> @@ -490,8 +490,7 @@ void blk_insert_flush(struct request *rq)
>   * Description:
>   *    Issue a flush for the block device in question. Caller can supply
>   *    room for storing the error offset in case of a flush error, if they
> - *    wish to. If WAIT flag is not passed then caller may check only what
> - *    request was pushed in some internal queue for later handling.
> + *    wish to.
>   */
>  int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
>  		sector_t *error_sector)
> -- 
> 2.11.0.483.g087da7b7c-goog
> 

Ping?

^ permalink raw reply

* Re: [PATCH] block: correct documentation for blkdev_issue_discard() flags
From: Eric Biggers @ 2017-03-24 21:39 UTC (permalink / raw)
  To: linux-block; +Cc: Jens Axboe, Eric Biggers
In-Reply-To: <20170123194139.51469-1-ebiggers3@gmail.com>

On Mon, Jan 23, 2017 at 11:41:39AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> BLKDEV_IFL_* flags no longer exist; blkdev_issue_discard() now actually
> takes BLKDEV_DISCARD_* flags.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  block/blk-lib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index ed89c8f4b2a0..463b76dd566f 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -109,7 +109,7 @@ EXPORT_SYMBOL(__blkdev_issue_discard);
>   * @sector:	start sector
>   * @nr_sects:	number of sectors to discard
>   * @gfp_mask:	memory allocation flags (for bio_alloc)
> - * @flags:	BLKDEV_IFL_* flags to control behaviour
> + * @flags:	BLKDEV_DISCARD_* flags to control behaviour
>   *
>   * Description:
>   *    Issue a discard request for the sectors in question.
> -- 
> 2.11.0.483.g087da7b7c-goog
> 

Ping?

^ permalink raw reply

* Re: [PATCH 0/4] nbd fixes for this cycle
From: Jens Axboe @ 2017-03-24 18:57 UTC (permalink / raw)
  To: Josef Bacik, nbd-general, linux-block, kernel-team
In-Reply-To: <1490378909-4056-1-git-send-email-josef@toxicpanda.com>

On 03/24/2017 12:08 PM, Josef Bacik wrote:
> These 4 patches are to fix up various regressions and problems in NBD.  The
> ERESTARTSYS is the biggest patch but has been pretty well tested with a debug
> patch that forced the behavior to happen.  Everything else is relatively small,
> and the queue timeout patch is a regression from last cycle.  Thanks,

Added for 4.11.

-- 
Jens Axboe

^ permalink raw reply

* Re: [PATCH v2 2/4] block: add a read barrier in blk_queue_enter()
From: Bart Van Assche @ 2017-03-24 18:45 UTC (permalink / raw)
  To: tom.leiming@gmail.com
  Cc: hch@infradead.org, linux-block@vger.kernel.org, hare@suse.de,
	axboe@fb.com
In-Reply-To: <CACVXFVN7_PovXhKFofqf7N99Fq6RHEtFojHzwc6AN1oEpFLYxA@mail.gmail.com>

On Sat, 2017-03-25 at 01:38 +0800, Ming Lei wrote:
> As I explained, the dying flag should only be mentioned after we change
> the code in blk_set_queue_dying().

Hello Ming,

If patches 2 and 4 would be combined into a single patch then it wouldn't
be necessary anymore to update the comment introduced in patch 2 in patch 4=
.
I think that would make this patch series easier to review.

Since the issues fixed by your patches are longstanding issues, have you
considered to add a "Cc: stable" tag?

Thanks,

Bart.=

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox