[PATCH] ocfs2: Remove redundant conditional before iput

2020-12-30 Thread Yi Li
iput handles NULL pointers gracefully, so there's no need to
check the pointer before the call.

Signed-off-by: Yi Li 
---
 fs/ocfs2/super.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 2febc76e9de7..079f8826993e 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -973,8 +973,6 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb)
 * quota files */
dquot_disable(sb, type, DQUOT_USAGE_ENABLED |
DQUOT_LIMITS_ENABLED);
-   if (!inode)
-   continue;
iput(inode);
}
 }
-- 
2.25.3





[PATCH] Use IS_ERR instead of IS_ERR_OR_NULL and set inode null when IS_ERR.

2020-12-29 Thread Yi Li
1: ext4_iget/ext4_find_extent never returns NULL, use IS_ERR
instead of IS_ERR_OR_NULL to fix this.

2: ext4_fc_replay_inode should set the inode to NULL when IS_ERR.
and go to call iput properly.

Signed-off-by: Yi Li 
---
 fs/ext4/fast_commit.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
index 4fcc21c25e79..6b5489273c85 100644
--- a/fs/ext4/fast_commit.c
+++ b/fs/ext4/fast_commit.c
@@ -1318,14 +1318,14 @@ static int ext4_fc_replay_unlink(struct super_block 
*sb, struct ext4_fc_tl *tl)
entry.len = darg.dname_len;
inode = ext4_iget(sb, darg.ino, EXT4_IGET_NORMAL);
 
-   if (IS_ERR_OR_NULL(inode)) {
+   if (IS_ERR(inode)) {
jbd_debug(1, "Inode %d not found", darg.ino);
return 0;
}
 
old_parent = ext4_iget(sb, darg.parent_ino,
EXT4_IGET_NORMAL);
-   if (IS_ERR_OR_NULL(old_parent)) {
+   if (IS_ERR(old_parent)) {
jbd_debug(1, "Dir with inode  %d not found", darg.parent_ino);
iput(inode);
return 0;
@@ -1410,7 +1410,7 @@ static int ext4_fc_replay_link(struct super_block *sb, 
struct ext4_fc_tl *tl)
darg.parent_ino, darg.dname_len);
 
inode = ext4_iget(sb, darg.ino, EXT4_IGET_NORMAL);
-   if (IS_ERR_OR_NULL(inode)) {
+   if (IS_ERR(inode)) {
jbd_debug(1, "Inode not found.");
return 0;
}
@@ -1466,10 +1466,11 @@ static int ext4_fc_replay_inode(struct super_block *sb, 
struct ext4_fc_tl *tl)
trace_ext4_fc_replay(sb, tag, ino, 0, 0);
 
inode = ext4_iget(sb, ino, EXT4_IGET_NORMAL);
-   if (!IS_ERR_OR_NULL(inode)) {
+   if (!IS_ERR(inode)) {
ext4_ext_clear_bb(inode);
iput(inode);
}
+   inode = NULL;
 
ext4_fc_record_modified_inode(sb, ino);
 
@@ -1512,7 +1513,7 @@ static int ext4_fc_replay_inode(struct super_block *sb, 
struct ext4_fc_tl *tl)
 
/* Given that we just wrote the inode on disk, this SHOULD succeed. */
inode = ext4_iget(sb, ino, EXT4_IGET_NORMAL);
-   if (IS_ERR_OR_NULL(inode)) {
+   if (IS_ERR(inode)) {
jbd_debug(1, "Inode not found.");
return -EFSCORRUPTED;
}
@@ -1564,7 +1565,7 @@ static int ext4_fc_replay_create(struct super_block *sb, 
struct ext4_fc_tl *tl)
goto out;
 
inode = ext4_iget(sb, darg.ino, EXT4_IGET_NORMAL);
-   if (IS_ERR_OR_NULL(inode)) {
+   if (IS_ERR(inode)) {
jbd_debug(1, "inode %d not found.", darg.ino);
inode = NULL;
ret = -EINVAL;
@@ -1577,7 +1578,7 @@ static int ext4_fc_replay_create(struct super_block *sb, 
struct ext4_fc_tl *tl)
 * dot and dot dot dirents are setup properly.
 */
dir = ext4_iget(sb, darg.parent_ino, EXT4_IGET_NORMAL);
-   if (IS_ERR_OR_NULL(dir)) {
+   if (IS_ERR(dir)) {
jbd_debug(1, "Dir %d not found.", darg.ino);
goto out;
}
@@ -1653,7 +1654,7 @@ static int ext4_fc_replay_add_range(struct super_block 
*sb,
 
inode = ext4_iget(sb, le32_to_cpu(fc_add_ex->fc_ino),
EXT4_IGET_NORMAL);
-   if (IS_ERR_OR_NULL(inode)) {
+   if (IS_ERR(inode)) {
jbd_debug(1, "Inode not found.");
return 0;
}
@@ -1777,7 +1778,7 @@ ext4_fc_replay_del_range(struct super_block *sb, struct 
ext4_fc_tl *tl)
le32_to_cpu(lrange->fc_ino), cur, remaining);
 
inode = ext4_iget(sb, le32_to_cpu(lrange->fc_ino), EXT4_IGET_NORMAL);
-   if (IS_ERR_OR_NULL(inode)) {
+   if (IS_ERR(inode)) {
jbd_debug(1, "Inode %d not found", le32_to_cpu(lrange->fc_ino));
return 0;
}
@@ -1832,7 +1833,7 @@ static void ext4_fc_set_bitmaps_and_counters(struct 
super_block *sb)
for (i = 0; i < state->fc_modified_inodes_used; i++) {
inode = ext4_iget(sb, state->fc_modified_inodes[i],
EXT4_IGET_NORMAL);
-   if (IS_ERR_OR_NULL(inode)) {
+   if (IS_ERR(inode)) {
jbd_debug(1, "Inode %d not found.",
state->fc_modified_inodes[i]);
continue;
@@ -1849,7 +1850,7 @@ static void ext4_fc_set_bitmaps_and_counters(struct 
super_block *sb)
 
if (ret > 0) {
path = ext4_find_extent(inode, map.m_lblk, 
NULL, 0);
-   if (!IS_ERR_OR_NULL(path)) {
+   if (!IS_ERR(path)) {
  

[PATCH] bcache: set pdev_set_uuid before scond loop iteration

2020-12-23 Thread Yi Li
There is no need to reassign pdev_set_uuid in the second loop iteration,
so move it to the place before second loop.

Signed-off-by: Yi Li 
---
 drivers/md/bcache/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index a4752ac410dc..6aa23a6fb394 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2644,8 +2644,8 @@ static ssize_t bch_pending_bdevs_cleanup(struct kobject 
*k,
}
 
list_for_each_entry_safe(pdev, tpdev, _devs, list) {
+   char *pdev_set_uuid = pdev->dc->sb.set_uuid;
list_for_each_entry_safe(c, tc, _cache_sets, list) {
-   char *pdev_set_uuid = pdev->dc->sb.set_uuid;
char *set_uuid = c->set_uuid;
 
if (!memcmp(pdev_set_uuid, set_uuid, 16)) {
-- 
2.25.3





[PATCH v4] bcache:remove a superfluous check in register_bcache

2020-12-21 Thread Yi Li
There have no reassign the bdev after check It is IS_ERR.
the double check !IS_ERR(bdev) is superfluous.

After commit 4e7b5671c6a8 ("block: remove i_bdev"),
"Switch the block device lookup interfaces to directly work with a dev_t
so that struct block_device references are only acquired by the
blkdev_get variants (and the blk-cgroup special case).  This means that
we now don't need an extra reference in the inode and can generally
simplify handling of struct block_device to keep the lookups contained
in the core block layer code."

so after lookup_bdev call, there no need to do bdput.

remove a superfluous check the bdev & don't call bdput after lookup_bdev.

Fixes: 4e7b5671c6a8("block: remove i_bdev")
Signed-off-by: Yi Li 
---
 drivers/md/bcache/super.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 0e06d721cd8e..a4752ac410dc 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2535,8 +2535,6 @@ static ssize_t register_bcache(struct kobject *k, struct 
kobj_attribute *attr,
else
err = "device busy";
mutex_unlock(_register_lock);
-   if (!IS_ERR(bdev))
-   bdput(bdev);
if (attr == _register_quiet)
goto done;
}
-- 
2.25.3





[PATCH v2] bcache: Trivial fix to register_bcache

2020-12-20 Thread Yi Li
Trivial fix to no need to check the bdev and do bdput.

Fixes: 4e7b5671c6a8("block: remove i_bdev")

Signed-off-by: Yi Li 
---
 drivers/md/bcache/super.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index f7ad1e26b013..4edf666860ad 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2525,8 +2525,6 @@ static ssize_t register_bcache(struct kobject *k, struct 
kobj_attribute *attr,
else
err = "device busy";
mutex_unlock(_register_lock);
-   if (!IS_ERR(bdev))
-   bdput(bdev);
if (attr == _register_quiet)
goto done;
}
-- 
2.25.3





[PATCH] bcache: Trivial fix to bdput

2020-12-20 Thread Yi Li
Trivial fix to bdput.

Signed-off-by: Yi Li 
---
 drivers/md/bcache/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index f7ad1e26b013..1756f6926098 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2525,8 +2525,8 @@ static ssize_t register_bcache(struct kobject *k, struct 
kobj_attribute *attr,
else
err = "device busy";
mutex_unlock(_register_lock);
-   if (!IS_ERR(bdev))
-   bdput(bdev);
+   if (!IS_ERR(dev))
+   bdput(dev);
if (attr == _register_quiet)
goto done;
}
-- 
2.25.3





[PATCH] bcache: fix UUID room exhausted fake issue.

2020-12-17 Thread Yi Li
The UUID room will be exhausted fake when loop attach/dettach backing dev.

Using zero_uuid to the UUID room after dettach normaly.
And attach dev can request UUID room successfully.

Signed-off-by: Yi Li 
Signed-off-by: Li bing 
---
 drivers/md/bcache/super.c | 20 +---
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 0e06d721cd8e..f7ad1e26b013 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -34,10 +34,7 @@ static const char bcache_magic[] = {
0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81
 };
 
-static const char invalid_uuid[] = {
-   0xa0, 0x3e, 0xf8, 0xed, 0x3e, 0xe1, 0xb8, 0x78,
-   0xc8, 0x50, 0xfc, 0x5e, 0xcb, 0x16, 0xcd, 0x99
-};
+static const char zero_uuid[16] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
 
 static struct kobject *bcache_kobj;
 struct mutex bch_register_lock;
@@ -515,13 +512,6 @@ static struct uuid_entry *uuid_find(struct cache_set *c, 
const char *uuid)
return NULL;
 }
 
-static struct uuid_entry *uuid_find_empty(struct cache_set *c)
-{
-   static const char zero_uuid[16] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
-
-   return uuid_find(c, zero_uuid);
-}
-
 /*
  * Bucket priorities/gens:
  *
@@ -803,7 +793,7 @@ static void bcache_device_detach(struct bcache_device *d)
struct uuid_entry *u = d->c->uuids + d->id;
 
SET_UUID_FLASH_ONLY(u, 0);
-   memcpy(u->uuid, invalid_uuid, 16);
+   memcpy(u->uuid, zero_uuid, 16);
u->invalidated = cpu_to_le32((u32)ktime_get_real_seconds());
bch_uuid_write(d->c);
}
@@ -1211,7 +1201,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct 
cache_set *c,
if (u &&
(BDEV_STATE(>sb) == BDEV_STATE_STALE ||
 BDEV_STATE(>sb) == BDEV_STATE_NONE)) {
-   memcpy(u->uuid, invalid_uuid, 16);
+   memcpy(u->uuid, zero_uuid, 16);
u->invalidated = cpu_to_le32((u32)ktime_get_real_seconds());
u = NULL;
}
@@ -1223,7 +1213,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct 
cache_set *c,
return -ENOENT;
}
 
-   u = uuid_find_empty(c);
+   u = uuid_find(c, zero_uuid);
if (!u) {
pr_err("Not caching %s, no room for UUID\n",
   dc->backing_dev_name);
@@ -1554,7 +1544,7 @@ int bch_flash_dev_create(struct cache_set *c, uint64_t 
size)
if (!test_bit(CACHE_SET_RUNNING, >flags))
return -EPERM;
 
-   u = uuid_find_empty(c);
+   u = uuid_find(c, zero_uuid);
if (!u) {
pr_err("Can't create volume, no room for UUID\n");
return -EINVAL;
-- 
2.25.3





[PATCH v3] bcache: fix panic due to cache_set is null

2020-12-03 Thread Yi Li
bcache_device_detach will release the cache_set after hotunplug cache
disk.

Here is how the issue happens.
1) cached_dev_free do cancel_writeback_rate_update_dwork
   without bch_register_lock.
2) Wirting the writeback_percent by sysfs with
   bch_register_lock will insert a writeback_rate_update work.
3) cached_dev_free with bch_register_lock to do bcache_device_free.
   dc->disk.c will be set NULL.
4) update_writeback_rate will crash when access dc->disk.c.

After Patch:
1) cached_dev_free do cancel_writeback_rate_update_dwork and set dc->disk.c
   to NULL with bch_register_lock.
2) dc->disk.c = NULL will avoid that Wirting the writeback_percent by sysfs
   insert a writeback_rate_update work.

Fixes: 80265d8dfd77 ("bcache: acquire bch_register_lock later in 
cached_dev_free()")

  IP: [] update_writeback_rate+0x59/0x3a0 [bcache]
  PGD 879620067 PUD 8755d3067 PMD 0
  Oops:  [#1] SMP
  CPU: 8 PID: 1005702 Comm: kworker/8:0 Tainted: G 4.4.0+10 #1
  Hardware name: Intel BIOS SE5C610.86B.01.01.0021.032120170601 03/21/2017
  Workqueue: events update_writeback_rate [bcache]
  task: 8808786f3800 ti: 88077082c000 task.ti: 88077082c000
  RIP: e030:[] update_writeback_rate+0x59/0x3a0 [bcache]
  RSP: e02b:88077082fde0  EFLAGS: 00010202
  RAX: 0018 RBX: 8808047f0b08 RCX: 
  RDX: 0001 RSI: 88088170dab8 RDI: 88088170dab8
  RBP: 88077082fe18 R08: 000a R09: 
  R10:  R11: 00017bc8 R12: 
  R13: 8808047f R14: 0200 R15: 8808047f0b08
  FS:  7f157b6d6700() GS:88088170() knlGS:
  CS:  e033 DS:  ES:  CR0: 80050033
  CR2: 0368 CR3: 000875c05000 CR4: 00040660
  Stack:
   0001 7ff0 88085ff600c0 880881714e80
   880881719500 0200 8808047f0b08 88077082fe60
   81088c0c 81714e80  880881714e80
  Call Trace:
   [] process_one_work+0x1fc/0x3b0
   [] worker_thread+0x2a5/0x470
   [] ? __schedule+0x648/0x870
   [] ? rescuer_thread+0x300/0x300
   [] kthread+0xd5/0xe0
   [] ? kthread_stop+0x110/0x110
   [] ret_from_fork+0x3f/0x70
   [] ? kthread_stop+0x110/0x110

Reported-by: Guo Chao 
Signed-off-by: Yi Li 
---
 drivers/md/bcache/super.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 46a00134a36a..381f9fbcd765 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1122,9 +1122,6 @@ static void cached_dev_detach_finish(struct work_struct 
*w)
BUG_ON(refcount_read(>count));
 
 
-   if (test_and_clear_bit(BCACHE_DEV_WB_RUNNING, >disk.flags))
-   cancel_writeback_rate_update_dwork(dc);
-
if (!IS_ERR_OR_NULL(dc->writeback_thread)) {
kthread_stop(dc->writeback_thread);
dc->writeback_thread = NULL;
@@ -1138,6 +1135,9 @@ static void cached_dev_detach_finish(struct work_struct 
*w)
 
mutex_lock(_register_lock);
 
+   if (test_and_clear_bit(BCACHE_DEV_WB_RUNNING, >disk.flags))
+   cancel_writeback_rate_update_dwork(dc);
+
calc_cached_dev_sectors(dc->disk.c);
bcache_device_detach(>disk);
list_move(>list, _devices);
@@ -1334,9 +1334,6 @@ static void cached_dev_free(struct closure *cl)
 {
struct cached_dev *dc = container_of(cl, struct cached_dev, disk.cl);
 
-   if (test_and_clear_bit(BCACHE_DEV_WB_RUNNING, >disk.flags))
-   cancel_writeback_rate_update_dwork(dc);
-
if (!IS_ERR_OR_NULL(dc->writeback_thread))
kthread_stop(dc->writeback_thread);
if (!IS_ERR_OR_NULL(dc->status_update_thread))
@@ -1344,6 +1341,9 @@ static void cached_dev_free(struct closure *cl)
 
mutex_lock(_register_lock);
 
+   if (test_and_clear_bit(BCACHE_DEV_WB_RUNNING, >disk.flags))
+   cancel_writeback_rate_update_dwork(dc);
+
if (atomic_read(>running))
bd_unlink_disk_holder(dc->bdev, dc->disk.disk);
bcache_device_free(>disk);
-- 
2.25.3





Re: [PATCH v2] bcache: fix panic due to cache_set is null

2020-12-03 Thread Yi Li
On 12/3/20, Coly Li  wrote:
> On 12/3/20 5:47 PM, Yi Li wrote:
>> bcache_device_detach will release the cache_set after hotunplug cache
>> disk.
>>
>> Here is how the issue happens.
>> 1) cached_dev_free do cancel_writeback_rate_update_dwork
>>without bch_register_lock.
>> 2) Wirting the writeback_percent by sysfs with
>>bch_register_lock will insert a writeback_rate_update work.
>> 3) cached_dev_free with bch_register_lock to do bcache_device_free.
>>dc->disk.cl will be set NULL
>> 4) update_writeback_rate will crash when access dc->disk.cl
>
> The analysis makes sense, good catch! Thank you for make me understand
> the problem.
>
>
>>
>> Fixes: 80265d8dfd77 ("bcache: acquire bch_register_lock later in
>> cached_dev_free()")
>>
>>   IP: [] update_writeback_rate+0x59/0x3a0 [bcache]
>>   PGD 879620067 PUD 8755d3067 PMD 0
>>   Oops:  [#1] SMP
>>   CPU: 8 PID: 1005702 Comm: kworker/8:0 Tainted: G 4.4.0+10 #1
>>   Hardware name: Intel BIOS SE5C610.86B.01.01.0021.032120170601
>> 03/21/2017
>>   Workqueue: events update_writeback_rate [bcache]
>>   task: 8808786f3800 ti: 88077082c000 task.ti: 88077082c000
>>   RIP: e030:[] update_writeback_rate+0x59/0x3a0
>> [bcache]
>>   RSP: e02b:88077082fde0  EFLAGS: 00010202
>>   RAX: 0018 RBX: 8808047f0b08 RCX: 
>>   RDX: 0001 RSI: 88088170dab8 RDI: 88088170dab8
>>   RBP: 88077082fe18 R08: 000a R09: 
>>   R10:  R11: 00017bc8 R12: 
>>   R13: 8808047f R14: 0200 R15: 8808047f0b08
>>   FS:  7f157b6d6700() GS:88088170()
>> knlGS:
>>   CS:  e033 DS:  ES:  CR0: 80050033
>>   CR2: 0368 CR3: 000875c05000 CR4: 00040660
>>   Stack:
>>0001 7ff0 88085ff600c0 880881714e80
>>880881719500 0200 8808047f0b08 88077082fe60
>>81088c0c 81714e80  880881714e80
>>   Call Trace:
>>[] process_one_work+0x1fc/0x3b0
>>    [] worker_thread+0x2a5/0x470
>>[] ? __schedule+0x648/0x870
>>[] ? rescuer_thread+0x300/0x300
>>[] kthread+0xd5/0xe0
>>[] ? kthread_stop+0x110/0x110
>>[] ret_from_fork+0x3f/0x70
>>[] ? kthread_stop+0x110/0x110
>>
>> Reported-by: Guo Chao 
>> Signed-off-by: Yi Li 
>> ---
>>  drivers/md/bcache/super.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
>> index 46a00134a36a..8b341f756ac0 100644
>> --- a/drivers/md/bcache/super.c
>> +++ b/drivers/md/bcache/super.c
>> @@ -1334,9 +1334,6 @@ static void cached_dev_free(struct closure *cl)
>>  {
>>  struct cached_dev *dc = container_of(cl, struct cached_dev, disk.cl);
>>
>> -if (test_and_clear_bit(BCACHE_DEV_WB_RUNNING, >disk.flags))
>> -cancel_writeback_rate_update_dwork(dc);
>> -
>>  if (!IS_ERR_OR_NULL(dc->writeback_thread))
>>  kthread_stop(dc->writeback_thread);
>>  if (!IS_ERR_OR_NULL(dc->status_update_thread))
>> @@ -1344,6 +1341,9 @@ static void cached_dev_free(struct closure *cl)
>>
>>  mutex_lock(_register_lock);
>>
>> +if (test_and_clear_bit(BCACHE_DEV_WB_RUNNING, >disk.flags))
>> +cancel_writeback_rate_update_dwork(dc);
>> +
>>  if (atomic_read(>running))
>>  bd_unlink_disk_holder(dc->bdev, dc->disk.disk);
>>  bcache_device_free(>disk);
>>
>
> Such change is problematic, the writeback rate kworker mush stopped
> before writeback and status_update thread, otherwise you may encounter
> other problem.
>
enn, It is possible that I miss something.

1: writeback_rate_update work will add to the system_wq by
schedule_delayed_work.

2: The issue 80265d8dfd77 --" After moving
mutex_lock(_register_lock) to a later location where before
atomic_read(>running) in cached_dev_free()" .


> And when I review your patch I find another similar potential problem.
>
> This is tricky, let me think how to fix it 
>
> Thank you again, for catch such issue.
>
> Coly Li
>
>


[PATCH v2] bcache: fix panic due to cache_set is null

2020-12-03 Thread Yi Li
bcache_device_detach will release the cache_set after hotunplug cache
disk.

Here is how the issue happens.
1) cached_dev_free do cancel_writeback_rate_update_dwork
   without bch_register_lock.
2) Wirting the writeback_percent by sysfs with
   bch_register_lock will insert a writeback_rate_update work.
3) cached_dev_free with bch_register_lock to do bcache_device_free.
   dc->disk.cl will be set NULL
4) update_writeback_rate will crash when access dc->disk.cl

Fixes: 80265d8dfd77 ("bcache: acquire bch_register_lock later in 
cached_dev_free()")

  IP: [] update_writeback_rate+0x59/0x3a0 [bcache]
  PGD 879620067 PUD 8755d3067 PMD 0
  Oops:  [#1] SMP
  CPU: 8 PID: 1005702 Comm: kworker/8:0 Tainted: G 4.4.0+10 #1
  Hardware name: Intel BIOS SE5C610.86B.01.01.0021.032120170601 03/21/2017
  Workqueue: events update_writeback_rate [bcache]
  task: 8808786f3800 ti: 88077082c000 task.ti: 88077082c000
  RIP: e030:[] update_writeback_rate+0x59/0x3a0 [bcache]
  RSP: e02b:88077082fde0  EFLAGS: 00010202
  RAX: 0018 RBX: 8808047f0b08 RCX: 
  RDX: 0001 RSI: 88088170dab8 RDI: 88088170dab8
  RBP: 88077082fe18 R08: 000a R09: 
  R10:  R11: 00017bc8 R12: 
  R13: 8808047f R14: 0200 R15: 8808047f0b08
  FS:  7f157b6d6700() GS:88088170() knlGS:
  CS:  e033 DS:  ES:  CR0: 80050033
  CR2: 0368 CR3: 000875c05000 CR4: 00040660
  Stack:
   0001 7ff0 88085ff600c0 880881714e80
   880881719500 0200 8808047f0b08 88077082fe60
   81088c0c 81714e80  880881714e80
  Call Trace:
   [] process_one_work+0x1fc/0x3b0
   [] worker_thread+0x2a5/0x470
   [] ? __schedule+0x648/0x870
   [] ? rescuer_thread+0x300/0x300
   [] kthread+0xd5/0xe0
   [] ? kthread_stop+0x110/0x110
   [] ret_from_fork+0x3f/0x70
   [] ? kthread_stop+0x110/0x110

Reported-by: Guo Chao 
Signed-off-by: Yi Li 
---
 drivers/md/bcache/super.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 46a00134a36a..8b341f756ac0 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1334,9 +1334,6 @@ static void cached_dev_free(struct closure *cl)
 {
struct cached_dev *dc = container_of(cl, struct cached_dev, disk.cl);
 
-   if (test_and_clear_bit(BCACHE_DEV_WB_RUNNING, >disk.flags))
-   cancel_writeback_rate_update_dwork(dc);
-
if (!IS_ERR_OR_NULL(dc->writeback_thread))
kthread_stop(dc->writeback_thread);
if (!IS_ERR_OR_NULL(dc->status_update_thread))
@@ -1344,6 +1341,9 @@ static void cached_dev_free(struct closure *cl)
 
mutex_lock(_register_lock);
 
+   if (test_and_clear_bit(BCACHE_DEV_WB_RUNNING, >disk.flags))
+   cancel_writeback_rate_update_dwork(dc);
+
if (atomic_read(>running))
bd_unlink_disk_holder(dc->bdev, dc->disk.disk);
bcache_device_free(>disk);
-- 
2.25.3





Re: [PATCH] bcache: fix panic due to cache_set is null

2020-12-03 Thread Yi Li
The root cause:

After just  cached_dev_free do cancel_writeback_rate_update_dwork
without bch_register_lock
.
at the same time. Wirting the writeback_percent by sysfs witch
bch_register_lock will insert a writeback_rate_update work.

cached_dev_free with bch_register_lock to do bcache_device_free.

(it is introduce by patch 80265d8dfd77792e133793cef44a21323aac2908)

pls:
1: run the shell script
#!/bin/bash
while [ true ]
do
echo 0 > /sys/block/bcache0/bcache/writeback_percent
done

2: hotplug the cache disk


On 12/3/20, Coly Li  wrote:
> On 12/3/20 2:25 PM, Yi Li wrote:
>>> On 12/1/20 12:35 PM, Yi Li wrote:
>>>> sorry, This patch will cause deadlock, i will check and redo it.
>>>
>>> Can you try latest upstream kernel firstly ? Before spending more time
>>> on the fix.
>>>
>>
>> This issue just happened three times (xenserver7.5 dom0 kernel) on the
>> same machine and cannot reproduce it now. and have not reproduce it
>> using the lastest uptream kernel.
>>
>
> Hmm, this is something very probably that I am not able to help. It
> seems the kernel is a third-part maintained Linux v4.4 based kernel +
> bcache backport, which is out of my view.
>
> If similar problem happens on latest upstream kernel, or at least v5.8+
> kernel, I can help to take a look.
>
>
>>> If I remember correctly, when cancel_writeback_rate_update_dwork() is
>>> not timed out, the cache set memory won't be freed before the
>>> writeback_rate_update worker terminates. It is possible that I miss
>>> something in the code, but I suggest to test with a kernel after v5.3,
>>> and better a v5.8+ kernel.
>>>
>>> Coly Li
>>>
>> Thanks.
>>
>> it is  confused that why writeback_rate_update worker run  again after
>> cancel_delayed_work_sync( kernel log telled).
>>
>
> [snipped]
>
> Coly Li
>


Re: [PATCH] bcache: fix panic due to cache_set is null

2020-12-02 Thread Yi Li
> On 12/1/20 12:35 PM, Yi Li wrote:
>> sorry, This patch will cause deadlock, i will check and redo it.
>
> Can you try latest upstream kernel firstly ? Before spending more time
> on the fix.
>

This issue just happened three times (xenserver7.5 dom0 kernel) on the
same machine and cannot reproduce it now. and have not reproduce it
using the lastest uptream kernel.

> If I remember correctly, when cancel_writeback_rate_update_dwork() is
> not timed out, the cache set memory won't be freed before the
> writeback_rate_update worker terminates. It is possible that I miss
> something in the code, but I suggest to test with a kernel after v5.3,
> and better a v5.8+ kernel.
>
> Coly Li
>
Thanks.

it is  confused that why writeback_rate_update worker run  again after
cancel_delayed_work_sync( kernel log telled).

Maybe i should dig more.

Attach some debug info as below.

Nov 30 18:00:44 host-126 kernel: [ 1697.906137] bcache:
update_writeback_rate() dc = 88081858
Nov 30 18:00:44 host-126 kernel: [ 1697.906145] bcache:
update_writeback_rate() c = 8808182c
Nov 30 18:00:44 host-126 kernel: [ 1697.906148] bcache:
update_writeback_rate() dc->disk.flags = 8808185800a0
Nov 30 18:00:44 host-126 kernel: [ 1697.906150] bcache:
update_writeback_rate() c->flags = 8808182c0368
Nov 30 18:00:45 host-126 kernel: [ 1698.578104] bcache:
update_writeback_rate() dc = 880839bd
Nov 30 18:00:45 host-126 kernel: [ 1698.578108] bcache:
update_writeback_rate() c = 8808182c
Nov 30 18:00:45 host-126 kernel: [ 1698.578109] bcache:
update_writeback_rate() dc->disk.flags = 880839bd00a0
Nov 30 18:00:45 host-126 kernel: [ 1698.578111] bcache:
update_writeback_rate() c->flags = 8808182c0368
Nov 30 18:00:49 host-126 kernel: [ 1702.914126] bcache:
update_writeback_rate() dc = 88081858
Nov 30 18:00:49 host-126 kernel: [ 1702.914130] bcache:
update_writeback_rate() c = 8808182c
Nov 30 18:00:49 host-126 kernel: [ 1702.914132] bcache:
update_writeback_rate() dc->disk.flags = 8808185800a0
Nov 30 18:00:49 host-126 kernel: [ 1702.914133] bcache:
update_writeback_rate() c->flags = 8808182c0368
Nov 30 18:00:50 host-126 kernel: [ 1703.586182] bcache:
update_writeback_rate() dc = 880839bd
Nov 30 18:00:50 host-126 kernel: [ 1703.586188] bcache:
update_writeback_rate() c = 8808182c
Nov 30 18:00:50 host-126 kernel: [ 1703.586191] bcache:
update_writeback_rate() dc->disk.flags = 880839bd00a0
Nov 30 18:00:50 host-126 kernel: [ 1703.586193] bcache:
update_writeback_rate() c->flags = 8808182c0368
Nov 30 18:00:54 host-126 kernel: [ 1707.922215] bcache:
update_writeback_rate() dc = 88081858
Nov 30 18:00:54 host-126 kernel: [ 1707.92] bcache:
update_writeback_rate() c = 8808182c
Nov 30 18:00:54 host-126 kernel: [ 1707.95] bcache:
update_writeback_rate() dc->disk.flags = 8808185800a0
Nov 30 18:00:54 host-126 kernel: [ 1707.97] bcache:
update_writeback_rate() c->flags = 8808182c0368
Nov 30 18:00:55 host-126 kernel: [ 1708.594202] bcache:
update_writeback_rate() dc = 880839bd
Nov 30 18:00:55 host-126 kernel: [ 1708.594206] bcache:
update_writeback_rate() c = 8808182c
Nov 30 18:00:55 host-126 kernel: [ 1708.594208] bcache:
update_writeback_rate() dc->disk.flags = 880839bd00a0
Nov 30 18:00:55 host-126 kernel: [ 1708.594210] bcache:
update_writeback_rate() c->flags = 8808182c0368
Nov 30 18:00:55 host-126 kernel: [ 1709.118221] sd 0:0:1:0:
device_block, handle(0x0009)
Nov 30 18:00:58 host-126 kernel: [ 1711.368197] sd 0:0:1:0:
device_unblock and setting to running, handle(0x0009)
Nov 30 18:00:58 host-126 kernel: [ 1711.368263] sd 0:0:1:0: [sdb]
tag#0 FAILED Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
Nov 30 18:00:58 host-126 kernel: [ 1711.368277] sd 0:0:1:0: [sdb]
tag#0 CDB: Synchronize Cache(10) 35 00 00 00 00 00 00 00 00 00
Nov 30 18:00:58 host-126 kernel: [ 1711.368289] blk_update_request:
I/O error, dev sdb, sector 36160
Nov 30 18:00:58 host-126 kernel: [ 1711.368326] bcache: error on
96083de4-6b3e-4ede-81d1-44edc1a93729: journal io error, disabling
caching
Nov 30 18:00:58 host-126 kernel: [ 1711.368372] sd 0:0:1:0: [sdb]
tag#1 FAILED Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
Nov 30 18:00:58 host-126 kernel: [ 1711.368387] sd 0:0:1:0: [sdb]
tag#1 CDB: Write(10) 2a 00 00 81 b0 40 00 00 08 00
Nov 30 18:00:58 host-126 kernel: [ 1711.368392] blk_update_request:
I/O error, dev sdb, sector 8499264
Nov 30 18:00:58 host-126 kernel: [ 1711.368407] bcache:
bch_count_io_errors() sdb2: IO error on writing data to cache.
Nov 30 18:00:58 host-126 kernel: [ 1711.368447] bcache:
bch_cached_dev_detach() bch_cached_dev_detach start
Nov 30 18:00:58 host-126 kernel: [ 1711.368458] bcache:
bch_cached_dev_detach() bch_cached_dev_detach end
Nov 30 18:00:58 host-126 kernel: [ 1711.368463] bcache:
conditional_stop_bcache_device() sto

Re: [PATCH] bcache: fix panic due to cache_set is null

2020-11-30 Thread Yi Li
sorry, This patch will cause deadlock, i will check and redo it.

On 11/30/20, Yi Li  wrote:
> bcache_device_detach will release the cache_set after hotunplug cache
> disk. update_writeback_rate should check validate of cache_set.
>
>   IP: [] update_writeback_rate+0x59/0x3a0 [bcache]
>   PGD 879620067 PUD 8755d3067 PMD 0
>   Oops:  [#1] SMP
>   CPU: 8 PID: 1005702 Comm: kworker/8:0 Tainted: G 4.4.0+10 #1
>   Hardware name: Intel BIOS SE5C610.86B.01.01.0021.032120170601 03/21/2017
>   Workqueue: events update_writeback_rate [bcache]
>   task: 8808786f3800 ti: 88077082c000 task.ti: 88077082c000
>   RIP: e030:[] update_writeback_rate+0x59/0x3a0 [bcache]
>   RSP: e02b:88077082fde0  EFLAGS: 00010202
>   RAX: 0018 RBX: 8808047f0b08 RCX: 
>   RDX: 0001 RSI: 88088170dab8 RDI: 88088170dab8
>   RBP: 88077082fe18 R08: 000a R09: 
>   R10:  R11: 00017bc8 R12: 
>   R13: 8808047f R14: 0200 R15: 8808047f0b08
>   FS:  7f157b6d6700() GS:88088170()
> knlGS:
>   CS:  e033 DS:  ES:  CR0: 80050033
>   CR2: 0368 CR3: 000875c05000 CR4: 00040660
>   Stack:
>0001 7ff0 88085ff600c0 880881714e80
>880881719500 0200 8808047f0b08 88077082fe60
>81088c0c 81714e80  880881714e80
>   Call Trace:
>[] process_one_work+0x1fc/0x3b0
>[] worker_thread+0x2a5/0x470
>[] ? __schedule+0x648/0x870
>[] ? rescuer_thread+0x300/0x300
>[] kthread+0xd5/0xe0
>[] ? kthread_stop+0x110/0x110
>[] ret_from_fork+0x3f/0x70
>    [] ? kthread_stop+0x110/0x110
>
> Reported-by: Guo Chao 
> Signed-off-by: Guo Chao 
> Signed-off-by: Yi Li 
> ---
>  drivers/md/bcache/writeback.c | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
> index 3c74996978da..186c4c6e1607 100644
> --- a/drivers/md/bcache/writeback.c
> +++ b/drivers/md/bcache/writeback.c
> @@ -175,7 +175,15 @@ static void update_writeback_rate(struct work_struct
> *work)
>   struct cached_dev *dc = container_of(to_delayed_work(work),
>struct cached_dev,
>writeback_rate_update);
> - struct cache_set *c = dc->disk.c;
> + struct cache_set *c = NULL;
> +
> + mutex_lock(_register_lock);
> + c = dc->disk.c;
> +
> + if (c == NULL) {
> + mutex_unlock(_register_lock);
> + return;
> + }
>
>   /*
>* should check BCACHE_DEV_RATE_DW_RUNNING before calling
> @@ -194,6 +202,7 @@ static void update_writeback_rate(struct work_struct
> *work)
>   clear_bit(BCACHE_DEV_RATE_DW_RUNNING, >disk.flags);
>   /* paired with where BCACHE_DEV_RATE_DW_RUNNING is tested */
>   smp_mb__after_atomic();
> + mutex_unlock(_register_lock);
>   return;
>   }
>
> @@ -230,6 +239,7 @@ static void update_writeback_rate(struct work_struct
> *work)
>   clear_bit(BCACHE_DEV_RATE_DW_RUNNING, >disk.flags);
>   /* paired with where BCACHE_DEV_RATE_DW_RUNNING is tested */
>   smp_mb__after_atomic();
> + mutex_unlock(_register_lock);
>  }
>
>  static unsigned int writeback_delay(struct cached_dev *dc,
> --
> 2.25.3
>
>
>
>


[PATCH] bcache: fix panic due to cache_set is null

2020-11-30 Thread Yi Li
bcache_device_detach will release the cache_set after hotunplug cache
disk. update_writeback_rate should check validate of cache_set.

  IP: [] update_writeback_rate+0x59/0x3a0 [bcache]
  PGD 879620067 PUD 8755d3067 PMD 0
  Oops:  [#1] SMP
  CPU: 8 PID: 1005702 Comm: kworker/8:0 Tainted: G 4.4.0+10 #1
  Hardware name: Intel BIOS SE5C610.86B.01.01.0021.032120170601 03/21/2017
  Workqueue: events update_writeback_rate [bcache]
  task: 8808786f3800 ti: 88077082c000 task.ti: 88077082c000
  RIP: e030:[] update_writeback_rate+0x59/0x3a0 [bcache]
  RSP: e02b:88077082fde0  EFLAGS: 00010202
  RAX: 0018 RBX: 8808047f0b08 RCX: 
  RDX: 0001 RSI: 88088170dab8 RDI: 88088170dab8
  RBP: 88077082fe18 R08: 000a R09: 
  R10:  R11: 00017bc8 R12: 
  R13: 8808047f R14: 0200 R15: 8808047f0b08
  FS:  7f157b6d6700() GS:88088170() knlGS:
  CS:  e033 DS:  ES:  CR0: 80050033
  CR2: 0368 CR3: 000875c05000 CR4: 00040660
  Stack:
   0001 7ff0 88085ff600c0 880881714e80
   880881719500 0200 8808047f0b08 88077082fe60
   81088c0c 81714e80  880881714e80
  Call Trace:
   [] process_one_work+0x1fc/0x3b0
   [] worker_thread+0x2a5/0x470
   [] ? __schedule+0x648/0x870
   [] ? rescuer_thread+0x300/0x300
   [] kthread+0xd5/0xe0
   [] ? kthread_stop+0x110/0x110
   [] ret_from_fork+0x3f/0x70
   [] ? kthread_stop+0x110/0x110

Reported-by: Guo Chao 
Signed-off-by: Guo Chao 
Signed-off-by: Yi Li 
---
 drivers/md/bcache/writeback.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index 3c74996978da..186c4c6e1607 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -175,7 +175,15 @@ static void update_writeback_rate(struct work_struct *work)
struct cached_dev *dc = container_of(to_delayed_work(work),
 struct cached_dev,
 writeback_rate_update);
-   struct cache_set *c = dc->disk.c;
+   struct cache_set *c = NULL;
+
+   mutex_lock(_register_lock);
+   c = dc->disk.c;
+
+   if (c == NULL) {
+   mutex_unlock(_register_lock);
+   return;
+   }
 
/*
 * should check BCACHE_DEV_RATE_DW_RUNNING before calling
@@ -194,6 +202,7 @@ static void update_writeback_rate(struct work_struct *work)
clear_bit(BCACHE_DEV_RATE_DW_RUNNING, >disk.flags);
/* paired with where BCACHE_DEV_RATE_DW_RUNNING is tested */
smp_mb__after_atomic();
+   mutex_unlock(_register_lock);
return;
}
 
@@ -230,6 +239,7 @@ static void update_writeback_rate(struct work_struct *work)
clear_bit(BCACHE_DEV_RATE_DW_RUNNING, >disk.flags);
/* paired with where BCACHE_DEV_RATE_DW_RUNNING is tested */
smp_mb__after_atomic();
+   mutex_unlock(_register_lock);
 }
 
 static unsigned int writeback_delay(struct cached_dev *dc,
-- 
2.25.3





[PATCH v3] net: core: Use skb_is_gso() in skb_checksum_help()

2020-10-27 Thread Yi Li
No functional changes, just minor refactoring.

Signed-off-by: Yi Li 
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 82dc6b48e45f..9e7f071b846c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3206,7 +3206,7 @@ int skb_checksum_help(struct sk_buff *skb)
if (skb->ip_summed == CHECKSUM_COMPLETE)
goto out_set_summed;
 
-   if (unlikely(skb_shinfo(skb)->gso_size)) {
+   if (unlikely(skb_is_gso(skb))) {
skb_warn_bad_offload(skb);
return -EINVAL;
}
-- 
2.25.3





[PATCH v2] net/core/dev.c : Use skb_is_gso

2020-10-25 Thread Yi Li
Trivial fix to use func skb_is_gso in place of
test for skb_shinfo(skb)->gso_size.

Signed-off-by: Yi Li 
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 9499a414d67e..55f66e108059 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3205,7 +3205,7 @@ int skb_checksum_help(struct sk_buff *skb)
if (skb->ip_summed == CHECKSUM_COMPLETE)
goto out_set_summed;
 
-   if (unlikely(skb_shinfo(skb)->gso_size)) {
+   if (unlikely(skb_is_gso(skb))) {
skb_warn_bad_offload(skb);
return -EINVAL;
}
-- 
2.25.3





[PATCH] net treewide: Use skb_is_gso

2020-10-21 Thread Yi Li
This patch introduces the use of the inline func skb_is_gso in place of
tests for skb_shinfo(skb)->gso_size.

- if (skb_shinfo(skb)->gso_size)
+ if (skb_is_gso(skb))

- if (unlikely(skb_shinfo(skb)->gso_size))
+ if (unlikely(skb_is_gso(skb)))

- if (!skb_shinfo(skb)->gso_size)
+ if (!skb_is_gso(skb))

Signed-off-by: Yi Li 
---
 drivers/net/ethernet/atheros/atlx/atl1.c   | 2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c| 2 +-
 drivers/net/ethernet/cavium/liquidio/lio_main.c| 2 +-
 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 2 +-
 drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 +-
 drivers/net/ethernet/chelsio/cxgb/sge.c| 2 +-
 drivers/net/ethernet/chelsio/cxgb3/sge.c   | 4 ++--
 drivers/net/ethernet/chelsio/cxgb4/sge.c   | 8 
 drivers/net/ethernet/chelsio/cxgb4vf/sge.c | 2 +-
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c| 2 +-
 drivers/net/ethernet/ibm/ibmveth.c | 2 +-
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 4 ++--
 drivers/net/ethernet/qlogic/qede/qede_fp.c | 2 +-
 drivers/net/ethernet/tehuti/tehuti.c   | 2 +-
 drivers/net/usb/r8152.c| 2 +-
 drivers/net/xen-netfront.c | 2 +-
 net/core/dev.c | 2 +-
 net/mac80211/tx.c  | 2 +-
 18 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c 
b/drivers/net/ethernet/atheros/atlx/atl1.c
index eaf96d002fa5..dc08cb38d4f8 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
@@ -2101,7 +2101,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct 
sk_buff *skb,
u8 hdr_len, ip_off;
u32 real_len;
 
-   if (skb_shinfo(skb)->gso_size) {
+   if (skb_is_gso(skb)) {
int err;
 
err = skb_cow_head(skb, 0);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 1a6ec1a12d53..af20884cd772 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -732,7 +732,7 @@ static void bnx2x_gro_receive(struct bnx2x *bp, struct 
bnx2x_fastpath *fp,
   struct sk_buff *skb)
 {
 #ifdef CONFIG_INET
-   if (skb_shinfo(skb)->gso_size) {
+   if (skb_is_gso(skb)) {
switch (be16_to_cpu(skb->protocol)) {
case ETH_P_IP:
bnx2x_gro_csum(bp, skb, bnx2x_gro_ip_csum);
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c 
b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 7d00d3a8ded4..87f79f95a1bc 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -2476,7 +2476,7 @@ static netdev_tx_t liquidio_xmit(struct sk_buff *skb, 
struct net_device *netdev)
tx_info = (union tx_info *)[0];
}
 
-   if (skb_shinfo(skb)->gso_size) {
+   if (skb_is_gso(skb)) {
tx_info->s.gso_size = skb_shinfo(skb)->gso_size;
tx_info->s.gso_segs = skb_shinfo(skb)->gso_segs;
stats->tx_gso++;
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c 
b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
index 103440f97bc8..39cbb3c9a2c7 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
@@ -1571,7 +1571,7 @@ static netdev_tx_t liquidio_xmit(struct sk_buff *skb, 
struct net_device *netdev)
irh = (struct octeon_instr_irh *)
tx_info = (union tx_info *)[0];
 
-   if (skb_shinfo(skb)->gso_size) {
+   if (skb_is_gso(skb)) {
tx_info->s.gso_size = skb_shinfo(skb)->gso_size;
tx_info->s.gso_segs = skb_shinfo(skb)->gso_segs;
}
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c 
b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index 7a141ce32e86..ee0701bfd9ca 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -1395,7 +1395,7 @@ nicvf_sq_add_hdr_subdesc(struct nicvf *nic, struct 
snd_queue *sq, int qentry,
}
 
/* Tx timestamping not supported along with TSO, so ignore request */
-   if (skb_shinfo(skb)->gso_size)
+   if (skb_is_gso(skb))
return;
 
/* HW supports only a single outstanding packet to timestamp */
diff --git a/drivers/net/ethernet/chelsio/cxgb/sge.c 
b/drivers/net/ethernet/chelsio/cxgb/sge.c
index 2d9c2b5a690a..49d5fe0a97cb 100644
--- a/drivers/net/ethernet/chelsio/cxgb/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb/sge.c
@@ -1799,7 +1799,7 @@ netdev_tx_t t

[PATCH] kvm/eventfd:do wildcard calculation before list_for_each_entry_safe

2020-09-10 Thread Yi Li
There is no need to calculate wildcard in each loop
since wildcard is not changed.

Signed-off-by: Yi Li 
---
 virt/kvm/eventfd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index d6408bb497dc..c2323c27a28b 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -853,15 +853,17 @@ kvm_deassign_ioeventfd_idx(struct kvm *kvm, enum kvm_bus 
bus_idx,
struct eventfd_ctx   *eventfd;
struct kvm_io_bus*bus;
int   ret = -ENOENT;
+   bool  wildcard;
 
eventfd = eventfd_ctx_fdget(args->fd);
if (IS_ERR(eventfd))
return PTR_ERR(eventfd);
 
+   wildcard = !(args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH);
+
mutex_lock(>slots_lock);
 
list_for_each_entry_safe(p, tmp, >ioeventfds, list) {
-   bool wildcard = !(args->flags & KVM_IOEVENTFD_FLAG_DATAMATCH);
 
if (p->bus_idx != bus_idx ||
p->eventfd != eventfd  ||
-- 
2.25.3





[PATCH] Remove duplicate include file

2020-09-09 Thread Yi Li
Remove duplicate include file

Signed-off-by: Yi Li 
---
 arch/arm/mm/mmu.c | 1 -
 mm/slab.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index c36f977b2ccb..7bbcdb29413e 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -34,7 +34,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "fault.h"
 #include "mm.h"
diff --git a/mm/slab.h b/mm/slab.h
index 6cc323f1313a..95e5cc1bb2a3 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -46,7 +46,6 @@ struct kmem_cache {
 #include 
 #include 
 #include 
-#include 
 
 /*
  * State of the slab allocator.
-- 
2.25.3





Re: [PATCH] bnx2x: correct a mistake when show error code

2020-08-29 Thread Yi Li
It is useless.
The original code just tell some error info. and don't  show errorcode

On 8/29/20, Yi Li  wrote:
> use rc for error code.
>
> Signed-off-by: Yi Li 
> ---
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
> b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
> index 1426c691c7c4..0346771396ce 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
> @@ -13562,9 +13560,8 @@ static int bnx2x_ext_phy_common_init(struct bnx2x
> *bp, u32 shmem_base_path[],
>   }
>
>   if (rc)
> - netdev_err(bp->dev,  "Warning: PHY was not initialized,"
> -   " Port %d\n",
> -  0);
> + netdev_err(bp->dev, "Warning: PHY was not initialized, Port 
> %d\n",
> +rc);
>   return rc;
>  }
>
> --
> 2.25.3
>
>
>
>


[PATCH] bnx2x: correct a mistake when show error code

2020-08-29 Thread Yi Li
use rc for error code.

Signed-off-by: Yi Li 
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 1426c691c7c4..0346771396ce 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -13562,9 +13560,8 @@ static int bnx2x_ext_phy_common_init(struct bnx2x *bp, 
u32 shmem_base_path[],
}
 
if (rc)
-   netdev_err(bp->dev,  "Warning: PHY was not initialized,"
- " Port %d\n",
-0);
+   netdev_err(bp->dev, "Warning: PHY was not initialized, Port 
%d\n",
+  rc);
return rc;
 }
 
-- 
2.25.3





[PATCH] net: hns3: Fix for geneve tx checksum bug

2020-08-25 Thread Yi Li
when skb->encapsulation is 0, skb->ip_summed is CHECKSUM_PARTIAL
and it is udp packet, which has a dest port as the IANA assigned.
the hardware is expected to do the checksum offload, but the
hardware will not do the checksum offload when udp dest port is
6081.

This patch fixes it by doing the checksum in software.

Reported-by: Li Bing 
Signed-off-by: Yi Li 
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c 
b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 87776ce3539b..7d83c45369c2 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "hnae3.h"
 #include "hns3_enet.h"
@@ -780,7 +781,7 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, u8 
*ol4_proto,
  * and it is udp packet, which has a dest port as the IANA assigned.
  * the hardware is expected to do the checksum offload, but the
  * hardware will not do the checksum offload when udp dest port is
- * 4789.
+ * 4789 or 6081.
  */
 static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
 {
@@ -789,7 +790,8 @@ static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
l4.hdr = skb_transport_header(skb);
 
if (!(!skb->encapsulation &&
- l4.udp->dest == htons(IANA_VXLAN_UDP_PORT)))
+ (l4.udp->dest == htons(IANA_VXLAN_UDP_PORT) ||
+ l4.udp->dest == htons(GENEVE_UDP_PORT
return false;
 
skb_checksum_help(skb);
-- 
2.25.3





[PATCH] perf tools: Use of the macro IS_ERR_OR_NULL

2019-10-21 Thread Yi Li
From: Yi Li 

This patch introduces the use of the macro IS_ERR_OR_NULL in place of
tests for NULL and IS_ERR.

The following Coccinelle semantic patch was used for making the change:

@@
expression e;
@@

- !e || IS_ERR(e)
+ IS_ERR_OR_NULL(e)
 || ...

Signed-off-by: Yi Li 
---
 tools/perf/util/bpf-loader.c   | 13 +++--
 tools/perf/util/parse-events.c |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 10c187b..b14d224 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -426,7 +426,7 @@ preproc_gen_prologue(struct bpf_program *prog, int n,
size_t prologue_cnt = 0;
int i, err;
 
-   if (IS_ERR(priv) || !priv || priv->is_tp)
+   if (IS_ERR_OR_NULL(priv) || priv->is_tp)
goto errout;
 
pev = >pev;
@@ -578,7 +578,7 @@ static int hook_load_preprocessor(struct bpf_program *prog)
bool need_prologue = false;
int err, i;
 
-   if (IS_ERR(priv) || !priv) {
+   if (IS_ERR_OR_NULL(priv)) {
pr_debug("Internal error when hook preprocessor\n");
return -BPF_LOADER_ERRNO__INTERNAL;
}
@@ -650,8 +650,9 @@ int bpf__probe(struct bpf_object *obj)
goto out;
 
priv = bpf_program__priv(prog);
-   if (IS_ERR(priv) || !priv) {
-   err = PTR_ERR(priv);
+   if (IS_ERR_OR_NULL(priv)) {
+   pr_debug("bpf: failed to get private field\n");
+   err = -BPF_LOADER_ERRNO__INTERNAL;
goto out;
}
 
@@ -701,7 +702,7 @@ int bpf__unprobe(struct bpf_object *obj)
struct bpf_prog_priv *priv = bpf_program__priv(prog);
int i;
 
-   if (IS_ERR(priv) || !priv || priv->is_tp)
+   if (IS_ERR_OR_NULL(priv) || priv->is_tp)
continue;
 
for (i = 0; i < priv->pev.ntevs; i++) {
@@ -759,7 +760,7 @@ int bpf__foreach_event(struct bpf_object *obj,
struct perf_probe_event *pev;
int i, fd;
 
-   if (IS_ERR(priv) || !priv) {
+   if (IS_ERR_OR_NULL(priv)) {
pr_debug("bpf: failed to get private field\n");
return -BPF_LOADER_ERRNO__INTERNAL;
}
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index b5e2ade..609c31f 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -690,7 +690,7 @@ int parse_events_load_bpf_obj(struct parse_events_state 
*parse_state,
struct __add_bpf_event_param param = {parse_state, list, head_config};
static bool registered_unprobe_atexit = false;
 
-   if (IS_ERR(obj) || !obj) {
+   if (IS_ERR_OR_NULL(obj)) {
snprintf(errbuf, sizeof(errbuf),
 "Internal error: load bpf obj with NULL");
err = -EINVAL;
-- 
2.7.5





[PATCH v2] ocfs2: fix panic due to ocfs2_wq is null

2019-10-15 Thread Yi Li
From: Yi Li 

mount.ocfs2 failed when read ocfs2 filesystem super error.
the func ocfs2_initialize_super will return before allocate ocfs2_wq.
ocfs2_dismount_volume will triggered the following panic.

  Oct 15 16:09:27 cnwarekv-205120 kernel: On-disk corruption
discovered.Please run fsck.ocfs2 once the filesystem is unmounted.
  Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44):
ocfs2_read_locked_inode:537 ERROR: status = -30
  Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44):
ocfs2_init_global_system_inodes:458 ERROR: status = -30
  Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44):
ocfs2_init_global_system_inodes:491 ERROR: status = -30
  Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44):
ocfs2_initialize_super:2313 ERROR: status = -30
  Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44):
ocfs2_fill_super:1033 ERROR: status = -30
  [ cut here ]
  Oops: 0002 [#1] SMP NOPTI
  Modules linked in: ocfs2 rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs fscache
lockd grace ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager
ocfs2_stackglue configfs sunrpc ipt_REJECT nf_reject_ipv4
nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT
nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
ip6table_filter ip6_tables ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad
rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr ipv6 ovmapi ppdev
parport_pc parport fb_sys_fops sysimgblt sysfillrect syscopyarea
acpi_cpufreq pcspkr i2c_piix4 i2c_core sg ext4 jbd2 mbcache2 sr_mod cdrom
  CPU: 1 PID: 11753 Comm: mount.ocfs2 Tainted: G  E
4.14.148-200.ckv.x86_64 #1
  Hardware name: Sugon H320-G30/35N16-US, BIOS 0SSDX017 12/21/2018
  task: 967af052 task.stack: a5f05484000
  RIP: 0010:mutex_lock+0x19/0x20
  Call Trace:
flush_workqueue+0x81/0x460
ocfs2_shutdown_local_alloc+0x47/0x440 [ocfs2]
ocfs2_dismount_volume+0x84/0x400 [ocfs2]
ocfs2_fill_super+0xa4/0x1270 [ocfs2]
? ocfs2_initialize_super.isa.211+0xf20/0xf20 [ocfs2]
mount_bdev+0x17f/0x1c0
mount_fs+0x3a/0x160

Signed-off-by: Yi Li 
---
 fs/ocfs2/journal.c| 3 ++-
 fs/ocfs2/localalloc.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 930e3d3..699a560 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -217,7 +217,8 @@ void ocfs2_recovery_exit(struct ocfs2_super *osb)
/* At this point, we know that no more recovery threads can be
 * launched, so wait for any recovery completion work to
 * complete. */
-   flush_workqueue(osb->ocfs2_wq);
+   if (osb->ocfs2_wq)
+   flush_workqueue(osb->ocfs2_wq);
 
/*
 * Now that recovery is shut down, and the osb is about to be
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 158e5af..720e9f9 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -377,7 +377,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
struct ocfs2_dinode *alloc = NULL;
 
cancel_delayed_work(>la_enable_wq);
-   flush_workqueue(osb->ocfs2_wq);
+   if (osb->ocfs2_wq)
+   flush_workqueue(osb->ocfs2_wq);
 
if (osb->local_alloc_state == OCFS2_LA_UNUSED)
goto out;
-- 
2.7.5





[PATCH v2] ocfs2: fix panic due to ocfs2_wq is null

2019-10-15 Thread Yi Li
From: Yi Li 

mount.ocfs2 failed when read ocfs2 filesystem super error.
the func ocfs2_initialize_super will return before allocate ocfs2_wq.
ocfs2_dismount_volume will triggered the following panic.

  Oct 15 16:09:27 cnwarekv-205120 kernel: On-disk corruption
discovered.Please run fsck.ocfs2 once the filesystem is unmounted.
  Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44):
ocfs2_read_locked_inode:537 ERROR: status = -30
  Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44):
ocfs2_init_global_system_inodes:458 ERROR: status = -30
  Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44):
ocfs2_init_global_system_inodes:491 ERROR: status = -30
  Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44):
ocfs2_initialize_super:2313 ERROR: status = -30
  Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44):
ocfs2_fill_super:1033 ERROR: status = -30
  [ cut here ]
  Oops: 0002 [#1] SMP NOPTI
  Modules linked in: ocfs2 rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs fscache
lockd grace ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager
ocfs2_stackglue configfs sunrpc ipt_REJECT nf_reject_ipv4
nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT
nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
ip6table_filter ip6_tables ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad
rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr ipv6 ovmapi ppdev
parport_pc parport fb_sys_fops sysimgblt sysfillrect syscopyarea
acpi_cpufreq pcspkr i2c_piix4 i2c_core sg ext4 jbd2 mbcache2 sr_mod cdrom
  CPU: 1 PID: 11753 Comm: mount.ocfs2 Tainted: G  E
4.14.148-200.ckv.x86_64 #1
  Hardware name: Sugon H320-G30/35N16-US, BIOS 0SSDX017 12/21/2018
  task: 967af052 task.stack: a5f05484000
  RIP: 0010:mutex_lock+0x19/0x20
  Call Trace:
flush_workqueue+0x81/0x460
ocfs2_shutdown_local_alloc+0x47/0x440 [ocfs2]
ocfs2_dismount_volume+0x84/0x400 [ocfs2]
ocfs2_fill_super+0xa4/0x1270 [ocfs2]
? ocfs2_initialize_super.isa.211+0xf20/0xf20 [ocfs2]
mount_bdev+0x17f/0x1c0
mount_fs+0x3a/0x160

Signed-off-by: Yi Li 
---
 fs/ocfs2/journal.c| 3 ++-
 fs/ocfs2/localalloc.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 930e3d3..699a560 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -217,7 +217,8 @@ void ocfs2_recovery_exit(struct ocfs2_super *osb)
/* At this point, we know that no more recovery threads can be
 * launched, so wait for any recovery completion work to
 * complete. */
-   flush_workqueue(osb->ocfs2_wq);
+   if (osb->ocfs2_wq)
+   flush_workqueue(osb->ocfs2_wq);
 
/*
 * Now that recovery is shut down, and the osb is about to be
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 158e5af..720e9f9 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -377,7 +377,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
struct ocfs2_dinode *alloc = NULL;
 
cancel_delayed_work(>la_enable_wq);
-   flush_workqueue(osb->ocfs2_wq);
+   if (osb->ocfs2_wq)
+   flush_workqueue(osb->ocfs2_wq);
 
if (osb->local_alloc_state == OCFS2_LA_UNUSED)
goto out;
-- 
2.7.5





[PATCH] ocfs2: fix panic due to ocfs2_wq is null

2019-10-15 Thread Yi Li
mount.ocfs2 failed when read ocfs2 filesystem super error.
the func ocfs2_initialize_super will return before allocate ocfs2_wq.
ocfs2_dismount_volume will flush the ocfs2_wq, that triggered the following 
panic.

Oct 15 16:09:27 cnwarekv-205120 kernel: OCFS2: ERROR (device dm-34): 
ocfs2_validate_inode_block: Invalid dinode #513: fs_generation is 1837764116
Oct 15 16:09:27 cnwarekv-205120 kernel: On-disk corruption discovered. Please 
run fsck.ocfs2 once the filesystem is unmounted.
Oct 15 16:09:27 cnwarekv-205120 kernel: OCFS2: File system is now read-only.
Oct 15 16:09:27 cnwarekv-205120 kernel: 
(mount.ocfs2,22804,44):ocfs2_read_locked_inode:537 ERROR: status = -30
Oct 15 16:09:27 cnwarekv-205120 kernel: 
(mount.ocfs2,22804,44):ocfs2_init_global_system_inodes:458 ERROR: status = -30
Oct 15 16:09:27 cnwarekv-205120 kernel: 
(mount.ocfs2,22804,44):ocfs2_init_global_system_inodes:491 ERROR: status = -30
Oct 15 16:09:27 cnwarekv-205120 kernel: 
(mount.ocfs2,22804,44):ocfs2_initialize_super:2313 ERROR: status = -30
Oct 15 16:09:27 cnwarekv-205120 kernel: 
(mount.ocfs2,22804,44):ocfs2_fill_super:1033 ERROR: status = -30
[ cut here ]
Oops: 0002 [#1] SMP NOPTI
Modules linked in: ocfs2 rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs fscache lockd 
grace ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager ocfs2_stackglue 
configfs sunrpc ipt_REJECT nf_reject_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 
iptable_filter ip_tables ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 
nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ib_ipoib 
rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core 
ib_addr ipv6 ovmapi ppdev parport_pc parport xen_netfront fb_sys_fops sysimgblt 
sysfillrect syscopyarea acpi_cpufreq pcspkr i2c_piix4 i2c_core sg ext4 jbd2 
mbcache2 sr_mod cdrom xen_blkfront pata_acpi ata_generic ata_piix floppy 
dm_mirror dm_region_hash dm_log dm_mod
CPU: 1 PID: 11753 Comm: mount.ocfs2 Tainted: G  E   4.14.148-200.ckv.x86_64 
#1
Hardware name: Sugon H320-G30/35N16-US, BIOS 0SSDX017 12/21/2018
task: 967af052 task.stack: a5f05484000
RIP: 0010:mutex_lock+0x19/0x20
Call Trace:
  flush_workqueue+0x81/0x460
  ocfs2_shutdown_local_alloc+0x47/0x440 [ocfs2]
  ocfs2_dismount_volume+0x84/0x400 [ocfs2]
  ocfs2_fill_super+0xa4/0x1270 [ocfs2]
  ? ocfs2_initialize_super.isa.211+0xf20/0xf20 [ocfs2]
  mount_bdev+0x17f/0x1c0
  mount_fs+0x3a/0x160

Signed-off-by: Yi Li 
---
 fs/ocfs2/localalloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 158e5af..943e5c3 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -377,7 +377,9 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
struct ocfs2_dinode *alloc = NULL;
 
cancel_delayed_work(>la_enable_wq);
-   flush_workqueue(osb->ocfs2_wq);
+   if (osb->ocfs2_wq) {
+   flush_workqueue(osb->ocfs2_wq);
+   }
 
if (osb->local_alloc_state == OCFS2_LA_UNUSED)
goto out;
-- 
2.7.5





Re: [PATCH v3] fpga manager: Add Altera CvP driver

2017-04-25 Thread Yi Li

hi Anatolij


On 04/21/2017 04:14 PM, Li, Yi wrote:


On 4/20/2017 12:29 PM, matthew.gerl...@linux.intel.com wrote:



On Thu, 20 Apr 2017, Anatolij Gustschin wrote:


Add FPGA manager driver for loading Arria/Cyclone/Stratix
FPGAs via CvP.

Signed-off-by: Anatolij Gustschin 
---


Hi Anatolij,

Since you say the driver works with Arria-10, I thought I would give 
it a try with the Altera Arria10 PCIe DevKit I am using.  I successfully
compiled your patch as an out of tree module against a 3.10 kernel.  
The module successfully loaded and created instances for both boards 
in the host.
Now that I have the driver instances running, I'm not sure howto 
actually perform CvP.  Do you use a debugfs interface or something 
else?  Do you use the sof or an rbf file?


Thanks,
Matthew Gerlach


Changes in v3:

 - removed V-series from description (since the driver works
   also with Arria-10). Also renamed functions, config option
   and driver file name. Changed module description in Kconfig
From the User guild 
https://www.altera.com/documentation/dsu1441819344145.html#dsu1442261652730, 
it says Configuration via Protocol (CvP) is a configuration scheme 
supported inArria^® V,Cyclone^® V,Stratix^® V, andArria^® 10device 
families. But I have seen different CvP registers bitmask defines 
somewhere else, so I am not positive that there is only one CvP 
protocol for all Altera FPGAs. Maybe we could put those Vs + Arria 10 
as supported devices on the Kconfig file on the safe side?


Reviewed the rest of the driver and it looks good to me.




...

diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index 161ba9d..be48c2e 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -26,6 +26,13 @@ config FPGA_MGR_ICE40_SPI
help
  FPGA manager driver support for Lattice iCE40 FPGAs over SPI.

+config FPGA_MGR_ALTERA_CVP
+tristate "Altera Arria/Cyclone/Stratix CvP FPGA Manager"
+depends on PCI
+help
+  FPGA manager driver support for Altera FPGAs using the
+  CvP interface over PCIe.
+
config FPGA_MGR_SOCFPGA
tristate "Altera SOCFPGA FPGA Manager"
depends on ARCH_SOCFPGA || COMPILE_TEST
diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
index 2a4f021..2e5c8b6 100644
--- a/drivers/fpga/Makefile
+++ b/drivers/fpga/Makefile
@@ -6,6 +6,7 @@
obj-$(CONFIG_FPGA)+= fpga-mgr.o

...




Re: [PATCH v3] fpga manager: Add Altera CvP driver

2017-04-25 Thread Yi Li

hi Anatolij


On 04/21/2017 04:14 PM, Li, Yi wrote:


On 4/20/2017 12:29 PM, matthew.gerl...@linux.intel.com wrote:



On Thu, 20 Apr 2017, Anatolij Gustschin wrote:


Add FPGA manager driver for loading Arria/Cyclone/Stratix
FPGAs via CvP.

Signed-off-by: Anatolij Gustschin 
---


Hi Anatolij,

Since you say the driver works with Arria-10, I thought I would give 
it a try with the Altera Arria10 PCIe DevKit I am using.  I successfully
compiled your patch as an out of tree module against a 3.10 kernel.  
The module successfully loaded and created instances for both boards 
in the host.
Now that I have the driver instances running, I'm not sure howto 
actually perform CvP.  Do you use a debugfs interface or something 
else?  Do you use the sof or an rbf file?


Thanks,
Matthew Gerlach


Changes in v3:

 - removed V-series from description (since the driver works
   also with Arria-10). Also renamed functions, config option
   and driver file name. Changed module description in Kconfig
From the User guild 
https://www.altera.com/documentation/dsu1441819344145.html#dsu1442261652730, 
it says Configuration via Protocol (CvP) is a configuration scheme 
supported inArria^® V,Cyclone^® V,Stratix^® V, andArria^® 10device 
families. But I have seen different CvP registers bitmask defines 
somewhere else, so I am not positive that there is only one CvP 
protocol for all Altera FPGAs. Maybe we could put those Vs + Arria 10 
as supported devices on the Kconfig file on the safe side?


Reviewed the rest of the driver and it looks good to me.




...

diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index 161ba9d..be48c2e 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -26,6 +26,13 @@ config FPGA_MGR_ICE40_SPI
help
  FPGA manager driver support for Lattice iCE40 FPGAs over SPI.

+config FPGA_MGR_ALTERA_CVP
+tristate "Altera Arria/Cyclone/Stratix CvP FPGA Manager"
+depends on PCI
+help
+  FPGA manager driver support for Altera FPGAs using the
+  CvP interface over PCIe.
+
config FPGA_MGR_SOCFPGA
tristate "Altera SOCFPGA FPGA Manager"
depends on ARCH_SOCFPGA || COMPILE_TEST
diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
index 2a4f021..2e5c8b6 100644
--- a/drivers/fpga/Makefile
+++ b/drivers/fpga/Makefile
@@ -6,6 +6,7 @@
obj-$(CONFIG_FPGA)+= fpga-mgr.o

...




[PATCH] xen: fix mcelog/stub depend issue in Kconfig

2015-02-13 Thread Yi Li

From: Yi Li 

Fix support mcelog/stub in Kconfig for Xen X86 platform

Signed-off-by: Yi Li 
---
 drivers/xen/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index b812462..83ae68a 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -188,7 +188,7 @@ config XEN_PRIVCMD
 
 config XEN_STUB
bool "Xen stub drivers"
-   depends on XEN && X86_64 && BROKEN
+   depends on XEN && X86 && BROKEN
default n
help
  Allow kernel to install stub drivers, to reserve space for Xen 
drivers,
@@ -240,7 +240,7 @@ config XEN_ACPI_PROCESSOR
 
 config XEN_MCE_LOG
bool "Xen platform mcelog"
-   depends on XEN_DOM0 && X86_64 && X86_MCE
+   depends on XEN_DOM0 && X86 && X86_MCE
default n
help
  Allow kernel fetching MCE error from Xen platform and
-- 
1.7.12.4


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


[PATCH] xen: fix mcelog/stub depend issue in Kconfig

2015-02-13 Thread Yi Li

From: Yi Li yiliker...@gmail.com

Fix support mcelog/stub in Kconfig for Xen X86 platform

Signed-off-by: Yi Li yiliker...@gmail.com
---
 drivers/xen/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index b812462..83ae68a 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -188,7 +188,7 @@ config XEN_PRIVCMD
 
 config XEN_STUB
bool Xen stub drivers
-   depends on XEN  X86_64  BROKEN
+   depends on XEN  X86  BROKEN
default n
help
  Allow kernel to install stub drivers, to reserve space for Xen 
drivers,
@@ -240,7 +240,7 @@ config XEN_ACPI_PROCESSOR
 
 config XEN_MCE_LOG
bool Xen platform mcelog
-   depends on XEN_DOM0  X86_64  X86_MCE
+   depends on XEN_DOM0  X86  X86_MCE
default n
help
  Allow kernel fetching MCE error from Xen platform and
-- 
1.7.12.4


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


[PATCH v2] arm64: dmi: Add SMBIOS/DMI support on arm64

2014-06-08 Thread Yi Li
Add smbios/dmi support on arm64 system, it depends on EFI boot.

Since SMBIOS is very important specification for the hardware vendors
, it describes the hardware informations like BIOS version, 
serial number, physical layout of the ports and so on. All x86 and IA64
servers has supported this specfication. If ARM64 hopes to enter server
market, then SMBIOS needs to support on ARM64, and it has been included
as one important section in SBBR document from ARM.

This has been tested by dmidecode and lshw tools.

Signed-off-by: Yi Li 
---

Changes since v1:
  -Followed Ard Biesheuvel's suggestion to rebase the patch on
   Matt Fleming's arm64-efi branch.

  -Followed Mark Rutland's suggesiton to change the include header.
  
  -Followed Grant likely's suggestion to enrich the SMBIOS background
   and the reason why we need to enable the SMBIOS on ARM64 platform.

 arch/arm64/Kconfig   |   10 ++
 arch/arm64/include/asm/dmi.h |   28 
 arch/arm64/kernel/setup.c|2 ++
 3 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/include/asm/dmi.h

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 6c71f12..13ee261 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -294,6 +294,16 @@ config EFI
  allow the kernel to be booted as an EFI application. This
  is only useful on systems that have UEFI firmware.
 
+config DMI
+   bool "Enable support for SMBIOS (DMI) tables"
+   depends on EFI
+   default y
+   help
+ This enables SMBIOS/DMI feature for systems.
+
+ This option is only useful on systems that have UEFI firmware.
+ However, even with this option, the resultant kernel should
+ continue to boot on existing non-UEFI platforms.
 endmenu
 
 menu "Userspace binary formats"
diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h
new file mode 100644
index 000..a0b3dac
--- /dev/null
+++ b/arch/arm64/include/asm/dmi.h
@@ -0,0 +1,28 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi...@linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include 
+#include 
+
+/* Use efi mappings for DMI */
+#define dmi_early_remap(x, l)  efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)   kzalloc(l, GFP_ATOMIC)
+
+#endif
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 0a14aaf..7622561 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -400,6 +401,7 @@ static int __init arm64_device_init(void)
 {
of_clk_init(NULL);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+   dmi_scan_machine();
return 0;
 }
 arch_initcall(arm64_device_init);
-- 
1.7.9.5

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


[PATCH v2] arm64: dmi: Add SMBIOS/DMI support on arm64

2014-06-08 Thread Yi Li
Add smbios/dmi support on arm64 system, it depends on EFI boot.

Since SMBIOS is very important specification for the hardware vendors
, it describes the hardware informations like BIOS version, 
serial number, physical layout of the ports and so on. All x86 and IA64
servers has supported this specfication. If ARM64 hopes to enter server
market, then SMBIOS needs to support on ARM64, and it has been included
as one important section in SBBR document from ARM.

This has been tested by dmidecode and lshw tools.

Signed-off-by: Yi Li yi...@linaro.org
---

Changes since v1:
  -Followed Ard Biesheuvel's suggestion to rebase the patch on
   Matt Fleming's arm64-efi branch.

  -Followed Mark Rutland's suggesiton to change the include header.
  
  -Followed Grant likely's suggestion to enrich the SMBIOS background
   and the reason why we need to enable the SMBIOS on ARM64 platform.

 arch/arm64/Kconfig   |   10 ++
 arch/arm64/include/asm/dmi.h |   28 
 arch/arm64/kernel/setup.c|2 ++
 3 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/include/asm/dmi.h

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 6c71f12..13ee261 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -294,6 +294,16 @@ config EFI
  allow the kernel to be booted as an EFI application. This
  is only useful on systems that have UEFI firmware.
 
+config DMI
+   bool Enable support for SMBIOS (DMI) tables
+   depends on EFI
+   default y
+   help
+ This enables SMBIOS/DMI feature for systems.
+
+ This option is only useful on systems that have UEFI firmware.
+ However, even with this option, the resultant kernel should
+ continue to boot on existing non-UEFI platforms.
 endmenu
 
 menu Userspace binary formats
diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h
new file mode 100644
index 000..a0b3dac
--- /dev/null
+++ b/arch/arm64/include/asm/dmi.h
@@ -0,0 +1,28 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi...@linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include linux/slab.h
+#include linux/efi.h
+
+/* Use efi mappings for DMI */
+#define dmi_early_remap(x, l)  efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)   kzalloc(l, GFP_ATOMIC)
+
+#endif
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 0a14aaf..7622561 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -42,6 +42,7 @@
 #include linux/of_fdt.h
 #include linux/of_platform.h
 #include linux/efi.h
+#include linux/dmi.h
 
 #include asm/fixmap.h
 #include asm/cputype.h
@@ -400,6 +401,7 @@ static int __init arm64_device_init(void)
 {
of_clk_init(NULL);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+   dmi_scan_machine();
return 0;
 }
 arch_initcall(arm64_device_init);
-- 
1.7.9.5

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


Re: [PATCH] ARM64:DMI: Add smbios/dmi support on arm64

2014-06-04 Thread Yi Li

Hi Mark,

Please see the comments below:

On Wednesday, June 04, 2014 09:32 PM, Mark Rutland wrote:

On Tue, Jun 03, 2014 at 04:57:13PM +0100, Yi Li wrote:

Add smbios/dmi support on arm64 system, it depends on
EFI boot.

And what exactly does this provide us with?

What is exposed through SMBIOS/DMI, and why would I want to enable it?
Yi: SMBIOS/DMI is one basic spec/feature for server product(like x86 and 
IA64).

 Many OEMs/ODMs hope to use ARM64 as server's processor.
 So we need to support SMBIOS on ARM64.

SMBIOS mainly describes some hardware and software information for 
the system, like BIOS information
CPU information,  Memory information ,and so on. please refer to 
http://www.dmtf.org/standards/smbios





Signed-off-by: Yi Li 
---

Changes since v1:
   -Followed Ard Biesheuvel's suggestion to rebase the patch on
Matt Fleming's arm64-efi branch.

  arch/arm64/Kconfig   |   10 ++
  arch/arm64/include/asm/dmi.h |   28 
  arch/arm64/kernel/setup.c|2 ++
  3 files changed, 40 insertions(+)
  create mode 100644 arch/arm64/include/asm/dmi.h

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 6c71f12..13ee261 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -294,6 +294,16 @@ config EFI
  allow the kernel to be booted as an EFI application. This
  is only useful on systems that have UEFI firmware.
  
+config DMI

+   bool "Enable support for SMBIOS (DMI) tables"
+   depends on EFI
+   default y
+   help
+ This enables SMBIOS/DMI feature for systems.
+
+ This option is only useful on systems that have UEFI firmware.
+ However, even with this option, the resultant kernel should
+ continue to boot on existing non-UEFI platforms.
  endmenu
  
  menu "Userspace binary formats"

diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h
new file mode 100644
index 000..f2198bf
--- /dev/null
+++ b/arch/arm64/include/asm/dmi.h
@@ -0,0 +1,28 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi...@linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include 
+#include 

Shouldn't that be linux/efi.h?

Why do we need asm/io.h?

Yi: porting it from IA64 , so the io.h is not needed exactly!
 but slab.h is must included ,not efi.h (tested by compiling)

+
+/* Use efi mappings for DMI */
+#define dmi_early_remap(x, l)  efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)   kzalloc(l, GFP_ATOMIC)
+
+#endif

None of these seem to use anything from io.h directly.

Yi: You are right , io.h doesn't need.

Cheers,
Mark.


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


Re: [PATCH] ARM64:DMI: Add smbios/dmi support on arm64

2014-06-04 Thread Yi Li

Hi Mark,

Please see the comments below:

On Wednesday, June 04, 2014 09:32 PM, Mark Rutland wrote:

On Tue, Jun 03, 2014 at 04:57:13PM +0100, Yi Li wrote:

Add smbios/dmi support on arm64 system, it depends on
EFI boot.

And what exactly does this provide us with?

What is exposed through SMBIOS/DMI, and why would I want to enable it?
Yi: SMBIOS/DMI is one basic spec/feature for server product(like x86 and 
IA64).

 Many OEMs/ODMs hope to use ARM64 as server's processor.
 So we need to support SMBIOS on ARM64.

SMBIOS mainly describes some hardware and software information for 
the system, like BIOS information
CPU information,  Memory information ,and so on. please refer to 
http://www.dmtf.org/standards/smbios





Signed-off-by: Yi Li yi...@linaro.org
---

Changes since v1:
   -Followed Ard Biesheuvel's suggestion to rebase the patch on
Matt Fleming's arm64-efi branch.

  arch/arm64/Kconfig   |   10 ++
  arch/arm64/include/asm/dmi.h |   28 
  arch/arm64/kernel/setup.c|2 ++
  3 files changed, 40 insertions(+)
  create mode 100644 arch/arm64/include/asm/dmi.h

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 6c71f12..13ee261 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -294,6 +294,16 @@ config EFI
  allow the kernel to be booted as an EFI application. This
  is only useful on systems that have UEFI firmware.
  
+config DMI

+   bool Enable support for SMBIOS (DMI) tables
+   depends on EFI
+   default y
+   help
+ This enables SMBIOS/DMI feature for systems.
+
+ This option is only useful on systems that have UEFI firmware.
+ However, even with this option, the resultant kernel should
+ continue to boot on existing non-UEFI platforms.
  endmenu
  
  menu Userspace binary formats

diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h
new file mode 100644
index 000..f2198bf
--- /dev/null
+++ b/arch/arm64/include/asm/dmi.h
@@ -0,0 +1,28 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi...@linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include linux/slab.h
+#include asm/io.h

Shouldn't that be linux/efi.h?

Why do we need asm/io.h?

Yi: porting it from IA64 , so the io.h is not needed exactly!
 but slab.h is must included ,not efi.h (tested by compiling)

+
+/* Use efi mappings for DMI */
+#define dmi_early_remap(x, l)  efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)   kzalloc(l, GFP_ATOMIC)
+
+#endif

None of these seem to use anything from io.h directly.

Yi: You are right , io.h doesn't need.

Cheers,
Mark.


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


[PATCH] ARM64:DMI: Add smbios/dmi support on arm64

2014-06-03 Thread Yi Li
Add smbios/dmi support on arm64 system, it depends on
EFI boot.

Signed-off-by: Yi Li 
---

Changes since v1:
  -Followed Ard Biesheuvel's suggestion to rebase the patch on
   Matt Fleming's arm64-efi branch.

 arch/arm64/Kconfig   |   10 ++
 arch/arm64/include/asm/dmi.h |   28 
 arch/arm64/kernel/setup.c|2 ++
 3 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/include/asm/dmi.h

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 6c71f12..13ee261 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -294,6 +294,16 @@ config EFI
  allow the kernel to be booted as an EFI application. This
  is only useful on systems that have UEFI firmware.
 
+config DMI
+   bool "Enable support for SMBIOS (DMI) tables"
+   depends on EFI
+   default y
+   help
+ This enables SMBIOS/DMI feature for systems.
+
+ This option is only useful on systems that have UEFI firmware.
+ However, even with this option, the resultant kernel should
+ continue to boot on existing non-UEFI platforms.
 endmenu
 
 menu "Userspace binary formats"
diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h
new file mode 100644
index 000..f2198bf
--- /dev/null
+++ b/arch/arm64/include/asm/dmi.h
@@ -0,0 +1,28 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi...@linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include 
+#include 
+
+/* Use efi mappings for DMI */
+#define dmi_early_remap(x, l)  efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)   kzalloc(l, GFP_ATOMIC)
+
+#endif
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 0a14aaf..7622561 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -400,6 +401,7 @@ static int __init arm64_device_init(void)
 {
of_clk_init(NULL);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+   dmi_scan_machine();
return 0;
 }
 arch_initcall(arm64_device_init);
-- 
1.7.9.5

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


[PATCH] ARM64:DMI: Add smbios/dmi support on arm64

2014-06-03 Thread Yi Li
Add smbios/dmi support on arm64 system, it depends on
EFI boot.

Signed-off-by: Yi Li yi...@linaro.org
---

Changes since v1:
  -Followed Ard Biesheuvel's suggestion to rebase the patch on
   Matt Fleming's arm64-efi branch.

 arch/arm64/Kconfig   |   10 ++
 arch/arm64/include/asm/dmi.h |   28 
 arch/arm64/kernel/setup.c|2 ++
 3 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/include/asm/dmi.h

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 6c71f12..13ee261 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -294,6 +294,16 @@ config EFI
  allow the kernel to be booted as an EFI application. This
  is only useful on systems that have UEFI firmware.
 
+config DMI
+   bool Enable support for SMBIOS (DMI) tables
+   depends on EFI
+   default y
+   help
+ This enables SMBIOS/DMI feature for systems.
+
+ This option is only useful on systems that have UEFI firmware.
+ However, even with this option, the resultant kernel should
+ continue to boot on existing non-UEFI platforms.
 endmenu
 
 menu Userspace binary formats
diff --git a/arch/arm64/include/asm/dmi.h b/arch/arm64/include/asm/dmi.h
new file mode 100644
index 000..f2198bf
--- /dev/null
+++ b/arch/arm64/include/asm/dmi.h
@@ -0,0 +1,28 @@
+/*
+ * arch/arm64/include/asm/dmi.h
+ *
+ * Copyright (C) 2013 Linaro Limited.
+ * Written by: Yi Li (yi...@linaro.org)
+ *
+ * based on arch/ia64/include/asm/dmi.h
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include linux/slab.h
+#include asm/io.h
+
+/* Use efi mappings for DMI */
+#define dmi_early_remap(x, l)  efi_lookup_mapped_addr(x)
+#define dmi_early_unmap(x, l)
+#define dmi_remap(x, l)efi_lookup_mapped_addr(x)
+#define dmi_unmap(x)
+#define dmi_alloc(l)   kzalloc(l, GFP_ATOMIC)
+
+#endif
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 0a14aaf..7622561 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -42,6 +42,7 @@
 #include linux/of_fdt.h
 #include linux/of_platform.h
 #include linux/efi.h
+#include linux/dmi.h
 
 #include asm/fixmap.h
 #include asm/cputype.h
@@ -400,6 +401,7 @@ static int __init arm64_device_init(void)
 {
of_clk_init(NULL);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+   dmi_scan_machine();
return 0;
 }
 arch_initcall(arm64_device_init);
-- 
1.7.9.5

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


[PATCH] Add dmi driver support on arm

2013-09-06 Thread Yi Li
From: liyi 

x86 and IA64 have the DMI support, which is useful for supporting
SMBIOS specification. All these SMBIOS tables will give the hardware
information for user or applications.

This patch depends on EFI runtime service function which
not yet upstreamed, it has been generated against the tag
leg-20130906.0 on git://git.linaro.org/people/graemegregory/linux.git."

liyi (1):
  ARM:DMI: Add dmi driver support on arm

 arch/arm/Kconfig   |9 +
 arch/arm/include/asm/dmi.h |   12 
 arch/arm/kernel/setup.c|7 ++-
 3 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/dmi.h

-- 
1.7.9.5

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


[PATCH] ARM:DMI: Add dmi driver support on arm

2013-09-06 Thread Yi Li
From: liyi 

Add dmi driver support on arm, it depends on efi runtime service
enabled.

Signed-off-by: liyi 
---
 arch/arm/Kconfig   |9 +
 arch/arm/include/asm/dmi.h |   12 
 arch/arm/kernel/setup.c|7 ++-
 3 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/dmi.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e8daccd..02abb1d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1946,6 +1946,15 @@ config EFI_STUB
  executed directly by EFI firmware.
  See Documentation/efi-stub.txt for more information.
 
+config DMI
+   default y
+   bool "Enable DMI scanning" if EXPERT
+   ---help---
+ Enabled scanning of DMI to identify machine quirks. Say Y
+ here unless you have verified that your setup is not
+ affected by entries in the DMI blacklist. Required by EFI
+ support.
+
 config SECCOMP
bool
prompt "Enable seccomp to safely compute untrusted bytecode"
diff --git a/arch/arm/include/asm/dmi.h b/arch/arm/include/asm/dmi.h
new file mode 100644
index 000..84baf0e
--- /dev/null
+++ b/arch/arm/include/asm/dmi.h
@@ -0,0 +1,12 @@
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include 
+#include 
+#include 
+/* Use normal IO mappings for DMI */
+#define dmi_ioremap(x, l) __arm_ioremap((x), (l), MT_MEMORY)
+#define dmi_iounmap(x, l) __arm_iounmap((x))
+#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
+
+#endif
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index a440211..2194554 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -34,13 +34,15 @@
 #ifdef CONFIG_ACPI
 #include 
 #endif
+#ifdef CONFIG_DMI
+#include 
+#endif
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1073,3 +1075,6 @@ const struct seq_operations cpuinfo_op = {
.stop   = c_stop,
.show   = c_show
 };
+#ifdef CONFIG_DMI
+   core_initcall(dmi_scan_machine);
+#endif
-- 
1.7.9.5

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


[PATCH] ARM:DMI: Add dmi driver support on arm

2013-09-06 Thread Yi Li
From: liyi yi...@linaro.org

Add dmi driver support on arm, it depends on efi runtime service
enabled.

Signed-off-by: liyi yi...@linaro.org
---
 arch/arm/Kconfig   |9 +
 arch/arm/include/asm/dmi.h |   12 
 arch/arm/kernel/setup.c|7 ++-
 3 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/dmi.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e8daccd..02abb1d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1946,6 +1946,15 @@ config EFI_STUB
  executed directly by EFI firmware.
  See Documentation/efi-stub.txt for more information.
 
+config DMI
+   default y
+   bool Enable DMI scanning if EXPERT
+   ---help---
+ Enabled scanning of DMI to identify machine quirks. Say Y
+ here unless you have verified that your setup is not
+ affected by entries in the DMI blacklist. Required by EFI
+ support.
+
 config SECCOMP
bool
prompt Enable seccomp to safely compute untrusted bytecode
diff --git a/arch/arm/include/asm/dmi.h b/arch/arm/include/asm/dmi.h
new file mode 100644
index 000..84baf0e
--- /dev/null
+++ b/arch/arm/include/asm/dmi.h
@@ -0,0 +1,12 @@
+#ifndef _ASM_DMI_H
+#define _ASM_DMI_H 1
+
+#include linux/slab.h
+#include asm/io.h
+#include asm/mach/map.h
+/* Use normal IO mappings for DMI */
+#define dmi_ioremap(x, l) __arm_ioremap((x), (l), MT_MEMORY)
+#define dmi_iounmap(x, l) __arm_iounmap((x))
+#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
+
+#endif
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index a440211..2194554 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -34,13 +34,15 @@
 #ifdef CONFIG_ACPI
 #include linux/acpi.h
 #endif
+#ifdef CONFIG_DMI
+#include linux/dmi.h
+#endif
 
 #include asm/unified.h
 #include asm/cp15.h
 #include asm/cpu.h
 #include asm/cputype.h
 #include asm/elf.h
-#include asm/io.h
 #include asm/procinfo.h
 #include asm/psci.h
 #include asm/sections.h
@@ -1073,3 +1075,6 @@ const struct seq_operations cpuinfo_op = {
.stop   = c_stop,
.show   = c_show
 };
+#ifdef CONFIG_DMI
+   core_initcall(dmi_scan_machine);
+#endif
-- 
1.7.9.5

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


[PATCH] Add dmi driver support on arm

2013-09-06 Thread Yi Li
From: liyi yi...@linaro.org

x86 and IA64 have the DMI support, which is useful for supporting
SMBIOS specification. All these SMBIOS tables will give the hardware
information for user or applications.

This patch depends on EFI runtime service function which
not yet upstreamed, it has been generated against the tag
leg-20130906.0 on git://git.linaro.org/people/graemegregory/linux.git.

liyi (1):
  ARM:DMI: Add dmi driver support on arm

 arch/arm/Kconfig   |9 +
 arch/arm/include/asm/dmi.h |   12 
 arch/arm/kernel/setup.c|7 ++-
 3 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/include/asm/dmi.h

-- 
1.7.9.5

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


XFS file system Pre-Release

2001-01-29 Thread Yi Li


SGI has made available the pre-release version 0.9 of its high-end XFS file
system ported to Linux®. Code and detailed information are at
http://oss.sgi.com/projects/xfs/prerelease.html.

Thanks to the extensive interest and contributions from the community, the
XFS file system for Linux has made significant progress since its Beta
release in September 2000. Although there are still some features to be
finalized, the pre-release code is currently stable in a majority of normal
environments. We welcome and encourage interested users to try out the code
aggressively in your test environments, so that we can work through the
final stage of the development and bug fixes to meet your production needs. 

SGI XFS Pre-release 0.9 is available in the following three fashions:
· As a patch against linux-2.4.0. 
· As a set of RPMs.
· As a complete system installer which works with Red Hat 7.0 media to run
XFS on the root partition.

We will be demonstrating XFS as the root file system for high availability
and clustering solutions in SGI systems at LinuxWorld New York from January
31 to February 2. Free XFS CDs will also be available at LinuxWorld.

For more information on the open source project of XFS for Linux, please see
http://oss.sgi.com/projects/xfs/index.html.

Thanks very much - please email me at [EMAIL PROTECTED] if you have any
questions.

Yi 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



XFS file system Pre-Release

2001-01-29 Thread Yi Li


SGI has made available the pre-release version 0.9 of its high-end XFS file
system ported to Linux. Code and detailed information are at
http://oss.sgi.com/projects/xfs/prerelease.html.

Thanks to the extensive interest and contributions from the community, the
XFS file system for Linux has made significant progress since its Beta
release in September 2000. Although there are still some features to be
finalized, the pre-release code is currently stable in a majority of normal
environments. We welcome and encourage interested users to try out the code
aggressively in your test environments, so that we can work through the
final stage of the development and bug fixes to meet your production needs. 

SGI XFS Pre-release 0.9 is available in the following three fashions:
 As a patch against linux-2.4.0. 
 As a set of RPMs.
 As a complete system installer which works with Red Hat 7.0 media to run
XFS on the root partition.

We will be demonstrating XFS as the root file system for high availability
and clustering solutions in SGI systems at LinuxWorld New York from January
31 to February 2. Free XFS CDs will also be available at LinuxWorld.

For more information on the open source project of XFS for Linux, please see
http://oss.sgi.com/projects/xfs/index.html.

Thanks very much - please email me at [EMAIL PROTECTED] if you have any
questions.

Yi 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/