Re: i2c-core: One function call less in acpi_i2c_space_handler() after error detection
>> The kfree() function was called in one case by the >> acpi_i2c_space_handler() function during error handling >> even if the passed variable "client" contained a null pointer. > > This is OK. kfree() is known to be NULL-tolerant and we rely on it in > various places to keep the code simpler. I would appreciate if an unnecessary function call can be avoided here so that the affected exception handling can become also a bit more efficient. Regards, Markus -- 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 4/6] bpf: hash: convert per-hashtable lock into per-bucket bit spinlock
On Fri, Dec 18, 2015 at 2:20 PM, Alexei Starovoitov wrote: > On Wed, Dec 16, 2015 at 02:58:08PM +0800, Ming Lei wrote: >> On Wed, Dec 16, 2015 at 1:01 PM, Yang Shi wrote: >> >> > >> > I recalled Steven confirmed raw_spin_lock has the lockdep benefit too in >> > the >> > patch review for changing to raw lock. >> > >> > Please check this thread out >> > http://lists.openwall.net/netdev/2015/10/31/7 >> >> OK, looks I was wrong about the lockdep benifit, :-( >> >> But for this lock, I think lockdep isn't such important, because it is the >> intermost lock, and it can be used just for protecting the bucket list >> and nothing else need to be covered. > > I still think that overhead of normal spinlock per bucket is acceptable. > Makes the whole thing much easier to read. OK, let's use per-bucket spinlock first. -- Ming Lei -- 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: [GIT PULL] tpmdd updates for Linux 4.5
On Mon, 21 Dec 2015, Jarkko Sakkinen wrote: > Hi > > Here are tpmdd updates for Linux 4.5. Sorry I didn't send this already > last week but I had to hold until I get ack from Peter and Mimi before > doing anything. Patches are quite well baked for a while now with the > exception of small fix from Stefan to tpm_ibmvtpm, which I considered > trivial enough to be included. > Applied. -- James Morris -- 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: [f2fs-dev] [PATCH 4/5] f2fs: support data flush in ioctl
Hi Jaegeuk, On 12/25/15 5:06 AM, Jaegeuk Kim wrote: > Hi Chao, > > On Thu, Dec 24, 2015 at 06:10:25PM +0800, Chao Yu wrote: >> Sometimes user want to sync all data belong to superblock into storage >> for persistence, 'syncfs' syscall is one option, still f2fs supports >> similar one through ioctl, difference is that sb releted kworker is >> online for writebacking concurrently. > > There is compatibility issue, since you're trying to change pre-defined > ioctl; Agreed. > it needs to change F2FS_IOC_WRITE_CHECKPOINT too, right? Yes, maybe F2FS_IOC_WRITE_CHECKPOINT_V2 if we have to change this interface. > I'm in doubt that we really need to expose this too. There is no obviously demands, but for Marc Lehmann's scenario I expect this can provide less latency by concurrently writebacking when syncing the whole f2fs partition. Thanks, > > Thanks, > >> >> Signed-off-by: Chao Yu >> --- >> fs/f2fs/file.c | 10 ++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c >> index a60d088..91997a5 100644 >> --- a/fs/f2fs/file.c >> +++ b/fs/f2fs/file.c >> @@ -1621,6 +1621,7 @@ static int f2fs_ioc_write_checkpoint(struct file >> *filp, unsigned long arg) >> struct f2fs_sb_info *sbi = F2FS_I_SB(inode); >> struct cp_control cpc; >> int err; >> +int flush_data; >> >> if (!capable(CAP_SYS_ADMIN)) >> return -EPERM; >> @@ -1628,6 +1629,15 @@ static int f2fs_ioc_write_checkpoint(struct file >> *filp, unsigned long arg) >> if (f2fs_readonly(sbi->sb)) >> return -EROFS; >> >> +if (get_user(flush_data, (__u32 __user *)arg)) >> +return -EFAULT; >> + >> +if (flush_data) { >> +err = sync_dirty_inodes(sbi, FILE_INODE); >> +if (err) >> +return err; >> +} >> + >> cpc.reason = __get_cp_reason(sbi); >> >> mutex_lock(&sbi->gc_mutex); >> -- >> 2.6.3 >> > > -- > ___ > Linux-f2fs-devel mailing list > linux-f2fs-de...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel > -- 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 0/3] bpf: hash: use per-bucket spinlock
Hi, This patchset tries to optimize ebpf hash map, and follows the idea: Both htab_map_update_elem() and htab_map_delete_elem() can be called from eBPF program, and they may be in kernel hot path, it isn't efficient to use a per-hashtable lock in this two helpers, so this patch converts the lock into per-bucket spinlock. With this patchset, looks the performance penalty from eBPF decreased a lot, see the following test: 1) run 'tools/biolatency' of bcc before running block test; 2) run fio to test block throught over /dev/nullb0, (randread, 16jobs, libaio, 4k bs) and the test box is one 24cores(dual sockets) VM server: - without patchset: 607K IOPS - with this patchset: 1184K IOPS - without running eBPF prog: 1492K IOPS TODO: - remove the per-hashtable atomic counter kernel/bpf/hashtab.c | 49 +++-- 1 file changed, 31 insertions(+), 18 deletions(-) thanks, Ming -- 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 1/3] bpf: hash: use atomic count
Preparing for removing global per-hashtable lock, so the counter need to be defined as aotmic_t first. Signed-off-by: Ming Lei --- kernel/bpf/hashtab.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 34777b3..2615388 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -18,7 +18,7 @@ struct bpf_htab { struct bpf_map map; struct hlist_head *buckets; raw_spinlock_t lock; - u32 count; /* number of elements in this hashtable */ + atomic_t count; /* number of elements in this hashtable */ u32 n_buckets; /* number of hash buckets */ u32 elem_size; /* size of each element in bytes */ }; @@ -106,7 +106,7 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) INIT_HLIST_HEAD(&htab->buckets[i]); raw_spin_lock_init(&htab->lock); - htab->count = 0; + atomic_set(&htab->count, 0); return &htab->map; @@ -256,7 +256,7 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, l_old = lookup_elem_raw(head, l_new->hash, key, key_size); - if (!l_old && unlikely(htab->count >= map->max_entries)) { + if (!l_old && unlikely(atomic_read(&htab->count) >= map->max_entries)) { /* if elem with this 'key' doesn't exist and we've reached * max_entries limit, fail insertion of new elem */ @@ -284,7 +284,7 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, hlist_del_rcu(&l_old->hash_node); kfree_rcu(l_old, rcu); } else { - htab->count++; + atomic_inc(&htab->count); } raw_spin_unlock_irqrestore(&htab->lock, flags); @@ -319,7 +319,7 @@ static int htab_map_delete_elem(struct bpf_map *map, void *key) if (l) { hlist_del_rcu(&l->hash_node); - htab->count--; + atomic_dec(&htab->count); kfree_rcu(l, rcu); ret = 0; } @@ -339,7 +339,7 @@ static void delete_all_elements(struct bpf_htab *htab) hlist_for_each_entry_safe(l, n, head, hash_node) { hlist_del_rcu(&l->hash_node); - htab->count--; + atomic_dec(&htab->count); kfree(l); } } -- 1.9.1 -- 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 3/3] bpf: hash: use per-bucket spinlock
From: Ming Lei Both htab_map_update_elem() and htab_map_delete_elem() can be called from eBPF program, and they may be in kernel hot path, so it isn't efficient to use a per-hashtable lock in this two helpers. The per-hashtable spinlock is used just for protecting bucket's hlist, and per-bucket lock should be enough. This patch converts the per-hashtable lock into per-bucket spinlock, so that contention can be decreased a lot. Signed-off-by: Ming Lei --- kernel/bpf/hashtab.c | 35 +-- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index d857fcb..66bad7a 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -14,9 +14,14 @@ #include #include +struct bucket { + struct hlist_head head; + raw_spinlock_t lock; +}; + struct bpf_htab { struct bpf_map map; - struct hlist_head *buckets; + struct bucket *buckets; raw_spinlock_t lock; atomic_t count; /* number of elements in this hashtable */ u32 n_buckets; /* number of hash buckets */ @@ -88,24 +93,25 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) /* make sure page count doesn't overflow */ goto free_htab; - htab->map.pages = round_up(htab->n_buckets * sizeof(struct hlist_head) + + htab->map.pages = round_up(htab->n_buckets * sizeof(struct bucket) + htab->elem_size * htab->map.max_entries, PAGE_SIZE) >> PAGE_SHIFT; err = -ENOMEM; - htab->buckets = kmalloc_array(htab->n_buckets, sizeof(struct hlist_head), + htab->buckets = kmalloc_array(htab->n_buckets, sizeof(struct bucket), GFP_USER | __GFP_NOWARN); if (!htab->buckets) { - htab->buckets = vmalloc(htab->n_buckets * sizeof(struct hlist_head)); + htab->buckets = vmalloc(htab->n_buckets * sizeof(struct bucket)); if (!htab->buckets) goto free_htab; } - for (i = 0; i < htab->n_buckets; i++) - INIT_HLIST_HEAD(&htab->buckets[i]); + for (i = 0; i < htab->n_buckets; i++) { + INIT_HLIST_HEAD(&htab->buckets[i].head); + raw_spin_lock_init(&htab->buckets[i].lock); + } - raw_spin_lock_init(&htab->lock); atomic_set(&htab->count, 0); return &htab->map; @@ -120,11 +126,16 @@ static inline u32 htab_map_hash(const void *key, u32 key_len) return jhash(key, key_len, 0); } -static inline struct hlist_head *select_bucket(struct bpf_htab *htab, u32 hash) +static inline struct bucket *__select_bucket(struct bpf_htab *htab, u32 hash) { return &htab->buckets[hash & (htab->n_buckets - 1)]; } +static inline struct hlist_head *select_bucket(struct bpf_htab *htab, u32 hash) +{ + return &__select_bucket(htab, hash)->head; +} + static struct htab_elem *lookup_elem_raw(struct hlist_head *head, u32 hash, void *key, u32 key_size) { @@ -227,6 +238,7 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, struct bpf_htab *htab = container_of(map, struct bpf_htab, map); struct htab_elem *l_new, *l_old; struct hlist_head *head; + struct bucket *b; unsigned long flags; u32 key_size; int ret; @@ -248,7 +260,8 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, memcpy(l_new->key + round_up(key_size, 8), value, map->value_size); l_new->hash = htab_map_hash(l_new->key, key_size); - head = select_bucket(htab, l_new->hash); + b = __select_bucket(htab, l_new->hash); + head = &b->head; /* bpf_map_update_elem() can be called in_irq() */ raw_spin_lock_irqsave(&htab->lock, flags); @@ -299,6 +312,7 @@ static int htab_map_delete_elem(struct bpf_map *map, void *key) { struct bpf_htab *htab = container_of(map, struct bpf_htab, map); struct hlist_head *head; + struct bucket *b; struct htab_elem *l; unsigned long flags; u32 hash, key_size; @@ -309,7 +323,8 @@ static int htab_map_delete_elem(struct bpf_map *map, void *key) key_size = map->key_size; hash = htab_map_hash(key, key_size); - head = select_bucket(htab, hash); + b = __select_bucket(htab, hash); + head = &b->head; raw_spin_lock_irqsave(&htab->lock, flags); -- 1.9.1 -- 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 2/3] bpf: hash: move select_bucket() out of htab's spinlock
The spinlock is just used for protecting the per-bucket hlist, so it isn't needed for selecting bucket. Signed-off-by: Ming Lei --- kernel/bpf/hashtab.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 2615388..d857fcb 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -248,12 +248,11 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, memcpy(l_new->key + round_up(key_size, 8), value, map->value_size); l_new->hash = htab_map_hash(l_new->key, key_size); + head = select_bucket(htab, l_new->hash); /* bpf_map_update_elem() can be called in_irq() */ raw_spin_lock_irqsave(&htab->lock, flags); - head = select_bucket(htab, l_new->hash); - l_old = lookup_elem_raw(head, l_new->hash, key, key_size); if (!l_old && unlikely(atomic_read(&htab->count) >= map->max_entries)) { @@ -310,11 +309,10 @@ static int htab_map_delete_elem(struct bpf_map *map, void *key) key_size = map->key_size; hash = htab_map_hash(key, key_size); + head = select_bucket(htab, hash); raw_spin_lock_irqsave(&htab->lock, flags); - head = select_bucket(htab, hash); - l = lookup_elem_raw(head, hash, key, key_size); if (l) { -- 1.9.1 -- 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/
[f2fs-dev] [PATCH] f2fs: fix bugs and simplify codes of f2fs_fiemap
fix bugs: 1. len could be updated incorrectly when start+len is beyond isize. 2. If there is a hole consisting of more than two blocks, it could fail to add FIEMAP_EXTENT_LAST flag for the last extent. 3. If there is an extent beyond isize, when we search extents in a range that ends at isize, it will also return the extent beyond isize, which is outside the range. Signed-off-by: Fan li --- fs/f2fs/data.c | 80 +++- 1 file changed, 27 insertions(+), 53 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 5c43b2d..d67c599 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -783,7 +783,6 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, loff_t isize = i_size_read(inode); u64 logical = 0, phys = 0, size = 0; u32 flags = 0; - bool past_eof = false, whole_file = false; int ret = 0; ret = fiemap_check_flags(fieinfo, FIEMAP_FLAG_SYNC); @@ -797,17 +796,18 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, } mutex_lock(&inode->i_mutex); + if (start >= isize) + goto out; - if (len >= isize) { - whole_file = true; - len = isize; - } + if (start + len > isize) + len = isize - start; if (logical_to_blk(inode, len) == 0) len = blk_to_logical(inode, 1); start_blk = logical_to_blk(inode, start); last_blk = logical_to_blk(inode, start + len - 1); + next: memset(&map_bh, 0, sizeof(struct buffer_head)); map_bh.b_size = len; @@ -819,59 +819,33 @@ next: /* HOLE */ if (!buffer_mapped(&map_bh)) { - start_blk++; - - if (!past_eof && blk_to_logical(inode, start_blk) >= isize) - past_eof = 1; - - if (past_eof && size) { - flags |= FIEMAP_EXTENT_LAST; - ret = fiemap_fill_next_extent(fieinfo, logical, - phys, size, flags); - } else if (size) { - ret = fiemap_fill_next_extent(fieinfo, logical, - phys, size, flags); - size = 0; - } + /* Go through holes util pass the EOF */ + if (blk_to_logical(inode, start_blk++) < isize) + goto prep_next; + /* Found a hole beyond isize means no more extents. +* Note that the premise is that filesystems don't +* punch holes beyond isize and keep size unchanged. +*/ + flags |= FIEMAP_EXTENT_LAST; + } - /* if we have holes up to/past EOF then we're done */ - if (start_blk > last_blk || past_eof || ret) - goto out; - } else { - if (start_blk > last_blk && !whole_file) { - ret = fiemap_fill_next_extent(fieinfo, logical, - phys, size, flags); - goto out; - } + if (size) + ret = fiemap_fill_next_extent(fieinfo, logical, + phys, size, flags); - /* -* if size != 0 then we know we already have an extent -* to add, so add it. -*/ - if (size) { - ret = fiemap_fill_next_extent(fieinfo, logical, - phys, size, flags); - if (ret) - goto out; - } + if (start_blk > last_blk || ret) + goto out; - logical = blk_to_logical(inode, start_blk); - phys = blk_to_logical(inode, map_bh.b_blocknr); - size = map_bh.b_size; - flags = 0; - if (buffer_unwritten(&map_bh)) - flags = FIEMAP_EXTENT_UNWRITTEN; + logical = blk_to_logical(inode, start_blk); + phys = blk_to_logical(inode, map_bh.b_blocknr); + size = map_bh.b_size; + flags = 0; + if (buffer_unwritten(&map_bh)) + flags = FIEMAP_EXTENT_UNWRITTEN; - start_blk += logical_to_blk(inode, size); + start_blk += logical_to_blk(inode, size); - /* -* If we are past the EOF, then we need to make sure as -* soon as we find a hole that the last extent we found -* is marked with FIEMAP_EXTENT_LAST -*/ - if (!past_eof && logical + size >= isize) - past_eof = true; - } +prep_next: cond_resched(); if (fatal_signal_pending(current)) ret = -EINTR; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe l
[PATCH 0/3] IDE-ACPI: Fine-tuning for a function
From: Markus Elfring Date: Sat, 26 Dec 2015 11:04:56 +0100 A few update suggestions were taken into account from static source code analysis. Markus Elfring (3): One function call less in ide_get_dev_handle() after error detection Delete unnecessary null pointer checks in ide_get_dev_handle() Move an assignment for one variable in ide_get_dev_handle() drivers/ide/ide-acpi.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) -- 2.6.3 -- 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 1/3] IDE-ACPI: One function call less in ide_get_dev_handle() after error detection
From: Markus Elfring Date: Sat, 26 Dec 2015 10:01:36 +0100 The kfree() function was called in two cases by the ide_get_dev_handle() function during error handling even if the passed variable "dinfo" contained a null pointer. * Let us return directly if a call of the function "ACPI_HANDLE" or "acpi_get_object_info" failed. * Delete the explicit initialisation for the variables "dinfo" and "ret" at the beginning then. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/ide/ide-acpi.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index b694099..319b754 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c @@ -126,8 +126,8 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, u64 addr; acpi_handle dev_handle; acpi_status status; - struct acpi_device_info *dinfo = NULL; - int ret = -ENODEV; + struct acpi_device_info *dinfo; + int ret; bus = pdev->bus->number; devnum = PCI_SLOT(pdev->devfn); @@ -140,13 +140,13 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, dev_handle = ACPI_HANDLE(dev); if (!dev_handle) { DEBPRINT("no acpi handle for device\n"); - goto err; + return -ENODEV; } status = acpi_get_object_info(dev_handle, &dinfo); if (ACPI_FAILURE(status)) { DEBPRINT("get_object_info for device failed\n"); - goto err; + return -ENODEV; } if (dinfo && (dinfo->valid & ACPI_VALID_ADR) && dinfo->address == addr) { @@ -157,13 +157,14 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, " address: %llu, should be %u\n", dinfo ? (unsigned long long)dinfo->address : -1ULL, (unsigned int)addr); - goto err; + ret = -ENODEV; + goto free_info; } DEBPRINT("for dev=0x%x.%x, addr=0x%llx, *handle=0x%p\n", devnum, func, (unsigned long long)addr, *handle); ret = 0; -err: +free_info: kfree(dinfo); return ret; } -- 2.6.3 -- 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 2/3] IDE-ACPI: Delete unnecessary null pointer checks in ide_get_dev_handle()
From: Markus Elfring Date: Sat, 26 Dec 2015 10:33:48 +0100 The variable "dinfo" will contain an appropropriate pointer after a call of the acpi_get_object_info() function succeeded. Thus remove two safety checks. Signed-off-by: Markus Elfring --- drivers/ide/ide-acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 319b754..b6b2111 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c @@ -148,14 +148,14 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, DEBPRINT("get_object_info for device failed\n"); return -ENODEV; } - if (dinfo && (dinfo->valid & ACPI_VALID_ADR) && + if ((dinfo->valid & ACPI_VALID_ADR) && dinfo->address == addr) { *pcidevfn = addr; *handle = dev_handle; } else { DEBPRINT("get_object_info for device has wrong " " address: %llu, should be %u\n", - dinfo ? (unsigned long long)dinfo->address : -1ULL, + (unsigned long long)dinfo->address, (unsigned int)addr); ret = -ENODEV; goto free_info; -- 2.6.3 -- 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 3/3] IDE-ACPI: Move an assignment for one variable in ide_get_dev_handle()
From: Markus Elfring Date: Sat, 26 Dec 2015 10:50:33 +0100 Move the assignment for the variable "addr" to the statement where its value is used after previous function calls succeeded. Signed-off-by: Markus Elfring --- drivers/ide/ide-acpi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index b6b2111..c2de9f9 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c @@ -132,9 +132,6 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, bus = pdev->bus->number; devnum = PCI_SLOT(pdev->devfn); func = PCI_FUNC(pdev->devfn); - /* ACPI _ADR encoding for PCI bus: */ - addr = (u64)(devnum << 16 | func); - DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func); dev_handle = ACPI_HANDLE(dev); @@ -148,6 +145,8 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, DEBPRINT("get_object_info for device failed\n"); return -ENODEV; } + /* ACPI _ADR encoding for PCI bus: */ + addr = (u64)(devnum << 16 | func); if ((dinfo->valid & ACPI_VALID_ADR) && dinfo->address == addr) { *pcidevfn = addr; -- 2.6.3 -- 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: [PATCHV5 3/3] x86, ras: Add __mcsafe_copy() function to recover from machine checks
On Fri, Dec 25, 2015 at 08:05:39PM +, Luck, Tony wrote: > mce_in_kernel_recov() should check whether we have a fix up entry for > the specific IP that hit the machine check before rating the severity > as kernel recoverable. Yeah, it is not precise right now. But this is easy - I'll change it to a simpler version of fixup_mcexception() to iterate over the exception table. > If we add more functions (for different cache behaviour, or to > optimize for specific processor model) we can make sure to put them > all together inside begin/end labels. Yeah, I think we can do even better than that as all the info is in the ELF file already. For example, ENDPROC(__mcsafe_copy) generates .type __mcsafe_copy, @function ; .size __mcsafe_copy, .-__mcsafe_copy and there's the size of the function, I guess we can macroize something like that or even parse the ELF file: $ readelf --syms vmlinux | grep mcsafe 706: 819df73e14 OBJECT LOCAL DEFAULT 11 __kstrtab___mcsafe_copy 707: 819d0e18 8 OBJECT LOCAL DEFAULT9 __kcrctab___mcsafe_copy 56107: 819b3bb016 OBJECT GLOBAL DEFAULT7 __ksymtab___mcsafe_copy 58581: 812e6d70 179 FUNCGLOBAL DEFAULT1 __mcsafe_copy 62233: 3313f9d4 0 NOTYPE GLOBAL DEFAULT ABS __crc___mcsafe_copy 68818: 812e6e23 0 NOTYPE GLOBAL DEFAULT1 __mcsafe_copy_end __mcsafe_copy is of size 179 bytes: 0x812e6d70 + 179 = 0x812e6e23 which is __mcsafe_copy_end so those labels should not really be necessary as they're global and polluting the binary unnecessarily. > We would run into trouble if we want to have some in-line macros for > use from arbitrary C-code like we have for the page fault case. Example? > I might make the arbitrary %rax value be #PF and #MC to reflect the > h/w fault that got us here rather than -EINVAL/-EFAULT. But that's > just bike shedding. Yeah, I picked those arbitrarily to show the intention. > But now we are back to having the fault handler poke %rax again, which > made Andy twitch before. Andy, why is that? It makes the exception handling much simpler this way... -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- 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 v2 14/16] x86,nvdimm,kexec: Use walk_iomem_res_desc() for iomem search
On Fri, Dec 25, 2015 at 03:09:23PM -0700, Toshi Kani wrote: > Change to call walk_iomem_res_desc() for searching resource entries > with the following names: > "ACPI Tables" > "ACPI Non-volatile Storage" > "Persistent Memory (legacy)" > "Crash kernel" > > Note, the caller of walk_iomem_res() with "GART" is left unchanged > because this entry may be initialized by out-of-tree drivers, which > do not have 'desc' set to IORES_DESC_GART. There's this out-of-tree bogus argument again. :\ Why do we care about out-of-tree drivers? You can just as well fix the "GART" case too and kill walk_iomem_res() altogether... -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- 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 LINUX v5 8/8] tty: xuartps: Move RX path into helper function
Move RX-related IRQ handling into a helper function. Fixes a problem where every char received after a parity or frame error in the current isr will also be tagged as a parity or frame error. Signed-off-by: Soren Brinkmann Reviewed-by: Peter Hurley --- v4: - added Peter's additional information to the commit message (thx) --- drivers/tty/serial/xilinx_uartps.c | 50 +- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index f3ac69387b0a..db9e23eaf300 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -172,28 +172,8 @@ struct cdns_uart { #define to_cdns_uart(_nb) container_of(_nb, struct cdns_uart, \ clk_rate_change_nb); -/** - * cdns_uart_isr - Interrupt handler - * @irq: Irq number - * @dev_id: Id of the port - * - * Return: IRQHANDLED - */ -static irqreturn_t cdns_uart_isr(int irq, void *dev_id) +static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) { - struct uart_port *port = (struct uart_port *)dev_id; - unsigned long flags; - unsigned int isrstatus, numbytes; - unsigned int data; - char status = TTY_NORMAL; - - spin_lock_irqsave(&port->lock, flags); - - /* Read the interrupt status register to determine which -* interrupt(s) is/are active. -*/ - isrstatus = readl(port->membase + CDNS_UART_ISR_OFFSET); - /* * There is no hardware break detection, so we interpret framing * error with all-zeros data as a break sequence. Most of the time, @@ -223,6 +203,9 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) /* Receive Timeout Interrupt */ while (!(readl(port->membase + CDNS_UART_SR_OFFSET) & CDNS_UART_SR_RXEMPTY)) { + u32 data; + char status = TTY_NORMAL; + data = readl(port->membase + CDNS_UART_FIFO_OFFSET); /* Non-NULL byte after BREAK is garbage (99%) */ @@ -263,10 +246,33 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) } uart_insert_char(port, isrstatus, CDNS_UART_IXR_OVERRUN, - data, status); +data, status); } tty_flip_buffer_push(&port->state->port); } +} + +/** + * cdns_uart_isr - Interrupt handler + * @irq: Irq number + * @dev_id: Id of the port + * + * Return: IRQHANDLED + */ +static irqreturn_t cdns_uart_isr(int irq, void *dev_id) +{ + struct uart_port *port = (struct uart_port *)dev_id; + unsigned long flags; + unsigned int isrstatus, numbytes; + + spin_lock_irqsave(&port->lock, flags); + + /* Read the interrupt status register to determine which +* interrupt(s) is/are active. +*/ + isrstatus = readl(port->membase + CDNS_UART_ISR_OFFSET); + + cdns_uart_handle_rx(port, isrstatus); /* Dispatch an appropriate handler */ if ((isrstatus & CDNS_UART_IXR_TXEMPTY) == CDNS_UART_IXR_TXEMPTY) { -- 2.6.3.3.g9bb996a -- 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 LINUX v5 5/8] tty: xuartps: Improve startup function
The startup function is supposed to initialize the UART for receiving. Hence, don't enable the TX part. Also, protect HW accesses with the port lock. Signed-off-by: Soren Brinkmann Reviewed-by: Peter Hurley --- drivers/tty/serial/xilinx_uartps.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index ef114d7a0623..6ffd3bbe3e18 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -758,6 +758,7 @@ static void cdns_uart_set_termios(struct uart_port *port, */ static int cdns_uart_startup(struct uart_port *port) { + unsigned long flags; unsigned int retval = 0, status = 0; retval = request_irq(port->irq, cdns_uart_isr, 0, CDNS_UART_NAME, @@ -765,6 +766,8 @@ static int cdns_uart_startup(struct uart_port *port) if (retval) return retval; + spin_lock_irqsave(&port->lock, flags); + /* Disable the TX and RX */ writel(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS, port->membase + CDNS_UART_CR_OFFSET); @@ -775,15 +778,14 @@ static int cdns_uart_startup(struct uart_port *port) writel(CDNS_UART_CR_TXRST | CDNS_UART_CR_RXRST, port->membase + CDNS_UART_CR_OFFSET); - status = readl(port->membase + CDNS_UART_CR_OFFSET); - - /* Clear the RX disable and TX disable bits and then set the TX enable -* bit and RX enable bit to enable the transmitter and receiver. + /* +* Clear the RX disable bit and then set the RX enable bit to enable +* the receiver. */ - writel((status & ~(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS)) - | (CDNS_UART_CR_TX_EN | CDNS_UART_CR_RX_EN | - CDNS_UART_CR_STOPBRK), - port->membase + CDNS_UART_CR_OFFSET); + status = readl(port->membase + CDNS_UART_CR_OFFSET); + status &= CDNS_UART_CR_RX_DIS; + status |= CDNS_UART_CR_RX_EN; + writel(status, port->membase + CDNS_UART_CR_OFFSET); /* Set the Mode Register with normal mode,8 data bits,1 stop bit, * no parity. @@ -814,6 +816,8 @@ static int cdns_uart_startup(struct uart_port *port) CDNS_UART_IXR_RXTRIG | CDNS_UART_IXR_TOUT, port->membase + CDNS_UART_IER_OFFSET); + spin_unlock_irqrestore(&port->lock, flags); + return retval; } -- 2.6.3.3.g9bb996a -- 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 LINUX v5 0/8] tty: xuartps: Fix lock ups
Hi, as requested by Peter, this is the first part of my series which has the patches reviewed by Peter. I'll submit the second part separately. There are no new changes within the patches. Thanks, Sören Sören Brinkmann (8): tty: xuartps: Beautify read-modify writes tty: xuartps: Use spinlock to serialize HW access tty: xuartps: Don't consider circular buffer when enabling transmitter tty: xuartps: Clear interrupt status register in shutdown tty: xuartps: Improve startup function tty: xuartps: Keep lock for whole ISR tty: xuartps: Acquire port lock for shutdown tty: xuartps: Move RX path into helper function drivers/tty/serial/xilinx_uartps.c | 117 + 1 file changed, 66 insertions(+), 51 deletions(-) -- 2.6.3.3.g9bb996a -- 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 LINUX v5 7/8] tty: xuartps: Acquire port lock for shutdown
Shutting down the UART port can happen while console operations are in progress. Holding the port lock serializes these operations and avoids the UART HW to be disabled in the middle of console prints. Signed-off-by: Soren Brinkmann Reviewed-by: Peter Hurley --- drivers/tty/serial/xilinx_uartps.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index ab3995d00973..f3ac69387b0a 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -826,6 +826,9 @@ static int cdns_uart_startup(struct uart_port *port) static void cdns_uart_shutdown(struct uart_port *port) { int status; + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); /* Disable interrupts */ status = readl(port->membase + CDNS_UART_IMR_OFFSET); @@ -835,6 +838,9 @@ static void cdns_uart_shutdown(struct uart_port *port) /* Disable the TX and RX */ writel(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS, port->membase + CDNS_UART_CR_OFFSET); + + spin_unlock_irqrestore(&port->lock, flags); + free_irq(port->irq, port); } -- 2.6.3.3.g9bb996a -- 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 LINUX v5 4/8] tty: xuartps: Clear interrupt status register in shutdown
When shutting down the UART, clear the interrupt status register. Bits in the ISR are cleared by writing them as '1'. Signed-off-by: Soren Brinkmann Reviewed-by: Peter Hurley Reviewed-by: Moritz Fischer --- v4: - clarify workings of the ISR in the commit message --- drivers/tty/serial/xilinx_uartps.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 6a7cd4e057ae..ef114d7a0623 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -828,6 +828,7 @@ static void cdns_uart_shutdown(struct uart_port *port) /* Disable interrupts */ status = readl(port->membase + CDNS_UART_IMR_OFFSET); writel(status, port->membase + CDNS_UART_IDR_OFFSET); + writel(0x, port->membase + CDNS_UART_ISR_OFFSET); /* Disable the TX and RX */ writel(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS, -- 2.6.3.3.g9bb996a -- 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 LINUX v5 2/8] tty: xuartps: Use spinlock to serialize HW access
Instead of disabling the IRQ, use the spin lock to serialize accesses to the HW. This protects the driver from interference of non-IRQ callbacks with each other and makes the driver more consistent in its serialization method. Signed-off-by: Soren Brinkmann Reviewed-by: Peter Hurley --- drivers/tty/serial/xilinx_uartps.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 50d4082d2354..2c98c357d9a0 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -945,12 +945,10 @@ static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) #ifdef CONFIG_CONSOLE_POLL static int cdns_uart_poll_get_char(struct uart_port *port) { - u32 imr; int c; + unsigned long flags; - /* Disable all interrupts */ - imr = readl(port->membase + CDNS_UART_IMR_OFFSET); - writel(imr, port->membase + CDNS_UART_IDR_OFFSET); + spin_lock_irqsave(&port->lock, flags); /* Check if FIFO is empty */ if (readl(port->membase + CDNS_UART_SR_OFFSET) & CDNS_UART_SR_RXEMPTY) @@ -959,19 +957,16 @@ static int cdns_uart_poll_get_char(struct uart_port *port) c = (unsigned char) readl( port->membase + CDNS_UART_FIFO_OFFSET); - /* Enable interrupts */ - writel(imr, port->membase + CDNS_UART_IER_OFFSET); + spin_unlock_irqrestore(&port->lock, flags); return c; } static void cdns_uart_poll_put_char(struct uart_port *port, unsigned char c) { - u32 imr; + unsigned long flags; - /* Disable all interrupts */ - imr = readl(port->membase + CDNS_UART_IMR_OFFSET); - writel(imr, port->membase + CDNS_UART_IDR_OFFSET); + spin_lock_irqsave(&port->lock, flags); /* Wait until FIFO is empty */ while (!(readl(port->membase + CDNS_UART_SR_OFFSET) & @@ -986,8 +981,7 @@ static void cdns_uart_poll_put_char(struct uart_port *port, unsigned char c) CDNS_UART_SR_TXEMPTY)) cpu_relax(); - /* Enable interrupts */ - writel(imr, port->membase + CDNS_UART_IER_OFFSET); + spin_unlock_irqrestore(&port->lock, flags); return; } -- 2.6.3.3.g9bb996a -- 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 LINUX v5 3/8] tty: xuartps: Don't consider circular buffer when enabling transmitter
Restarting the transmitter even if the circ buffer is empty may be necessary to push out remaining data when the port is restarted after being stopped. Cc: Peter Hurley Signed-off-by: Soren Brinkmann Reviewed-by: Peter Hurley --- v3: - changed this patch to not always enable the transmitter, but keep the check for uart_tx_stopped() in place, as suggested by Peter, whose explanation I also stole for the new commit message (thx) --- drivers/tty/serial/xilinx_uartps.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 2c98c357d9a0..6a7cd4e057ae 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -512,7 +512,7 @@ static void cdns_uart_start_tx(struct uart_port *port) { unsigned int status, numbytes = port->fifosize; - if (uart_circ_empty(&port->state->xmit) || uart_tx_stopped(port)) + if (uart_tx_stopped(port)) return; /* @@ -524,6 +524,9 @@ static void cdns_uart_start_tx(struct uart_port *port) status |= CDNS_UART_CR_TX_EN; writel(status, port->membase + CDNS_UART_CR_OFFSET); + if (uart_circ_empty(&port->state->xmit)) + return; + while (numbytes-- && ((readl(port->membase + CDNS_UART_SR_OFFSET) & CDNS_UART_SR_TXFULL)) != CDNS_UART_SR_TXFULL) { /* Break if no more data available in the UART buffer */ -- 2.6.3.3.g9bb996a -- 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 LINUX v5 1/8] tty: xuartps: Beautify read-modify writes
Non-functional, formatting changes to ease reading the code. Signed-off-by: Soren Brinkmann Reviewed-by: Peter Hurley Reviewed-by: Moritz Fischer --- drivers/tty/serial/xilinx_uartps.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 009e0dbc12d2..50d4082d2354 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -515,12 +515,14 @@ static void cdns_uart_start_tx(struct uart_port *port) if (uart_circ_empty(&port->state->xmit) || uart_tx_stopped(port)) return; - status = readl(port->membase + CDNS_UART_CR_OFFSET); - /* Set the TX enable bit and clear the TX disable bit to enable the + /* +* Set the TX enable bit and clear the TX disable bit to enable the * transmitter. */ - writel((status & ~CDNS_UART_CR_TX_DIS) | CDNS_UART_CR_TX_EN, - port->membase + CDNS_UART_CR_OFFSET); + status = readl(port->membase + CDNS_UART_CR_OFFSET); + status &= ~CDNS_UART_CR_TX_DIS; + status |= CDNS_UART_CR_TX_EN; + writel(status, port->membase + CDNS_UART_CR_OFFSET); while (numbytes-- && ((readl(port->membase + CDNS_UART_SR_OFFSET) & CDNS_UART_SR_TXFULL)) != CDNS_UART_SR_TXFULL) { @@ -1123,8 +1125,9 @@ static void cdns_uart_console_write(struct console *co, const char *s, * clear the TX disable bit to enable the transmitter. */ ctrl = readl(port->membase + CDNS_UART_CR_OFFSET); - writel((ctrl & ~CDNS_UART_CR_TX_DIS) | CDNS_UART_CR_TX_EN, - port->membase + CDNS_UART_CR_OFFSET); + ctrl &= ~CDNS_UART_CR_TX_DIS; + ctrl |= CDNS_UART_CR_TX_EN; + writel(ctrl, port->membase + CDNS_UART_CR_OFFSET); uart_console_write(port, s, count, cdns_uart_console_putchar); cdns_uart_console_wait_tx(port); -- 2.6.3.3.g9bb996a -- 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 LINUX v5 6/8] tty: xuartps: Keep lock for whole ISR
The RX path in the interrupt handler released a lock unnecessarily. Signed-off-by: Soren Brinkmann Reviewed-by: Peter Hurley --- drivers/tty/serial/xilinx_uartps.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 6ffd3bbe3e18..ab3995d00973 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -265,9 +265,7 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) uart_insert_char(port, isrstatus, CDNS_UART_IXR_OVERRUN, data, status); } - spin_unlock(&port->lock); tty_flip_buffer_push(&port->state->port); - spin_lock(&port->lock); } /* Dispatch an appropriate handler */ -- 2.6.3.3.g9bb996a -- 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 v3] Staging: olpc_dcon: Remove obsolete driver
From: Shraddha Barke Remove support for One Laptop Per Child organization since it is dead. http://www.olpcnews.com/about_olpc_news/goodbye_one_laptop_per_child.html Signed-off-by: Shraddha Barke --- Changes in v3 - Nothing. Patch based on correct branch Changes in v2 - Added public mailing list and maintainers MAINTAINERS | 8 - drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/olpc_dcon/Kconfig| 35 -- drivers/staging/olpc_dcon/Makefile | 6 - drivers/staging/olpc_dcon/TODO | 9 - drivers/staging/olpc_dcon/olpc_dcon.c| 813 --- drivers/staging/olpc_dcon/olpc_dcon.h| 111 drivers/staging/olpc_dcon/olpc_dcon_xo_1.c | 205 --- drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c | 161 -- 10 files changed, 1351 deletions(-) delete mode 100644 drivers/staging/olpc_dcon/Kconfig delete mode 100644 drivers/staging/olpc_dcon/Makefile delete mode 100644 drivers/staging/olpc_dcon/TODO delete mode 100644 drivers/staging/olpc_dcon/olpc_dcon.c delete mode 100644 drivers/staging/olpc_dcon/olpc_dcon.h delete mode 100644 drivers/staging/olpc_dcon/olpc_dcon_xo_1.c delete mode 100644 drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c diff --git a/MAINTAINERS b/MAINTAINERS index 9bff63c..a9f58e5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10169,14 +10169,6 @@ L: linux-te...@vger.kernel.org S: Maintained F: drivers/staging/nvec/ -STAGING - OLPC SECONDARY DISPLAY CONTROLLER (DCON) -M: Jens Frederich -M: Daniel Drake -M: Jon Nettleton -W: http://wiki.laptop.org/go/DCON -S: Maintained -F: drivers/staging/olpc_dcon/ - STAGING - PARALLEL LCD/KEYPAD PANEL DRIVER M: Willy Tarreau S: Odd Fixes diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 5d3b86a..6c12a48 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -30,8 +30,6 @@ source "drivers/staging/wlan-ng/Kconfig" source "drivers/staging/comedi/Kconfig" -source "drivers/staging/olpc_dcon/Kconfig" - source "drivers/staging/panel/Kconfig" source "drivers/staging/rtl8192u/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 30918ed..af207f0 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -7,7 +7,6 @@ obj-y += media/ obj-$(CONFIG_SLICOSS) += slicoss/ obj-$(CONFIG_PRISM2_USB) += wlan-ng/ obj-$(CONFIG_COMEDI) += comedi/ -obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon/ obj-$(CONFIG_PANEL)+= panel/ obj-$(CONFIG_RTL8192U) += rtl8192u/ obj-$(CONFIG_RTL8192E) += rtl8192e/ diff --git a/drivers/staging/olpc_dcon/Kconfig b/drivers/staging/olpc_dcon/Kconfig deleted file mode 100644 index d277f04..000 --- a/drivers/staging/olpc_dcon/Kconfig +++ /dev/null @@ -1,35 +0,0 @@ -config FB_OLPC_DCON - tristate "One Laptop Per Child Display CONtroller support" - depends on OLPC && FB - depends on I2C - depends on (GPIO_CS5535 || GPIO_CS5535=n) - select BACKLIGHT_CLASS_DEVICE - ---help--- - In order to support very low power operation, the XO laptop uses a - secondary Display CONtroller, or DCON. This secondary controller - is present in the video pipeline between the primary display - controller (integrate into the processor or chipset) and the LCD - panel. It allows the main processor/display controller to be - completely powered off while still retaining an image on the display. - This controller is only available on OLPC platforms. Unless you have - one of these platforms, you will want to say 'N'. - -config FB_OLPC_DCON_1 - bool "OLPC XO-1 DCON support" - depends on FB_OLPC_DCON && GPIO_CS5535 - default y - ---help--- - Enable support for the DCON in XO-1 model laptops. The kernel - communicates with the DCON using model-specific code. If you - have an XO-1 (or if you're unsure what model you have), you should - say 'Y'. - -config FB_OLPC_DCON_1_5 - bool "OLPC XO-1.5 DCON support" - depends on FB_OLPC_DCON && ACPI - default y - ---help--- - Enable support for the DCON in XO-1.5 model laptops. The kernel - communicates with the DCON using model-specific code. If you - have an XO-1.5 (or if you're unsure what model you have), you - should say 'Y'. diff --git a/drivers/staging/olpc_dcon/Makefile b/drivers/staging/olpc_dcon/Makefile deleted file mode 100644 index 36c7e67..000 --- a/drivers/staging/olpc_dcon/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -olpc-dcon-objs += olpc_dcon.o -olpc-dcon-$(CONFIG_FB_OLPC_DCON_1) += olpc_dcon_xo_1.o -olpc-dcon-$(CONFIG_FB_OLPC_DCON_1_5) += olpc_dcon_xo_1_5.o -obj-$(CONFIG_FB_OLPC_DCON) += olpc-dcon.o -
[PATCH 1/1] fix a dead loop when in heavy low memory
Android System UI hang when run heavy monkey stress test. monkey stress test script: adb shell "monkey --ignore-crashes --ignore-timeouts --kill-process-after-error --ignore-security-exceptions --throttle 200 -v 2000" kernel log: [ 1526.272125] lowmem_scan start: 128, 213da, ofree -9849 34419, ma 529 [ 1526.272260] lowmemorykiller: select 'dTi-lm' (27289), adj 647, size 10630, to kill [ 1526.272299] lowmem_d_timeout=4296194081 [ 1526.272303] Killing 'dTi-lm' (27289), adj 647, [ 1526.272303]to free 42520kB on behalf of 'servicemanager' (2365) because [ 1526.272303]cache 137676kB is below limit 221184kB for oom_score_adj 529 [ 1526.272303]Free memory is -39396kB above reserved [ 1526.272304] lowmem_scan end: 128, 213da, return 10630 [ 1526.272710] lowmem_scan start: 128, 213da, ofree -9849 34373, ma 529 [ 1526.272832] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193081, 4296194081 [ 1526.274450] lowmem_scan start: 128, 280da, ofree -9601 34327, ma 529 [ 1526.274695] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193083, 4296194081 [ 1526.282292] lowmem_scan start: 128, 213da, ofree -9703 34327, ma 529 [ 1526.282727] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193090, 4296194081 [ 1526.316888] lowmem_scan start: 128, 213da, ofree -9766 34465, ma 529 [ 1526.317019] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193125, 4296194081 [ 1526.319311] lowmem_scan start: 128, 213da, ofree -9856 34419, ma 529 [ 1526.319442] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193125, 4296194081 [ 1526.322026] lowmem_scan start: 128, 280da, ofree -9841 34327, ma 529 [ 1526.360831] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193166, 4296194081 [ 1526.532233] lowmem_scan start: 128, 213da, ofree -9846 34511, ma 529 [ 1526.644046] lowmem_scan start: 128, 213da, ofree -9785 34235, ma 529 [ 1527.437578] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296194246, 4296195109 [ 1527.442559] lowmem_scan start: 128, 213da, ofree -9850 41884, ma 529 [ 1527.459540] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296194268, 4296195109 [ 1527.500352] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296194309, 4296195109 when this happened, the android system UI will hang, no process can be select to kill. i found the the value of "lowmem_deathpending_timeout" will be modified strangely, like in last killing, the value is 4296194081, but why not it had changed to 4296195109? so it will cause the deadloop in low memory state which will cause the android system UI hang, because no process will be kill. commit e5d7965f88a3 ("staging: android: lowmemorykiller: Don't wait more than one second for a process to die") said wait 1 seconds, i think it no need to wait 1 second, because we do select the process with "TIF_MEMDIE" to kill. Signed-off-by: Figo --- drivers/staging/android/lowmemorykiller.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index e679d84..13c7182 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -59,8 +59,6 @@ static int lowmem_minfree[6] = { }; static int lowmem_minfree_size = 4; -static unsigned long lowmem_deathpending_timeout; - #define lowmem_print(level, x...) \ do {\ if (lowmem_debug_level >= (level)) \ @@ -128,11 +126,9 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) if (!p) continue; - if (test_tsk_thread_flag(p, TIF_MEMDIE) && - time_before_eq(jiffies, lowmem_deathpending_timeout)) { + if (test_tsk_thread_flag(p, TIF_MEMDIE)) { task_unlock(p); - rcu_read_unlock(); - return 0; + continue; } oom_score_adj = p->signal->oom_score_adj; if (oom_score_adj < min_score_adj) { @@ -170,7 +166,6 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) lowmem_print(1, "send sigkill to %d (%s), adj %hd, size %d\n", selected->pid, selected->comm, selected_oom_score_adj, selected_tasksize); - lowmem_deathpending_timeout = jiffies + HZ; rem += selected_tasksize; } -- 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 1/1] fix a dead loop when in heavy low memory
Android System UI hang when run heavy monkey stress test. monkey stress test script: adb shell "monkey --ignore-crashes --ignore-timeouts --kill-process-after-error --ignore-security-exceptions --throttle 200 -v 2000" kernel log: [ 1526.272125] lowmem_scan start: 128, 213da, ofree -9849 34419, ma 529 [ 1526.272260] lowmemorykiller: select 'dTi-lm' (27289), adj 647, size 10630, to kill [ 1526.272299] lowmem_d_timeout=4296194081 [ 1526.272303] Killing 'dTi-lm' (27289), adj 647, [ 1526.272303]to free 42520kB on behalf of 'servicemanager' (2365) because [ 1526.272303]cache 137676kB is below limit 221184kB for oom_score_adj 529 [ 1526.272303]Free memory is -39396kB above reserved [ 1526.272304] lowmem_scan end: 128, 213da, return 10630 [ 1526.272710] lowmem_scan start: 128, 213da, ofree -9849 34373, ma 529 [ 1526.272832] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193081, 4296194081 [ 1526.274450] lowmem_scan start: 128, 280da, ofree -9601 34327, ma 529 [ 1526.274695] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193083, 4296194081 [ 1526.282292] lowmem_scan start: 128, 213da, ofree -9703 34327, ma 529 [ 1526.282727] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193090, 4296194081 [ 1526.316888] lowmem_scan start: 128, 213da, ofree -9766 34465, ma 529 [ 1526.317019] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193125, 4296194081 [ 1526.319311] lowmem_scan start: 128, 213da, ofree -9856 34419, ma 529 [ 1526.319442] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193125, 4296194081 [ 1526.322026] lowmem_scan start: 128, 280da, ofree -9841 34327, ma 529 [ 1526.360831] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193166, 4296194081 [ 1526.532233] lowmem_scan start: 128, 213da, ofree -9846 34511, ma 529 [ 1526.644046] lowmem_scan start: 128, 213da, ofree -9785 34235, ma 529 [ 1527.437578] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296194246, 4296195109 [ 1527.442559] lowmem_scan start: 128, 213da, ofree -9850 41884, ma 529 [ 1527.459540] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296194268, 4296195109 [ 1527.500352] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296194309, 4296195109 when this happened, the android system UI will hang, no process can be select to kill. i found the the value of "lowmem_deathpending_timeout" will be modified strangely, like in last killing, the value is 4296194081, but why not it had changed to 4296195109? so it will cause the deadloop in low memory state which will cause the android system UI hang, because no process will be kill. commit e5d7965f88a3 ("staging: android: lowmemorykiller: Don't wait more than one second for a process to die") said wait 1 seconds, i think it no need to wait 1 second, because we don't select the process with "TIF_MEMDIE" to kill. Signed-off-by: Figo --- drivers/staging/android/lowmemorykiller.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index e679d84..13c7182 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -59,8 +59,6 @@ static int lowmem_minfree[6] = { }; static int lowmem_minfree_size = 4; -static unsigned long lowmem_deathpending_timeout; - #define lowmem_print(level, x...) \ do {\ if (lowmem_debug_level >= (level)) \ @@ -128,11 +126,9 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) if (!p) continue; - if (test_tsk_thread_flag(p, TIF_MEMDIE) && - time_before_eq(jiffies, lowmem_deathpending_timeout)) { + if (test_tsk_thread_flag(p, TIF_MEMDIE)) { task_unlock(p); - rcu_read_unlock(); - return 0; + continue; } oom_score_adj = p->signal->oom_score_adj; if (oom_score_adj < min_score_adj) { @@ -170,7 +166,6 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) lowmem_print(1, "send sigkill to %d (%s), adj %hd, size %d\n", selected->pid, selected->comm, selected_oom_score_adj, selected_tasksize); - lowmem_deathpending_timeout = jiffies + HZ; rem += selected_tasksize; } -- 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] wl1251: add sysfs interface for bluetooth coexistence mode configuration
Port the bt_coex_mode sysfs interface from wl1251 driver version included in the Maemo Fremantle kernel to allow bt-coexistence mode configuration. This enables userspace applications to set one of the modes WL1251_BT_COEX_OFF, WL1251_BT_COEX_ENABLE and WL1251_BT_COEX_MONOAUDIO. The default mode is WL1251_BT_COEX_OFF. It should be noted that this driver always enabled bt-coexistence before and enabled bt-coexistence directly affects the receiving performance, rendering it unusable in some low-signal situations. Especially monitor mode is affected very badly with bt-coexistence enabled. Signed-off-by: David Gnedt Signed-off-by: Pali Rohár --- I'm resending this patch for review again as after two years there is no nl80211 interface for bt coex and wl1251 on Nokia N900 needs it. Once there will be common interface for bt coex I can rewrite my patches, but I do not want to wait another 2 years... Changes: In v2 is sysfs node attached directly to wl1251 device instead of creating new platform device for sysfs node. So sysfs node is now available at: /sys/class/net/wlan0/device/bt_coex_mode --- drivers/net/wireless/ti/wl1251/acx.c| 43 ++-- drivers/net/wireless/ti/wl1251/acx.h|8 +-- drivers/net/wireless/ti/wl1251/init.c |6 +-- drivers/net/wireless/ti/wl1251/main.c | 84 +++ drivers/net/wireless/ti/wl1251/wl1251.h |8 +++ 5 files changed, 137 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c index d6fbdda..a119d77 100644 --- a/drivers/net/wireless/ti/wl1251/acx.c +++ b/drivers/net/wireless/ti/wl1251/acx.c @@ -539,7 +539,7 @@ out: return ret; } -int wl1251_acx_sg_enable(struct wl1251 *wl) +int wl1251_acx_sg_enable(struct wl1251 *wl, u8 mode) { struct acx_bt_wlan_coex *pta; int ret; @@ -550,7 +550,7 @@ int wl1251_acx_sg_enable(struct wl1251 *wl) if (!pta) return -ENOMEM; - pta->enable = SG_ENABLE; + pta->enable = mode; ret = wl1251_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta)); if (ret < 0) { @@ -563,7 +563,7 @@ out: return ret; } -int wl1251_acx_sg_cfg(struct wl1251 *wl) +int wl1251_acx_sg_cfg(struct wl1251 *wl, u16 wake_up_beacon) { struct acx_bt_wlan_coex_param *param; int ret; @@ -586,7 +586,7 @@ int wl1251_acx_sg_cfg(struct wl1251 *wl) param->wlan_cycle_fast = PTA_CYCLE_TIME_FAST_DEF; param->bt_anti_starvation_period = PTA_ANTI_STARVE_PERIOD_DEF; param->next_bt_lp_packet = PTA_TIMEOUT_NEXT_BT_LP_PACKET_DEF; - param->wake_up_beacon = PTA_TIME_BEFORE_BEACON_DEF; + param->wake_up_beacon = wake_up_beacon; param->hp_dm_max_guard_time = PTA_HPDM_MAX_TIME_DEF; param->next_wlan_packet = PTA_TIME_OUT_NEXT_WLAN_DEF; param->antenna_type = PTA_ANTENNA_TYPE_DEF; @@ -615,6 +615,41 @@ out: return ret; } +int wl1251_acx_sg_configure(struct wl1251 *wl, bool force) +{ + int ret; + + if (wl->state == WL1251_STATE_OFF && !force) + return 0; + + switch (wl->bt_coex_mode) { + case WL1251_BT_COEX_OFF: + ret = wl1251_acx_sg_enable(wl, SG_DISABLE); + if (ret) + break; + ret = wl1251_acx_sg_cfg(wl, 0); + break; + case WL1251_BT_COEX_ENABLE: + ret = wl1251_acx_sg_enable(wl, SG_ENABLE); + if (ret) + break; + ret = wl1251_acx_sg_cfg(wl, PTA_TIME_BEFORE_BEACON_DEF); + break; + case WL1251_BT_COEX_MONOAUDIO: + ret = wl1251_acx_sg_enable(wl, SG_ENABLE); + if (ret) + break; + ret = wl1251_acx_sg_cfg(wl, PTA_TIME_BEFORE_BEACON_MONO_AUDIO); + break; + default: + wl1251_error("Invalid BT co-ex mode!"); + ret = -EOPNOTSUPP; + break; + } + + return ret; +} + int wl1251_acx_cca_threshold(struct wl1251 *wl) { struct acx_energy_detection *detection; diff --git a/drivers/net/wireless/ti/wl1251/acx.h b/drivers/net/wireless/ti/wl1251/acx.h index 2bdec38..820573c 100644 --- a/drivers/net/wireless/ti/wl1251/acx.h +++ b/drivers/net/wireless/ti/wl1251/acx.h @@ -558,7 +558,8 @@ struct acx_bt_wlan_coex { #define PTA_ANTI_STARVE_PERIOD_DEF (500) #define PTA_ANTI_STARVE_NUM_CYCLE_DEF(4) #define PTA_ALLOW_PA_SD_DEF (1) -#define PTA_TIME_BEFORE_BEACON_DEF (6300) +#define PTA_TIME_BEFORE_BEACON_DEF (500) +#define PTA_TIME_BEFORE_BEACON_MONO_AUDIO (6300) #define PTA_HPDM_MAX_TIME_DEF(1600) #define PTA_TIME_OUT_NEXT_WLAN_DEF (2550) #define PTA_AUTO_MODE_NO_CTS_DEF (0) @@ -1470,8 +1471,9 @@ int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 rts_threshold); int wl1251_acx_beacon_filter_opt(struct wl1251 *wl, bool enable_
[PATCH v2 1/1] fix a dead loop when in heavy low memory
Android System UI hang when run heavy monkey stress test. Run this monkey stress test script with more than 100 apps/games installed: adb shell "monkey --ignore-crashes --ignore-timeouts --kill-process-after-error --ignore-security-exceptions --throttle 200 -v 2000" kernel log: [ 1526.272125] lowmem_scan start: 128, 213da, ofree -9849 34419, ma 529 [ 1526.272260] lowmemorykiller: select 'dTi-lm' (27289), adj 647, size 10630, to kill [ 1526.272299] lowmem_d_timeout=4296194081 [ 1526.272303] Killing 'dTi-lm' (27289), adj 647, [ 1526.272303]to free 42520kB on behalf of 'servicemanager' (2365) because [ 1526.272303]cache 137676kB is below limit 221184kB for oom_score_adj 529 [ 1526.272303]Free memory is -39396kB above reserved [ 1526.272304] lowmem_scan end: 128, 213da, return 10630 [ 1526.272710] lowmem_scan start: 128, 213da, ofree -9849 34373, ma 529 [ 1526.272832] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193081, 4296194081 [ 1526.274450] lowmem_scan start: 128, 280da, ofree -9601 34327, ma 529 [ 1526.274695] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193083, 4296194081 [ 1526.282292] lowmem_scan start: 128, 213da, ofree -9703 34327, ma 529 [ 1526.282727] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193090, 4296194081 [ 1526.316888] lowmem_scan start: 128, 213da, ofree -9766 34465, ma 529 [ 1526.317019] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193125, 4296194081 [ 1526.319311] lowmem_scan start: 128, 213da, ofree -9856 34419, ma 529 [ 1526.319442] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193125, 4296194081 [ 1526.322026] lowmem_scan start: 128, 280da, ofree -9841 34327, ma 529 [ 1526.360831] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296193166, 4296194081 [ 1526.532233] lowmem_scan start: 128, 213da, ofree -9846 34511, ma 529 [ 1526.644046] lowmem_scan start: 128, 213da, ofree -9785 34235, ma 529 [ 1527.437578] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296194246, 4296195109 [ 1527.442559] lowmem_scan start: 128, 213da, ofree -9850 41884, ma 529 [ 1527.459540] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296194268, 4296195109 [ 1527.500352] lowmem: TIF_MEMDIE, adj=647, dTi-lm, jiffies=4296194309, 4296195109 when this happened, the android system UI will hang, no process can be select to kill. i found the the value of "lowmem_deathpending_timeout" will be modified strangely, like in last killing, the value is 4296194081, but why not it had changed to 4296195109? so it will cause the deadloop in low memory state which will cause the android system UI hang, because no process will be kill. commit e5d7965f88a3 ("staging: android: lowmemorykiller: Don't wait more than one second for a process to die") said wait 1 seconds, i think it no need to wait 1 second, because we don't select the process with "TIF_MEMDIE" to kill. Signed-off-by: Figo --- drivers/staging/android/lowmemorykiller.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index e679d84..13c7182 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -59,8 +59,6 @@ static int lowmem_minfree[6] = { }; static int lowmem_minfree_size = 4; -static unsigned long lowmem_deathpending_timeout; - #define lowmem_print(level, x...) \ do {\ if (lowmem_debug_level >= (level)) \ @@ -128,11 +126,9 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) if (!p) continue; - if (test_tsk_thread_flag(p, TIF_MEMDIE) && - time_before_eq(jiffies, lowmem_deathpending_timeout)) { + if (test_tsk_thread_flag(p, TIF_MEMDIE)) { task_unlock(p); - rcu_read_unlock(); - return 0; + continue; } oom_score_adj = p->signal->oom_score_adj; if (oom_score_adj < min_score_adj) { @@ -170,7 +166,6 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) lowmem_print(1, "send sigkill to %d (%s), adj %hd, size %d\n", selected->pid, selected->comm, selected_oom_score_adj, selected_tasksize); - lowmem_deathpending_timeout = jiffies + HZ; rem += selected_tasksize; } -- 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: [GIT PULL] parisc huge page support for v4.4
On Tue, 24 Nov 2015, Mikulas Patocka wrote: > > > On Tue, 24 Nov 2015, Helge Deller wrote: > > > * Mikulas Patocka : > > > > > > > > > On Tue, 24 Nov 2015, Helge Deller wrote: > > > > > > > > Hi > > > > > > > > > > Since the kernel 4.4-rc2 I'm getting frequent boot failures on > > > > > PA-RISC. > > > > > When I revert this patchset, the crashes are gone. > > > > > > > > > [3.29] CPU(s): 4 out of 4 PA8900 (Shortfin) at 1000.00 > > > > > MHz online > > > > > > > > Hi Mikulas, > > > > > > > > Yes, I've seen this as well. > > > > It affects only the PA8900 CPUs, while all PA8500-PA8700 machines seem > > > > to work fine. > > > > I do have a temporary 3-line patch to avoid the crashes which I'll push > > > > to my tree shortly. > > > > I'm still investigating why it only affects the PA8900 CPUs, but I > > > > assume > > > > it's related to the cache aliasing of those CPUs. > > > > I'll keep you updated. > > > > > > > > Helge > > > > > > The PA-RISC specification doesn't allow aliasing on non-equaivalent > > > addresses. Can the kernel map a piece of kernel data to other virtual > > > address? If yes, we can't use big pages to map kernel data. > > > > Can you please try the two patches below? > > The first one disables mapping kernel text/data on huge pages on > > PA8800/PA8900 CPUs. Patch works for me on my Mako PA8800. > > > > Independend of my huge page patch the second patch disables the tlb > > flush optimization we added earlier. It seems calling flush_tlb_all() > > doesn't reliably flushes tlbs on all CPUs so it's better to fall back to > > the loop implementation. > > > > Helge > > The kernel with these patches works fine so far. > > Mikulas BTW. I looked at this in arch/parisc/mm/hugetlbpage.c:set_huge_pte_at "*ptep = entry;" and it seems like a bad bug. PA-RISC doesn't have atomic instructions to modify page table entries, so it takes spinlock in the TLB handler and modifies the page table entry non-atomically. If you modify the page table entry without the spinlock, you may race with TLB handler on another CPU and your modification may be lost. The comment says something about double locking on pa_tlb_lock, but pa_tlb_lock isn't held when that function is called. Mikulas -- 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] init, Documentation: Remove ramdisk_blocksize mentions
On Wed, 23 Dec 2015 18:28:49 -0600 Robert Elliott wrote: > The brd driver has never supported the ramdisk_blocksize kernel > parameter that was in the rd driver it replaced, so remove > mention of this parameter from comments and Documentation. > > Commit 9db5579be4bb ("rewrite rd") replaced rd with brd, keeping > a brd_blocksize variable in struct brd_device but never using it. > > Commit a2cba2913c76 ("brd: get rid of unused members from struct > brd_device") removed the unused variable. init/do_mounts_rd.c is a bit outside of the normal docs maintainer beat, but there doesn't seem to be anybody else who should take this either, so I've applied it to the docs tree. Thanks, jon -- 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/
timerfd_settime/timerfd_gettime issue ?
Hi Thomas, I see a strange behavior on the parisc platform, for which I'm not sure if it's intended or if there is a bug somewhere. The program calls timerfd_settime() and sets a timer (e.g. sec=0, nsec=1). Directly after setting the timer it calls timerfd_gettime() and receives (sec=0, nsec=103914413). The second nsec is higher than the initial nsec value which was set. Does timerfd_settime() maybe tries to add the initial time it takes to start the timer? Any idea or hint? Thanks, Helge Background: I'm debugging the build-failure on debian for the liblinux-fd-perl package: https://buildd.debian.org/status/fetch.php?pkg=liblinux-fd-perl&arch=hppa&ver=0.011-1&stamp=1443355593 Here is a log which I get from kernel after adding some printks. The problematic line is #3. [ 465.888000] timerfd_settime: interval (sec=0, nsec=0) it_value (sec=0, nsec=1) [ 466.196000] timerfd_settime: interval (sec=0, nsec=1) it_value (sec=0, nsec=1) [ 466.30] timerfd_gettime: interval (sec=0, nsec=1) it_value (sec=0, nsec=103914413) [ 466.404000] timerfd_gettime: interval (sec=0, nsec=1) it_value (sec=0, nsec=97444552) [ 466.508000] timerfd_gettime: interval (sec=0, nsec=1) it_value (sec=0, nsec=92611704) [ 466.616000] timerfd_gettime: interval (sec=0, nsec=1) it_value (sec=0, nsec=87376859) [ 466.72] timerfd_gettime: interval (sec=0, nsec=1) it_value (sec=0, nsec=82538534) [ 466.824000] timerfd_gettime: interval (sec=0, nsec=1) it_value (sec=0, nsec=77293289) [ 466.928000] timerfd_gettime: interval (sec=0, nsec=1) it_value (sec=0, nsec=72501584) [ 467.036000] timerfd_gettime: interval (sec=0, nsec=1) it_value (sec=0, nsec=67377673) [ 467.14] timerfd_gettime: interval (sec=0, nsec=1) it_value (sec=0, nsec=62631601) [ 467.244000] timerfd_gettime: interval (sec=0, nsec=1) it_value (sec=0, nsec=57401824) -- 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: [GIT PULL] parisc huge page support for v4.4
On 26.12.2015 13:09, Mikulas Patocka wrote: >> On Tue, 24 Nov 2015, Helge Deller wrote: >>> * Mikulas Patocka : On Tue, 24 Nov 2015, Helge Deller wrote: >> Hi >> >> Since the kernel 4.4-rc2 I'm getting frequent boot failures on PA-RISC. >> When I revert this patchset, the crashes are gone. > >> [3.29] CPU(s): 4 out of 4 PA8900 (Shortfin) at 1000.00 MHz >> online > > Hi Mikulas, > > Yes, I've seen this as well. > It affects only the PA8900 CPUs, while all PA8500-PA8700 machines seem to > work fine. > I do have a temporary 3-line patch to avoid the crashes which I'll push > to my tree shortly. > I'm still investigating why it only affects the PA8900 CPUs, but I assume > it's related to the cache aliasing of those CPUs. > I'll keep you updated. > > Helge The PA-RISC specification doesn't allow aliasing on non-equaivalent addresses. Can the kernel map a piece of kernel data to other virtual address? If yes, we can't use big pages to map kernel data. >>> >>> Can you please try the two patches below? >>> The first one disables mapping kernel text/data on huge pages on >>> PA8800/PA8900 CPUs. Patch works for me on my Mako PA8800. >>> >>> Independend of my huge page patch the second patch disables the tlb >>> flush optimization we added earlier. It seems calling flush_tlb_all() >>> doesn't reliably flushes tlbs on all CPUs so it's better to fall back to >>> the loop implementation. >>> >>> Helge >> >> The kernel with these patches works fine so far. >> >> Mikulas > > BTW. I looked at this in arch/parisc/mm/hugetlbpage.c:set_huge_pte_at > "*ptep = entry;" and it seems like a bad bug. PA-RISC doesn't have atomic > instructions to modify page table entries, so it takes spinlock in the TLB > handler and modifies the page table entry non-atomically. If you modify > the page table entry without the spinlock, you may race with TLB handler > on another CPU and your modification may be lost. Right. > The comment says something about double locking on pa_tlb_lock, but > pa_tlb_lock isn't held when that function is called. I have a work-in-progress patch for that in one of my trees, e.g.: http://git.kernel.org/cgit/linux/kernel/git/deller/parisc-linux.git/commit/?h=parisc-next&id=5c76b525cbdb097401f46522b27b1eb6244f34f9 It's lightly tested though. Helge -- 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] iio: qcom-spmi-vadc: One check less in vadc_measure_ref_points() after error detection
From: Markus Elfring Date: Sat, 26 Dec 2015 13:53:15 +0100 This issue was detected by using the Coccinelle software. Move the jump label directly before the desired log statement so that the variable "ret" does not need to be checked once more after it was determined that a function call failed. Signed-off-by: Markus Elfring --- drivers/iio/adc/qcom-spmi-vadc.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c index c2babe5..391eefa 100644 --- a/drivers/iio/adc/qcom-spmi-vadc.c +++ b/drivers/iio/adc/qcom-spmi-vadc.c @@ -424,7 +424,7 @@ static int vadc_measure_ref_points(struct vadc_priv *vadc) prop = vadc_get_channel(vadc, VADC_REF_1250MV); ret = vadc_do_conversion(vadc, prop, &read_1); if (ret) - goto err; + goto report_failure; /* Try with buffered 625mV channel first */ prop = vadc_get_channel(vadc, VADC_SPARE1); @@ -433,11 +433,11 @@ static int vadc_measure_ref_points(struct vadc_priv *vadc) ret = vadc_do_conversion(vadc, prop, &read_2); if (ret) - goto err; + goto report_failure; if (read_1 == read_2) { ret = -EINVAL; - goto err; + goto report_failure; } vadc->graph[VADC_CALIB_ABSOLUTE].dy = read_1 - read_2; @@ -447,23 +447,24 @@ static int vadc_measure_ref_points(struct vadc_priv *vadc) prop = vadc_get_channel(vadc, VADC_VDD_VADC); ret = vadc_do_conversion(vadc, prop, &read_1); if (ret) - goto err; + goto report_failure; prop = vadc_get_channel(vadc, VADC_GND_REF); ret = vadc_do_conversion(vadc, prop, &read_2); if (ret) - goto err; + goto report_failure; if (read_1 == read_2) { ret = -EINVAL; - goto err; + goto report_failure; } vadc->graph[VADC_CALIB_RATIOMETRIC].dy = read_1 - read_2; vadc->graph[VADC_CALIB_RATIOMETRIC].gnd = read_2; -err: - if (ret) + if (ret) { +report_failure: dev_err(vadc->dev, "measure reference points failed\n"); + } return ret; } -- 2.6.3 -- 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] include/linux/amd-iommu.h: Move to arch/x86/include/asm
From: Chen Gang It is architecture specific mechanism header, not generic header, so move it to arch/x86/include/asm. ALso change all related contents for it. Signed-off-by: Chen Gang --- MAINTAINERS | 2 +- {include/linux => arch/x86/include/asm}/amd-iommu.h | 0 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_process.c| 2 +- drivers/iommu/amd_iommu.c | 2 +- drivers/iommu/amd_iommu_init.c | 2 +- drivers/iommu/amd_iommu_v2.c| 2 +- 7 files changed, 6 insertions(+), 6 deletions(-) rename {include/linux => arch/x86/include/asm}/amd-iommu.h (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 44666b1..893cf07 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -656,7 +656,7 @@ L: io...@lists.linux-foundation.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git S: Maintained F: drivers/iommu/amd_iommu*.[ch] -F: include/linux/amd-iommu.h +F: arch/x86/include/asm/amd-iommu.h AMD KFD M: Oded Gabbay diff --git a/include/linux/amd-iommu.h b/arch/x86/include/asm/amd-iommu.h similarity index 100% rename from include/linux/amd-iommu.h rename to arch/x86/include/asm/amd-iommu.h diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c index 3f95f7c..bcbbabd 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c @@ -20,7 +20,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include +#include #include #include #include diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index 9be0070..a268799 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 8b2be1e..fea3056 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 013bdff..f7eee70 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c index c865737..e6584fe 100644 --- a/drivers/iommu/amd_iommu_v2.c +++ b/drivers/iommu/amd_iommu_v2.c @@ -17,7 +17,7 @@ */ #include -#include +#include #include #include #include -- 1.9.3 -- 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] kernel: rcu: tree: Remove useless rcu_data_p when !PREEMPT_RCU
From: Chen Gang The related warning from gcc 6.0: In file included from kernel/rcu/tree.c:4630:0: kernel/rcu/tree_plugin.h:810:40: warning: ‘rcu_data_p’ defined but not used [-Wunused-const-variable] static struct rcu_data __percpu *const rcu_data_p = &rcu_sched_data; ^~ Also remove always redundant rcu_data_p in tree.c. Signed-off-by: Chen Gang --- kernel/rcu/tree.c| 1 - kernel/rcu/tree_plugin.h | 1 - 2 files changed, 2 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 3a8856f..ed85d66 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -108,7 +108,6 @@ RCU_STATE_INITIALIZER(rcu_sched, 's', call_rcu_sched); RCU_STATE_INITIALIZER(rcu_bh, 'b', call_rcu_bh); static struct rcu_state *const rcu_state_p; -static struct rcu_data __percpu *const rcu_data_p; LIST_HEAD(rcu_struct_flavors); /* Dump rcu_node combining tree at boot to verify correct setup. */ diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 9467a8b..e6b88ad 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -807,7 +807,6 @@ void exit_rcu(void) #else /* #ifdef CONFIG_PREEMPT_RCU */ static struct rcu_state *const rcu_state_p = &rcu_sched_state; -static struct rcu_data __percpu *const rcu_data_p = &rcu_sched_data; /* * Tell them what RCU they are running. -- 1.9.3 -- 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 V2 1/3] ARM: multi_v7_defconfig: Enable beaglebone PMIC TPS65217
Hi, On Tue, Dec 22, 2015 at 11:31:52AM -0800, Olof Johansson wrote: > On Wed, Dec 16, 2015 at 07:15:41PM +0530, Afzal Mohammed wrote: > > That patch didn't get a reply at all, hence assuming that it won't be > > picked & don't want to create a noise on that silent thread ;), but if > > it gets applied, i will fight against my patch :) > > As mentioned in the earlier reply, don't assume a patch that hasn't been > applied yet won't be -- please follow up with a redaction of it if that's what > you want. Since I go through my mail folder in chronological order, I come > across your patch first and will apply it when I get to it. i will keep this in mind the next time. Another reason that made me hesitant to ping either in positive of negative was that it was a trivial one. Thanks Olof. Regards afzal > > Anyway, not a big deal since the contents is the same. -- 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] arch/x86/kernel/ptrace.c: Remove redundant arg_offs_table
From: Chen Gang The related warning from gcc 6.0: arch/x86/kernel/ptrace.c:127:18: warning: ‘arg_offs_table’ defined but not used [-Wunused-const-variable] static const int arg_offs_table[] = { ^~ Signed-off-by: Chen Gang --- arch/x86/kernel/ptrace.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 558f50e..32e9d9c 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c @@ -124,21 +124,6 @@ const char *regs_query_register_name(unsigned int offset) return NULL; } -static const int arg_offs_table[] = { -#ifdef CONFIG_X86_32 - [0] = offsetof(struct pt_regs, ax), - [1] = offsetof(struct pt_regs, dx), - [2] = offsetof(struct pt_regs, cx) -#else /* CONFIG_X86_64 */ - [0] = offsetof(struct pt_regs, di), - [1] = offsetof(struct pt_regs, si), - [2] = offsetof(struct pt_regs, dx), - [3] = offsetof(struct pt_regs, cx), - [4] = offsetof(struct pt_regs, r8), - [5] = offsetof(struct pt_regs, r9) -#endif -}; - /* * does not yet catch signals sent when the child dies. * in exit.c or in signal.c. -- 1.9.3 -- 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: [PATCHV5 3/3] x86, ras: Add __mcsafe_copy() function to recover from machine checks
On Dec 26, 2015 6:33 PM, "Borislav Petkov" wrote: > > On Fri, Dec 25, 2015 at 08:05:39PM +, Luck, Tony wrote: > > mce_in_kernel_recov() should check whether we have a fix up entry for > > the specific IP that hit the machine check before rating the severity > > as kernel recoverable. > > Yeah, it is not precise right now. But this is easy - I'll change it to > a simpler version of fixup_mcexception() to iterate over the exception > table. > > > If we add more functions (for different cache behaviour, or to > > optimize for specific processor model) we can make sure to put them > > all together inside begin/end labels. > > Yeah, I think we can do even better than that as all the info is in the > ELF file already. For example, ENDPROC(__mcsafe_copy) generates > > .type __mcsafe_copy, @function ; .size __mcsafe_copy, .-__mcsafe_copy > > and there's the size of the function, I guess we can macroize something > like that or even parse the ELF file: > > $ readelf --syms vmlinux | grep mcsafe >706: 819df73e14 OBJECT LOCAL DEFAULT 11 > __kstrtab___mcsafe_copy >707: 819d0e18 8 OBJECT LOCAL DEFAULT9 > __kcrctab___mcsafe_copy > 56107: 819b3bb016 OBJECT GLOBAL DEFAULT7 > __ksymtab___mcsafe_copy > 58581: 812e6d70 179 FUNCGLOBAL DEFAULT1 __mcsafe_copy > 62233: 3313f9d4 0 NOTYPE GLOBAL DEFAULT ABS __crc___mcsafe_copy > 68818: 812e6e23 0 NOTYPE GLOBAL DEFAULT1 __mcsafe_copy_end > > __mcsafe_copy is of size 179 bytes: > > 0x812e6d70 + 179 = 0x812e6e23 which is __mcsafe_copy_end > so those labels should not really be necessary as they're global and > polluting the binary unnecessarily. > > > We would run into trouble if we want to have some in-line macros for > > use from arbitrary C-code like we have for the page fault case. > > Example? > > > I might make the arbitrary %rax value be #PF and #MC to reflect the > > h/w fault that got us here rather than -EINVAL/-EFAULT. But that's > > just bike shedding. > > Yeah, I picked those arbitrarily to show the intention. > > > But now we are back to having the fault handler poke %rax again, which > > made Andy twitch before. > > Andy, why is that? It makes the exception handling much simpler this way... > I like the idea of moving more logic into C, but I don't like splitting the logic across files and adding nasty special cases like this. But what if we generalized it? An extable entry gives a fault IP and a landing pad IP. Surely we can squeeze a flag bit in there. If you set the bit, you get an extended extable entry. Instead of storing a landing pad, it stores a pointer to a handler descriptor: struct extable_handler { bool (*handler)(struct pt_regs *, struct extable_handler *, ...): }; handler returns true if it handled the error and false if it didn't. The "..." encodes the fault number, error code, cr2, etc. Maybe it would be "unsigned long exception, const struct extable_info *info" where extable_info contains a union? I really wish C would grow up and learn about union types. Now the copy routine can do whatever it pleases, in C, locally. For example, if you set up a full stack frame (or even just a known SP offset), you could unwind it in C and just return a value directly, or, even better, you could manually tail-call a C fixup that goes one byte at a time instead of writing that mess in asm. Like this, assuming I got it right: regs->sp = regs->bp; regs->bp = *(unsigned long *)regs->sp; regs->sp += sizeof(unsigned long); regs->ip = fix_it; regs->di = something useful? Bonus points if you can figure out a clean way to register a handler for an IP range without bloating struct extable_entry. --Andy P.S. this mechanism could potentially clean up some entry nastiness, too. P.P.S. Why the hell doesn't *user* code have a mechanism like this? Windows does, and it's been around for longer than I've known how to write C code... -- 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/
[RFCv2 0/4] Asus Wireless Radio Control driver
This is the 2nd RFC for the "Asus Wireless Radio Control" device, addressing the comments on the previous RFC. The differences from the previous RFC are: - Generate input events accessing the input layer directly instead of using sparse_keymap, as this was considered overkill for a device which has only one event type. - Set the input device vendor id. - Clean-up the driver to make a little shorter: now the only extra bits comparing to Mousou's proposal is the "struct asus_wireless_data", which is used to keep all the driver's data (input device pointer, acpi device pointer and LEDs data). - Compile the driver as a module by default. - Select the necessary config options to compile the led_class subsystem when this driver is selected. - Change the module name from asus-wrc to asus-wireless. Since I am currently travelling I did not have a chance to test this changes, but I'll do so as soon as I get back to my home office on Jan 1st. I decided to send this updated version anyway to get feedback since this can't be merged until we have the airplane mode RFKill LED trigger merged in the wireless tree. I'll also send that patch to linux-wireless for feedback and integration later today. Regards, Joao Paulo João Paulo Rechi Vita (4): platform/x86: Add Asus Wireless Radio Control driver asus-wireless: Add ACPI HID ATK4001 net/rfkill: Create "airplane mode" LED trigger asus-wireless: Toggle airplane mode LED MAINTAINERS | 6 ++ drivers/platform/x86/Kconfig | 17 drivers/platform/x86/Makefile| 1 + drivers/platform/x86/asus-wireless.c | 187 +++ net/rfkill/core.c| 30 ++ 5 files changed, 241 insertions(+) create mode 100644 drivers/platform/x86/asus-wireless.c -- 2.5.0 -- 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 1/4] platform/x86: Add Asus Wireless Radio Control driver
Some Asus notebooks like the Asus E202SA and the Asus X555UB have a separate ACPI device for notifications from the airplane mode hotkey. This device is called "Wireless Radio Control" in Asus websites and ASHS in the DSDT, and its ACPI _HID is ATK4002 in the two models mentioned above. For these models, when the airplane mode hotkey (Fn+F2) is pressed, a query 0x0B is started in the Embedded Controller, and all this query does is a notify ASHS with the value 0x88 (for acpi_osi >= "Windows 2012"): Scope (_SB.PCI0.SBRG.EC0) { (...) Method (_Q0B, 0, NotSerialized) // _Qxx: EC Query { If ((MSOS () >= OSW8)) { Notify (ASHS, 0x88) // Device-Specific } Else { (...) } } } Signed-off-by: João Paulo Rechi Vita --- MAINTAINERS | 6 ++ drivers/platform/x86/Kconfig | 15 + drivers/platform/x86/Makefile| 1 + drivers/platform/x86/asus-wireless.c | 105 +++ 4 files changed, 127 insertions(+) create mode 100644 drivers/platform/x86/asus-wireless.c diff --git a/MAINTAINERS b/MAINTAINERS index c984136..e1860f2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1791,6 +1791,12 @@ S: Maintained F: drivers/platform/x86/asus*.c F: drivers/platform/x86/eeepc*.c +ASUS WIRELESS RADIO CONTROL DRIVER +M: João Paulo Rechi Vita +L: platform-driver-...@vger.kernel.org +S: Maintained +F: drivers/platform/x86/asus-wireless.c + ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API R: Dan Williams W: http://sourceforge.net/projects/xscaleiop diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index d0bfcf8..d3a088b 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -587,6 +587,21 @@ config EEEPC_WMI If you have an ACPI-WMI compatible Eee PC laptop (>= 1000), say Y or M here. +config ASUS_WIRELESS + tristate "Asus Wireless Radio Control Driver" + depends on ACPI + depends on INPUT + default m + ---help--- + The Asus Wireless Radio Control handles the airplane mode hotkey + present on some Asus laptops. + + Say Y or M here if you have an ASUS notebook with an airplane mode + hotkey. + + If you choose to compile this driver as a module the module will be + called asus-wireless. + config ACPI_WMI tristate "WMI" depends on ACPI diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index 4410e91..8b8df29 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o obj-$(CONFIG_ASUS_WMI) += asus-wmi.o obj-$(CONFIG_ASUS_NB_WMI) += asus-nb-wmi.o +obj-$(CONFIG_ASUS_WIRELESS)+= asus-wireless.o obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o obj-$(CONFIG_EEEPC_WMI)+= eeepc-wmi.o obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c new file mode 100644 index 000..ef7dba5 --- /dev/null +++ b/drivers/platform/x86/asus-wireless.c @@ -0,0 +1,105 @@ +/* + * Asus Wireless Radio Control Driver + * + * Copyright (C) 2015 Endless Mobile, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include + +#define ASUS_WIRELESS_MODULE_NAME "Asus Wireless Radio Control Driver" + +struct asus_wireless_data { + struct input_dev *inputdev; +}; + +static void asus_wireless_notify(struct acpi_device *device, u32 event) +{ + struct asus_wireless_data *data = acpi_driver_data(device); + + pr_debug("event=0x%X\n", event); + if (event != 0x88) { + pr_info("Unknown ASHS event: 0x%X\n", event); + return; + } + input_report_key(data->inputdev, KEY_RFKILL, 1); + input_report_key(data->inputdev, KEY_RFKILL, 0); + input_sync(data->inputdev); +} + +static int asus_wireless_add(struct acpi_device *device) +{ + struct asus_wireless_data *data; + int err = -ENOMEM; + + pr_info(ASUS_WIRELESS_MODULE_NAME"\n"); + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + device->driver_data = data; + + data->inputdev = input_allocate_device(); + if (!data->inputdev) + goto fail; + + data->inputdev->name = "Asus Wireless Radio Control"; + data->i
[PATCH 4/4] asus-wireless: Toggle airplane mode LED
In the ASHS device we have the HSWC method, which basically calls either OWGD or OWGS, depending on its parameter: Device (ASHS) { Name (_HID, "ATK4002") // _HID: Hardware ID Method (HSWC, 1, Serialized) { If ((Arg0 < 0x02)) { OWGD (Arg0) Return (One) } If ((Arg0 == 0x02)) { Local0 = OWGS () If (Local0) { Return (0x05) } Else { Return (0x04) } } If ((Arg0 == 0x03)) { Return (0xFF) } If ((Arg0 == 0x04)) { OWGD (Zero) Return (One) } If ((Arg0 == 0x05)) { OWGD (One) Return (One) } If ((Arg0 == 0x80)) { Return (One) } } Method (_STA, 0, NotSerialized) // _STA: Status { If ((MSOS () >= OSW8)) { Return (0x0F) } Else { Return (Zero) } } } On the Asus E202SA laptop, which does not have an airplane mode LED, OWGD has an empty implementation and OWGS simply returns 0. On the Asus X555UB these methods have the following implementation: Method (OWGD, 1, Serialized) { SGPL (0x0203000F, Arg0) SGPL (0x0203000F, Arg0) } Method (OWGS, 0, Serialized) { Store (RGPL (0x0203000F), Local0) Return (Local0) } Where OWGD(1) sets the airplane mode LED ON, OWGD(0) set it off, and OWGS() returns its state. This commit makes use of a newly implemented RFKill LED trigger to trigger the LED when the system enters or exits "Airplane Mode", there is, when all radios are blocked. Signed-off-by: João Paulo Rechi Vita --- drivers/platform/x86/Kconfig | 2 + drivers/platform/x86/asus-wireless.c | 81 2 files changed, 83 insertions(+) diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index d3a088b..3d8dc0b 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -592,6 +592,8 @@ config ASUS_WIRELESS depends on ACPI depends on INPUT default m + select NEW_LEDS + select LEDS_CLASS ---help--- The Asus Wireless Radio Control handles the airplane mode hotkey present on some Asus laptops. diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c index 7928efd..489ef83 100644 --- a/drivers/platform/x86/asus-wireless.c +++ b/drivers/platform/x86/asus-wireless.c @@ -17,13 +17,76 @@ #include #include #include +#include #define ASUS_WIRELESS_MODULE_NAME "Asus Wireless Radio Control Driver" +#define ASUS_WIRELESS_LED_STATUS 0x2 +#define ASUS_WIRELESS_LED_OFF 0x4 +#define ASUS_WIRELESS_LED_ON 0x5 struct asus_wireless_data { struct input_dev *inputdev; + struct acpi_device *acpidev; + struct workqueue_struct *wq; + struct work_struct led_work; + struct led_classdev led; + int led_state; }; +static u64 asus_wireless_method(acpi_handle handle, const char *method, + int param) +{ + union acpi_object obj; + struct acpi_object_list p; + acpi_status s; + u64 ret; + + pr_debug("Evaluating method %s, parameter 0x%X\n", method, param); + obj.type = ACPI_TYPE_INTEGER; + obj.integer.value = param; + p.count = 1; + p.pointer = &obj; + + s = acpi_evaluate_integer(handle, (acpi_string) method, &p, &ret); + if (!ACPI_SUCCESS(s)) + pr_err("Failed to evaluate method %s, parameter 0x%X (%d)\n", + method, param, s); + pr_debug("%s returned 0x%X\n", method, (uint) ret); + return ret; +} + +static enum led_brightness asus_wireless_led_get(struct led_classdev *led) +{ + struct asus_wireless_data *data; + int s; + + data = container_of(led, struct asus_
[PATCH 2/4] asus-wireless: Add ACPI HID ATK4001
As reported in https://bugzilla.kernel.org/show_bug.cgi?id=98931#c22 in the Asus UX31A the Asus Wireless Radio Control device (ASHS) uses the HID "ATK4001". Signed-off-by: João Paulo Rechi Vita Reported-by: Tasev Nikola --- drivers/platform/x86/asus-wireless.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c index ef7dba5..7928efd 100644 --- a/drivers/platform/x86/asus-wireless.c +++ b/drivers/platform/x86/asus-wireless.c @@ -83,6 +83,7 @@ static int asus_wireless_remove(struct acpi_device *device) } static const struct acpi_device_id device_ids[] = { + {"ATK4001", 0}, {"ATK4002", 0}, {"", 0}, }; -- 2.5.0 -- 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 3/4] net/rfkill: Create "airplane mode" LED trigger
For platform drivers to be able to correctly drive the "Airplane Mode" indicative LED there needs to be a RFKill LED trigger tied to the global state of RFKILL_TYPE_ALL (instead of to a specific RFKill) and that works in an inverted manner of regular RFKill LED triggers, that is, the LED is ON when the state is blocked, and OFF otherwise. This commit implements such a trigger, which will be used by the asus-wrc x86 platform driver. Signed-off-by: João Paulo Rechi Vita --- net/rfkill/core.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/net/rfkill/core.c b/net/rfkill/core.c index b41e9ea..3effc29 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -124,6 +124,26 @@ static bool rfkill_epo_lock_active; #ifdef CONFIG_RFKILL_LEDS +static void airplane_mode_led_trigger_activate(struct led_classdev *led); + +static struct led_trigger airplane_mode_led_trigger = { + .name = "rfkill-airplane-mode", + .activate = airplane_mode_led_trigger_activate, +}; + +static void airplane_mode_led_trigger_event(void) +{ + if (rfkill_global_states[RFKILL_TYPE_ALL].cur & RFKILL_BLOCK_ANY) + led_trigger_event(&airplane_mode_led_trigger, LED_FULL); + else + led_trigger_event(&airplane_mode_led_trigger, LED_OFF); +} + +static void airplane_mode_led_trigger_activate(struct led_classdev *led) +{ + airplane_mode_led_trigger_event(); +} + static void rfkill_led_trigger_event(struct rfkill *rfkill) { struct led_trigger *trigger; @@ -175,6 +195,10 @@ static void rfkill_led_trigger_unregister(struct rfkill *rfkill) led_trigger_unregister(&rfkill->led_trigger); } #else +static void airplane_mode_led_trigger_event(void) +{ +} + static void rfkill_led_trigger_event(struct rfkill *rfkill) { } @@ -346,6 +370,7 @@ static void __rfkill_switch_all(const enum rfkill_type type, bool blocked) for (i = 0; i < NUM_RFKILL_TYPES; i++) rfkill_global_states[i].cur = blocked; + airplane_mode_led_trigger_event(); } else { rfkill_global_states[type].cur = blocked; } @@ -1177,6 +1202,7 @@ static ssize_t rfkill_fop_write(struct file *file, const char __user *buf, enum rfkill_type i; for (i = 0; i < NUM_RFKILL_TYPES; i++) rfkill_global_states[i].cur = ev.soft; + airplane_mode_led_trigger_event(); } else { rfkill_global_states[ev.type].cur = ev.soft; } @@ -1293,6 +1319,10 @@ static int __init rfkill_init(void) } #endif +#ifdef CONFIG_RFKILL_LEDS + led_trigger_register(&airplane_mode_led_trigger); +#endif + out: return error; } -- 2.5.0 -- 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] RFKill airplane mode LED trigger
This patch adds a LED trigger to drive the airplane mode LED present in some modern laptops. It will be used by the asus-wireless platform driver, which is currently under review on platform-driver-...@vger.kernel.org (the idea was mainly approved, but I'm addressing some comments by the maintainers). João Paulo Rechi Vita (1): net/rfkill: Create "airplane mode" LED trigger net/rfkill/core.c | 30 ++ 1 file changed, 30 insertions(+) -- 2.5.0 -- 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] net/rfkill: Create "airplane mode" LED trigger
For platform drivers to be able to correctly drive the "Airplane Mode" indicative LED there needs to be a RFKill LED trigger tied to the global state of RFKILL_TYPE_ALL (instead of to a specific RFKill) and that works in an inverted manner of regular RFKill LED triggers, that is, the LED is ON when the state is blocked, and OFF otherwise. This commit implements such a trigger, which will be used by the asus-wireless x86 platform driver. Signed-off-by: João Paulo Rechi Vita --- net/rfkill/core.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/net/rfkill/core.c b/net/rfkill/core.c index b41e9ea..3effc29 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -124,6 +124,26 @@ static bool rfkill_epo_lock_active; #ifdef CONFIG_RFKILL_LEDS +static void airplane_mode_led_trigger_activate(struct led_classdev *led); + +static struct led_trigger airplane_mode_led_trigger = { + .name = "rfkill-airplane-mode", + .activate = airplane_mode_led_trigger_activate, +}; + +static void airplane_mode_led_trigger_event(void) +{ + if (rfkill_global_states[RFKILL_TYPE_ALL].cur & RFKILL_BLOCK_ANY) + led_trigger_event(&airplane_mode_led_trigger, LED_FULL); + else + led_trigger_event(&airplane_mode_led_trigger, LED_OFF); +} + +static void airplane_mode_led_trigger_activate(struct led_classdev *led) +{ + airplane_mode_led_trigger_event(); +} + static void rfkill_led_trigger_event(struct rfkill *rfkill) { struct led_trigger *trigger; @@ -175,6 +195,10 @@ static void rfkill_led_trigger_unregister(struct rfkill *rfkill) led_trigger_unregister(&rfkill->led_trigger); } #else +static void airplane_mode_led_trigger_event(void) +{ +} + static void rfkill_led_trigger_event(struct rfkill *rfkill) { } @@ -346,6 +370,7 @@ static void __rfkill_switch_all(const enum rfkill_type type, bool blocked) for (i = 0; i < NUM_RFKILL_TYPES; i++) rfkill_global_states[i].cur = blocked; + airplane_mode_led_trigger_event(); } else { rfkill_global_states[type].cur = blocked; } @@ -1177,6 +1202,7 @@ static ssize_t rfkill_fop_write(struct file *file, const char __user *buf, enum rfkill_type i; for (i = 0; i < NUM_RFKILL_TYPES; i++) rfkill_global_states[i].cur = ev.soft; + airplane_mode_led_trigger_event(); } else { rfkill_global_states[ev.type].cur = ev.soft; } @@ -1293,6 +1319,10 @@ static int __init rfkill_init(void) } #endif +#ifdef CONFIG_RFKILL_LEDS + led_trigger_register(&airplane_mode_led_trigger); +#endif + out: return error; } -- 2.5.0 -- 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 2/2] kexec: Provide arch_kexec_protect(unprotect)_crashkres()
On 12/23/15 at 07:12pm, Xunlei Pang wrote: > Implement the protection method for the crash kernel memory > reservation for the 64-bit x86 kdump. > > Signed-off-by: Xunlei Pang > --- > Only provided x86_64 implementation, as I've only tested on x86_64 so far. > > arch/x86/kernel/machine_kexec_64.c | 43 > ++ > 1 file changed, 43 insertions(+) > > diff --git a/arch/x86/kernel/machine_kexec_64.c > b/arch/x86/kernel/machine_kexec_64.c > index 819ab3f..a3d289c 100644 > --- a/arch/x86/kernel/machine_kexec_64.c > +++ b/arch/x86/kernel/machine_kexec_64.c > @@ -536,3 +536,46 @@ overflow: > return -ENOEXEC; > } > #endif /* CONFIG_KEXEC_FILE */ > + > +#ifdef CONFIG_KEXEC_CORE > +static int > +kexec_mark_range(unsigned long start, unsigned long end, bool protect) > +{ > + struct page *page; > + unsigned int nr_pages; > + > + if (!start || !end || start >= end) > + return 0; > + > + page = pfn_to_page(start >> PAGE_SHIFT); > + nr_pages = (end + 1 - start) >> PAGE_SHIFT; The start and end may across two pages, although the range is small than PAGE_SIZE. You can use following to calculate count of page. nr_pages = (end >> PAGE_SHIFT) - (start >> PAGE_SHIFT) + 1; Thanks Minfei > + if (protect) > + return set_pages_ro(page, nr_pages); > + else > + return set_pages_rw(page, nr_pages); > +} -- 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] Staging: ste_rmi4: Remove obsolete driver
From: Shraddha Barke Remove support for Synaptics RMI4 Touchscreen driver from the staging directory since support for Synaptics RMI4 touchpads has been added in the mainline kernel. commit 9fb6bf02e3ad ("HID: rmi: introduce RMI driver for Synaptics touchpads") Signed-off-by: Shraddha Barke --- drivers/staging/Kconfig |2 - drivers/staging/Makefile |1 - drivers/staging/ste_rmi4/Kconfig |9 - drivers/staging/ste_rmi4/Makefile |4 - drivers/staging/ste_rmi4/TODO |7 - drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 1140 - drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h | 46 - 7 files changed, 1209 deletions(-) delete mode 100644 drivers/staging/ste_rmi4/Kconfig delete mode 100644 drivers/staging/ste_rmi4/Makefile delete mode 100644 drivers/staging/ste_rmi4/TODO delete mode 100644 drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c delete mode 100644 drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 5d3b86a..e89c02c 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -64,8 +64,6 @@ source "drivers/staging/emxx_udc/Kconfig" source "drivers/staging/speakup/Kconfig" -source "drivers/staging/ste_rmi4/Kconfig" - source "drivers/staging/nvec/Kconfig" source "drivers/staging/media/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 30918ed..654ee8d 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -26,7 +26,6 @@ obj-$(CONFIG_FB_SM750)+= sm750fb/ obj-$(CONFIG_FB_XGI) += xgifb/ obj-$(CONFIG_USB_EMXX) += emxx_udc/ obj-$(CONFIG_SPEAKUP) += speakup/ -obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/ obj-$(CONFIG_MFD_NVEC) += nvec/ obj-$(CONFIG_STAGING_RDMA) += rdma/ obj-$(CONFIG_ANDROID) += android/ diff --git a/drivers/staging/ste_rmi4/Kconfig b/drivers/staging/ste_rmi4/Kconfig deleted file mode 100644 index e867950..000 --- a/drivers/staging/ste_rmi4/Kconfig +++ /dev/null @@ -1,9 +0,0 @@ -config TOUCHSCREEN_SYNAPTICS_I2C_RMI4 - tristate "Synaptics i2c rmi4 touchscreen" - depends on I2C && INPUT - help - Say Y here if you have a Synaptics RMI4 and - want to enable support for the built-in touchscreen. - - To compile this driver as a module, choose M here: the - module will be called synaptics_rmi4_ts. diff --git a/drivers/staging/ste_rmi4/Makefile b/drivers/staging/ste_rmi4/Makefile deleted file mode 100644 index 6cce2ed..000 --- a/drivers/staging/ste_rmi4/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# -# Makefile for the RMI4 touchscreen driver. -# -obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += synaptics_i2c_rmi4.o diff --git a/drivers/staging/ste_rmi4/TODO b/drivers/staging/ste_rmi4/TODO deleted file mode 100644 index 9be2437..000 --- a/drivers/staging/ste_rmi4/TODO +++ /dev/null @@ -1,7 +0,0 @@ -TODO - - -Wait for the official upstream synaptics rmi4 clearpad drivers as promised over the past few months -Merge any device support needed from this driver into it -Delete this driver - diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c deleted file mode 100644 index 824d460..000 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +++ /dev/null @@ -1,1140 +0,0 @@ -/** - * - * Synaptics Register Mapped Interface (RMI4) I2C Physical Layer Driver. - * Copyright (c) 2007-2010, Synaptics Incorporated - * - * Author: Js HA for ST-Ericsson - * Author: Naveen Kumar G for ST-Ericsson - * Copyright 2010 (c) ST-Ericsson AB - */ -/* - * This file is licensed under the GPL2 license. - * - *# - * GPL - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - *# - */ - -#include -#include -#include -#include -#include -#include -#include -#include "synaptics_i2c_rmi4.h" - -/* TODO: for multiple device support will need a per-device mutex */ -#define DRIVER_NAME "synaptics_rmi4_i2c" - -#define MAX_ERROR_REPORT 6 -#define MAX_TOUCH_MAJOR15 -#define MAX_RETRY_COUNT5 -#define STD_QUERY_LEN 21 -#define PAGE_LEN 2 -#define DATA_BUF_LEN 32 -#define BUF_LEN37 -#define QUERY_LEN 9 -#define DATA_LEN 12 -#de
[PATCH 1/7] umem: fix error return code
Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall --- drivers/block/umem.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/block/umem.c b/drivers/block/umem.c index 7939b9f..873e9fe 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c @@ -883,6 +883,7 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) if (card->mm_pages[0].desc == NULL || card->mm_pages[1].desc == NULL) { dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n"); + ret = -ENOMEM; goto failed_alloc; } reset_page(&card->mm_pages[0]); @@ -893,8 +894,10 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) card->biotail = &card->bio; card->queue = blk_alloc_queue(GFP_KERNEL); - if (!card->queue) + if (!card->queue) { + ret = -ENOMEM; goto failed_alloc; + } blk_queue_make_request(card->queue, mm_make_request); card->queue->queue_lock = &card->lock; -- 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 2/7] gdrom: fix error return code
Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall --- drivers/cdrom/gdrom.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 584bc31..46ecd95 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c @@ -807,16 +807,20 @@ static int probe_gdrom(struct platform_device *devptr) if (err) goto probe_fail_cmdirq_register; gd.gdrom_rq = blk_init_queue(gdrom_request, &gdrom_lock); - if (!gd.gdrom_rq) + if (!gd.gdrom_rq) { + err = -ENOMEM; goto probe_fail_requestq; + } err = probe_gdrom_setupqueue(); if (err) goto probe_fail_toc; gd.toc = kzalloc(sizeof(struct gdromtoc), GFP_KERNEL); - if (!gd.toc) + if (!gd.toc) { + err = -ENOMEM; goto probe_fail_toc; + } add_disk(gd.disk); return 0; -- 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 3/7] omapfb: fix error return code
Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall --- drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c | 12 +++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c b/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c index 677e254..fc4cfa9 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c +++ b/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c @@ -241,22 +241,28 @@ static int tpd_probe(struct platform_device *pdev) gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0, GPIOD_OUT_LOW); - if (IS_ERR(gpio)) + if (IS_ERR(gpio)) { + r = PTR_ERR(gpio); goto err_gpio; + } ddata->ct_cp_hpd_gpio = gpio; gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 1, GPIOD_OUT_LOW); - if (IS_ERR(gpio)) + if (IS_ERR(gpio)) { + r = PTR_ERR(gpio); goto err_gpio; + } ddata->ls_oe_gpio = gpio; gpio = devm_gpiod_get_index(&pdev->dev, NULL, 2, GPIOD_IN); - if (IS_ERR(gpio)) + if (IS_ERR(gpio)) { + r = PTR_ERR(gpio); goto err_gpio; + } ddata->hpd_gpio = gpio; -- 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 0/7] fix error return code
The complate semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @ok exists@ identifier f,ret,i; expression e; constant c; @@ // identify a function that returns a negative return value at least once. f(...) { ... when any ( return -c@i; | ret = -c@i; ... when != ret = e return ret; | if (ret < 0) { ... return ret; } ) ... when any } @r exists@ identifier ret,ok.f,fn; expression e1,e2,e3,e4,e5,e6,x; statement S,S1; position p1,p2,p3; @@ // identify a case where the return variable is set to a non-negative value // and then returned in error-handling code f(...) { ... when any ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != \(ret = e1\|ret++\|ret--\|ret+=e1\|ret-=e1\) when != &ret when any ( if (<+... ret = e5 ...+>) S1 | if (<+... &ret ...+>) S1 | if@p2(<+...x = fn(...)...+>) { ... when != ret = e6 when forall return@p3 ret; } | break; | x = fn(...) ... when != \(ret = e4\|ret++\|ret--\|ret+=e4\|ret-=e4\) when != &ret ( if (<+... ret = e3 ...+>) S | if (<+... &ret ...+>) S | if@p2(<+...\(x != 0\|x < 0\|x == NULL\|IS_ERR(x)\)...+>) { ... when != ret = e2 when forall return@p3 ret; } ) ) ... when any } @printer depends on r@ position p; identifier ok.f,pr; constant char [] c; @@ f(...) { <...pr@p(...,c,...)...> } @bad0 exists@ identifier r.ret,ok.f,g != {ERR_PTR,IS_ERR}; position p != printer.p; @@ f(...) { ... when any g@p(...,ret,...) ... when any } @bad depends on !bad0 exists@ position r.p1,r.p2; statement S1,S2; identifier r.ret; expression e1; @@ // ignore the above if there is some path where the variable is set to // something else ( if@p1 (\(ret < 0\|ret != 0\)) S1 | ret@p1 = 0 ) ... when any \(ret = e1\|ret++\|ret--\|ret+=e1\|ret-=e1\|&ret\) ... when any if@p2(...) S2 @bad1 depends on !bad0 && !bad exists@ position r.p2; statement S2; identifier r.ret; expression e1; constant c; @@ ret = -c ... when != \(ret = e1\|ret++\|ret--\|ret+=e1\|ret-=e1\) when != &ret when any if@p2(...) S2 @bad2 depends on !bad0 && !bad && !bad1 exists@ position r.p1,r.p2; identifier r.ret; expression e1; statement S2; constant c; @@ // likewise ignore it if there has been an intervening return ret@p1 = 0 ... when != if (...) { ... ret = e1 ... return ret; } when != if (...) { ... return -c; } when any if@p2(...) S2 @script:python depends on !bad0 && !bad && !bad1 && !bad2@ p1 << r.p1; p2 << r.p2; p3 << r.p3; @@ cocci.print_main("",p1) cocci.print_secs("",p2) cocci.print_secs("",p3) // --- drivers/block/rsxx/core.c |1 drivers/block/umem.c |5 +++- drivers/cdrom/gdrom.c |8 +- drivers/net/ethernet/ti/cpsw.c|8 +- drivers/soc/ti/knav_qmss_queue.c |1 drivers/soc/ti/wkup_m3_ipc.c |1 drivers/usb/gadget/legacy/acm_ms.c|4 ++- drivers/usb/gadget/legacy/audio.c |4 ++- drivers/usb/gadget/legacy/cdc2.c |4 ++- drivers/usb/gadget/legacy/ether.c |4 ++- drivers/usb/gadget/legacy/hid.c |4 ++- drivers/usb/gadget/legacy/mass_storage.c |4 ++- drivers/usb/gadget/legacy/ncm.c |4 ++- drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c | 12 +++--- 14 files changed, 49 insertions(+), 15 deletions(-) -- 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 7/7] soc: ti: fix error return code
Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall --- drivers/soc/ti/knav_qmss_queue.c |1 + drivers/soc/ti/wkup_m3_ipc.c |1 + 2 files changed, 2 insertions(+) diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c index 8c03a80..b401a28 100644 --- a/drivers/soc/ti/knav_qmss_queue.c +++ b/drivers/soc/ti/knav_qmss_queue.c @@ -1787,6 +1787,7 @@ static int knav_queue_probe(struct platform_device *pdev) regions = of_get_child_by_name(node, "descriptor-regions"); if (!regions) { dev_err(dev, "descriptor-regions not specified\n"); + ret = -ENODEV; goto err; } ret = knav_queue_setup_regions(kdev, regions); diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c index 8823cc8..5bb3760 100644 --- a/drivers/soc/ti/wkup_m3_ipc.c +++ b/drivers/soc/ti/wkup_m3_ipc.c @@ -459,6 +459,7 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) if (IS_ERR(task)) { dev_err(dev, "can't create rproc_boot thread\n"); + ret = PTR_ERR(task); goto err_put_rproc; } -- 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 6/7] drivers: net: cpsw: fix error return code
Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall --- drivers/net/ethernet/ti/cpsw.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 3409e80..6a76992 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2448,8 +2448,10 @@ static int cpsw_probe(struct platform_device *pdev) /* RX IRQ */ irq = platform_get_irq(pdev, 1); - if (irq < 0) + if (irq < 0) { + ret = -ENOENT; goto clean_ale_ret; + } priv->irqs_table[0] = irq; ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt, @@ -2461,8 +2463,10 @@ static int cpsw_probe(struct platform_device *pdev) /* TX IRQ */ irq = platform_get_irq(pdev, 2); - if (irq < 0) + if (irq < 0) { + ret = -ENOENT; goto clean_ale_ret; + } priv->irqs_table[1] = irq; ret = devm_request_irq(&pdev->dev, irq, cpsw_tx_interrupt, -- 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 5/7] rsxx: fix error return code
Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall --- drivers/block/rsxx/core.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index d8b2488..3801721 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c @@ -893,6 +893,7 @@ static int rsxx_pci_probe(struct pci_dev *dev, card->event_wq = create_singlethread_workqueue(DRIVER_NAME"_event"); if (!card->event_wq) { dev_err(CARD_TO_DEV(card), "Failed card event setup.\n"); + st = -ENOMEM; goto failed_event_handler; } -- 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 4/7] usb: gadget: legacy: fix error return code
Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall --- drivers/usb/gadget/legacy/acm_ms.c |4 +++- drivers/usb/gadget/legacy/audio.c|4 +++- drivers/usb/gadget/legacy/cdc2.c |4 +++- drivers/usb/gadget/legacy/ether.c|4 +++- drivers/usb/gadget/legacy/hid.c |4 +++- drivers/usb/gadget/legacy/mass_storage.c |4 +++- drivers/usb/gadget/legacy/ncm.c |4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/legacy/acm_ms.c b/drivers/usb/gadget/legacy/acm_ms.c index c16089e..2679264 100644 --- a/drivers/usb/gadget/legacy/acm_ms.c +++ b/drivers/usb/gadget/legacy/acm_ms.c @@ -211,8 +211,10 @@ static int acm_ms_bind(struct usb_composite_dev *cdev) struct usb_descriptor_header *usb_desc; usb_desc = usb_otg_descriptor_alloc(gadget); - if (!usb_desc) + if (!usb_desc) { + status = -ENOMEM; goto fail_string_ids; + } usb_otg_descriptor_init(gadget, usb_desc); otg_desc[0] = usb_desc; otg_desc[1] = NULL; diff --git a/drivers/usb/gadget/legacy/audio.c b/drivers/usb/gadget/legacy/audio.c index 5d7b3c6..f61936b 100644 --- a/drivers/usb/gadget/legacy/audio.c +++ b/drivers/usb/gadget/legacy/audio.c @@ -249,8 +249,10 @@ static int audio_bind(struct usb_composite_dev *cdev) struct usb_descriptor_header *usb_desc; usb_desc = usb_otg_descriptor_alloc(cdev->gadget); - if (!usb_desc) + if (!usb_desc) { + status = -ENOMEM; goto fail; + } usb_otg_descriptor_init(cdev->gadget, usb_desc); otg_desc[0] = usb_desc; otg_desc[1] = NULL; diff --git a/drivers/usb/gadget/legacy/cdc2.c b/drivers/usb/gadget/legacy/cdc2.c index 51c0868..94261a1 100644 --- a/drivers/usb/gadget/legacy/cdc2.c +++ b/drivers/usb/gadget/legacy/cdc2.c @@ -183,8 +183,10 @@ static int cdc_bind(struct usb_composite_dev *cdev) struct usb_descriptor_header *usb_desc; usb_desc = usb_otg_descriptor_alloc(gadget); - if (!usb_desc) + if (!usb_desc) { + status = -ENOMEM; goto fail1; + } usb_otg_descriptor_init(gadget, usb_desc); otg_desc[0] = usb_desc; otg_desc[1] = NULL; diff --git a/drivers/usb/gadget/legacy/ether.c b/drivers/usb/gadget/legacy/ether.c index 25a2c2e..3396e71 100644 --- a/drivers/usb/gadget/legacy/ether.c +++ b/drivers/usb/gadget/legacy/ether.c @@ -407,8 +407,10 @@ static int eth_bind(struct usb_composite_dev *cdev) struct usb_descriptor_header *usb_desc; usb_desc = usb_otg_descriptor_alloc(gadget); - if (!usb_desc) + if (!usb_desc) { + status = -ENOMEM; goto fail1; + } usb_otg_descriptor_init(gadget, usb_desc); otg_desc[0] = usb_desc; otg_desc[1] = NULL; diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c index a71a884..cccbb94 100644 --- a/drivers/usb/gadget/legacy/hid.c +++ b/drivers/usb/gadget/legacy/hid.c @@ -175,8 +175,10 @@ static int hid_bind(struct usb_composite_dev *cdev) struct usb_descriptor_header *usb_desc; usb_desc = usb_otg_descriptor_alloc(gadget); - if (!usb_desc) + if (!usb_desc) { + status = -ENOMEM; goto put; + } usb_otg_descriptor_init(gadget, usb_desc); otg_desc[0] = usb_desc; otg_desc[1] = NULL; diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c index e61af53..93f2b8f 100644 --- a/drivers/usb/gadget/legacy/mass_storage.c +++ b/drivers/usb/gadget/legacy/mass_storage.c @@ -200,8 +200,10 @@ static int msg_bind(struct usb_composite_dev *cdev) struct usb_descriptor_header *usb_desc; usb_desc = usb_otg_descriptor_alloc(cdev->gadget); - if (!usb_desc) + if (!usb_desc) { + status = -ENOMEM; goto fail_string_ids; + } usb_otg_descriptor_init(cdev->gadget, usb_desc); otg_desc[0] = usb_desc; otg_desc[1] = NULL; diff --git a/dr
[PATCH v2] crypto: AF_ALG - add support for keys/asymmetric-type
From: Tadeusz Struk Created on top of patchset from Stephan Mueller https://patchwork.kernel.org/patch/7877921/ https://patchwork.kernel.org/patch/7877971/ https://patchwork.kernel.org/patch/7877961/ This patch adds support for asymmetric key type to AF_ALG. It will work as follows: A new PF_ALG socket options will be added on top of existing ALG_SET_KEY and ALG_SET_PUBKEY, namely ALG_SET_PUBKEY_ID and ALG_SET_KEY_ID for setting public and private keys respectively. When these new options will be used the user instead of providing the key material, will provide a key id and the key itself will be obtained from kernel keyring subsystem. The user will use the standard tools (keyctl tool or the keyctl syscall) for key instantiation and to obtain the key id. The key id can also be obtained by reading the /proc/keys file. When a key will be found, the request_key() function will return a requested key. Next the asymmetric key subtype will be used to obtain the public_key, which can be either a public key or a private key from the cryptographic point of view, and the key payload will be passed to the akcipher pf_alg subtype. Pf_alg code will then call crypto API functions, either the crypto_akcipher_set_priv_key or the crypto_akcipher_set_pub_key, depending on the used option. Subsequently the asymmetric key will be freed and return code returned back to the user. Currently the interface will be restricted only to asymmetric ciphers, but it can be extended later to work with symmetric ciphers if required. The assumption is that access rights for a given user will be verified by the key subsystem so the pf_alg interface can call the request_key() without checking if the user has appropriate rights (Please verify this assumption). Changes in v2: Separate logic for setkey and setkey_id into two separate functions as proposed by Stephan. Signed-off-by: Tadeusz Struk --- crypto/af_alg.c | 49 +++ include/uapi/linux/if_alg.h |2 ++ 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 767a134..e96e8c9 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include struct alg_type_list { const struct af_alg_type *type; @@ -172,8 +174,38 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) return 0; } +static int alg_setkey_id(void *private, const u8 *key, unsigned int keylen, +int (*setkey)(void *private, const u8 *key, + unsigned int keylen)) +{ + struct key *keyring; + struct public_key *pkey; + char key_name[12]; + u32 keyid = *((u32 *)key); + int err; + + sprintf(key_name, "id:%08x", keyid); + keyring = request_key(&key_type_asymmetric, key_name, NULL); + + err = -ENOKEY; + if (IS_ERR(keyring)) + goto out; + + pkey = keyring->payload.data[asym_crypto]; + if (!pkey) { + key_put(keyring); + goto out; + } + + err = setkey(private, pkey->key, pkey->keylen); + key_put(keyring); + +out: + return err; +} + static int alg_setkey(struct sock *sk, char __user *ukey, - unsigned int keylen, + unsigned int keylen, bool key_id, int (*setkey)(void *private, const u8 *key, unsigned int keylen)) { @@ -192,7 +224,8 @@ static int alg_setkey(struct sock *sk, char __user *ukey, if (copy_from_user(key, ukey, keylen)) goto out; - err = setkey(ask->private, key, keylen); + err = key_id ? alg_setkey_id(ask->private, key, keylen, setkey) : + setkey(ask->private, key, keylen); out: sock_kzfree_s(sk, key, keylen); @@ -207,6 +240,8 @@ static int alg_setsockopt(struct socket *sock, int level, int optname, struct alg_sock *ask = alg_sk(sk); const struct af_alg_type *type; int err = -ENOPROTOOPT; + bool key_id = ((optname == ALG_SET_PUBKEY_ID) || + (optname == ALG_SET_KEY_ID)); lock_sock(sk); type = ask->type; @@ -216,16 +251,22 @@ static int alg_setsockopt(struct socket *sock, int level, int optname, switch (optname) { case ALG_SET_KEY: + case ALG_SET_KEY_ID: if (sock->state == SS_CONNECTED) goto unlock; - err = alg_setkey(sk, optval, optlen, type->setkey); + /* ALG_SET_KEY_ID is only for akcipher */ + if (!strcmp(type->name, "akcipher") && key_id) + goto unlock; + + err = alg_setkey(sk, optval, optlen, key_id, type->setkey); break; case ALG_SET_PUBKEY: + case ALG_SET_PUBKEY_ID: if (sock->state == SS_CONNEC
[PATCH v6 0/3] spi: dts: sun4i: Add support for wait time between word transmissions
Hi all, This is the sixth version of the patch set that adds a new property "spi-word-wait-ns" to the spi-bus binding to allow SPI slave devices to set a wait time between the transmission of words. It modifies the spi_device struct and slave device probing to read and store the new property. Also modifies the sun4i SPI master driver to make use of the new property. This specific SPI controller needs 3 clock cycles to set up the delay, which makes the minimum non-zero wait time on this hardware 4 clock cycles. It now also fixes multiple problems in the sun4i clock calculation: - The A10/A20 datasheet contains the formula AHB_CLK / (2^(n+1)) to calculate SPI_CLK from CDR1, but this formula is wrong. The actual formula - determined by analyzing the actual waveforms on a A20 SoC - is AHB_CLK / (2^n). - The divisor calculations for CDR1 and CDR2 both rounded to the nearest integer. This could lead to a transfer speed that is higher than the requested speed. This patch changes both calculations to always round down. - The mclk frequency was only ever increased, never decreased. This could lead to unpredictable transfer speeds, depending on the order in which transfers with different speeds where serviced by the SPI driver. Changes from v1: * renamed the property for more clarity * wait time is set in nanoseconds instead of number of clock cycles * transparently handle the 3 setup clock cycles Changes from v2: * fixed typo in comment * moved parameter to spi-bus binding, dropping the vendor prefix * changed commit summary and description to reflect the changes Changes from v3: * remove reference to "hardware" in comments and description, as the wait time could also be implemented in software * read and set property value in spi core Changes from v4: * log with dev_dbg instead of dev_info * split patch into two separate ones for SPI-core and sun4i parts Changes from v5: * Add Maxime's Reviewed-by and Rob's Acked-by to the SPI core patch * Add patch to fix clock calculation * Use actual SPI speed instead of tfr->speed_hz for wait time calculation Marcus Weseloh (3): spi: dts: Add new device property to specifcy a wait time between word transmissions spi: sun4i: Fix clock calculations to be predictable and never exceed the requested rate spi: sun4i: Add support for wait time between word transmissions Documentation/devicetree/bindings/spi/spi-bus.txt | 2 + drivers/spi/spi-sun4i.c | 51 ++- drivers/spi/spi.c | 2 + include/linux/spi/spi.h | 2 + 4 files changed, 46 insertions(+), 11 deletions(-) -- 1.9.1 -- 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 v6 3/3] spi: sun4i: Add support for wait time between word transmissions
Modifies the sun4i SPI master driver to make use of the "spi-word-wait-ns" property. This specific SPI controller needs 3 clock cycles to set up the delay, which makes the minimum non-zero wait time on this hardware 4 clock cycles. Signed-off-by: Marcus Weseloh --- drivers/spi/spi-sun4i.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c index d67e142..4d6f77c 100644 --- a/drivers/spi/spi-sun4i.c +++ b/drivers/spi/spi-sun4i.c @@ -176,6 +176,9 @@ static int sun4i_spi_transfer_one(struct spi_master *master, unsigned int tx_len = 0; int ret = 0; u32 reg; + int wait_clk = 0; + int clk_ns = 0; + unsigned int speed_hz; /* We don't support transfer larger than the FIFO */ if (tfr->len > SUN4I_FIFO_DEPTH) @@ -260,13 +263,34 @@ static int sun4i_spi_transfer_one(struct spi_master *master, div = DIV_ROUND_UP(mclk_rate, 2 * tfr->speed_hz) - 1; if (div <= SUN4I_CLK_CTL_CDR2_MASK) { reg = SUN4I_CLK_CTL_CDR2(div) | SUN4I_CLK_CTL_DRS; + speed_hz = mclk_rate / (2 * (div + 1)); } else { div = ilog2(roundup_pow_of_two(mclk_rate / tfr->speed_hz)); reg = SUN4I_CLK_CTL_CDR1(div); + speed_hz = mclk_rate / (1 << div); } sun4i_spi_write(sspi, SUN4I_CLK_CTL_REG, reg); + /* +* Setup wait time between words. +* +* Wait time is set in SPI_CLK cycles. The SPI hardware needs 3 +* additional cycles to setup the wait counter, so the minimum delay +* time is 4 cycles. +*/ + if (spi->word_wait_ns) { + clk_ns = DIV_ROUND_UP(10, speed_hz); + wait_clk = DIV_ROUND_UP(spi->word_wait_ns, clk_ns) - 3; + if (wait_clk < 1) { + wait_clk = 1; + dev_dbg(&spi->dev, + "using minimum of 4 word wait cycles (%uns)", + 4 * clk_ns); + } + } + sun4i_spi_write(sspi, SUN4I_WAIT_REG, (u16)wait_clk); + /* Setup the transfer now... */ if (sspi->tx_buf) tx_len = tfr->len; -- 1.9.1 -- 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 v6 1/3] spi: dts: Add new device property to specifcy a wait time between word transmissions
Adds a new property "spi-word-wait-ns" to the spi-bus binding that allows SPI slave devices to set a wait time between the transmission of words. Signed-off-by: Marcus Weseloh Reviewed-by: Maxime Ripard Acked-by: Rob Herring --- Documentation/devicetree/bindings/spi/spi-bus.txt | 2 ++ drivers/spi/spi.c | 2 ++ include/linux/spi/spi.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt index bbaa857..434d321 100644 --- a/Documentation/devicetree/bindings/spi/spi-bus.txt +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt @@ -61,6 +61,8 @@ contain the following properties. used for MOSI. Defaults to 1 if not present. - spi-rx-bus-width - (optional) The bus width(number of data wires) that used for MISO. Defaults to 1 if not present. +- spi-word-wait-ns - (optional) Delay between transmission of words + in nanoseconds Some SPI controllers and devices support Dual and Quad SPI transfer mode. It allows data in the SPI system to be transferred in 2 wires(DUAL) or 4 wires(QUAD). diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 2b0a8ec..186373b 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1467,6 +1467,8 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc) if (of_find_property(nc, "spi-lsb-first", NULL)) spi->mode |= SPI_LSB_FIRST; + of_property_read_u32(nc, "spi-word-wait-ns", &spi->word_wait_ns); + /* Device DUAL/QUAD mode */ if (!of_property_read_u32(nc, "spi-tx-bus-width", &value)) { switch (value) { diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index cce80e6..ea3037f 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -118,6 +118,7 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats, * for driver coldplugging, and in uevents used for hotplugging * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when * when not using a GPIO line) + * @word_wait_ns: A wait time between word transfers in nanoseconds * * @statistics: statistics for the spi_device * @@ -158,6 +159,7 @@ struct spi_device { void*controller_data; charmodalias[SPI_NAME_SIZE]; int cs_gpio;/* chip select gpio */ + u32 word_wait_ns; /* wait time between words */ /* the statistics */ struct spi_statistics statistics; -- 1.9.1 -- 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 v6 2/3] spi: sun4i: Fix clock calculations to be predictable and never exceed the requested rate
This patch fixes multiple problems with the current clock calculations: 1. The A10/A20 datasheet contains the formula AHB_CLK / (2^(n+1)) to calculate SPI_CLK from CDR1, but this formula is wrong. The actual formula - determined by analyzing the actual waveforms - is AHB_CLK / (2^n). 2. The divisor calculations for CDR1 and CDR2 both rounded to the nearest integer. This could lead to a transfer speed that is higher than the requested speed. This patch changes both calculations to always round down. 3. The mclk frequency was only ever increased, never decreased. This could lead to unpredictable transfer speeds, depending on the order in which transfers with different speeds where serviced by the SPI driver. Signed-off-by: Marcus Weseloh --- drivers/spi/spi-sun4i.c | 26 -- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c index f60a6d6..d67e142 100644 --- a/drivers/spi/spi-sun4i.c +++ b/drivers/spi/spi-sun4i.c @@ -79,6 +79,9 @@ struct sun4i_spi { struct clk *hclk; struct clk *mclk; + int cur_max_speed; + int cur_mclk; + struct completion done; const u8*tx_buf; @@ -227,11 +230,17 @@ static int sun4i_spi_transfer_one(struct spi_master *master, sun4i_spi_write(sspi, SUN4I_CTL_REG, reg); - /* Ensure that we have a parent clock fast enough */ + /* +* Ensure that the parent clock is set to twice the max speed +* of the spi device (possibly rounded up by the clk driver) +*/ mclk_rate = clk_get_rate(sspi->mclk); - if (mclk_rate < (2 * tfr->speed_hz)) { - clk_set_rate(sspi->mclk, 2 * tfr->speed_hz); + if (spi->max_speed_hz != sspi->cur_max_speed || + mclk_rate != sspi->cur_mclk) { + clk_set_rate(sspi->mclk, 2 * spi->max_speed_hz); mclk_rate = clk_get_rate(sspi->mclk); + sspi->cur_mclk = mclk_rate; + sspi->cur_max_speed = spi->max_speed_hz; } /* @@ -239,7 +248,7 @@ static int sun4i_spi_transfer_one(struct spi_master *master, * * We have two choices there. Either we can use the clock * divide rate 1, which is calculated thanks to this formula: -* SPI_CLK = MOD_CLK / (2 ^ (cdr + 1)) +* SPI_CLK = MOD_CLK / (2 ^ cdr) * Or we can use CDR2, which is calculated with the formula: * SPI_CLK = MOD_CLK / (2 * (cdr + 1)) * Wether we use the former or the latter is set through the @@ -248,14 +257,11 @@ static int sun4i_spi_transfer_one(struct spi_master *master, * First try CDR2, and if we can't reach the expected * frequency, fall back to CDR1. */ - div = mclk_rate / (2 * tfr->speed_hz); - if (div <= (SUN4I_CLK_CTL_CDR2_MASK + 1)) { - if (div > 0) - div--; - + div = DIV_ROUND_UP(mclk_rate, 2 * tfr->speed_hz) - 1; + if (div <= SUN4I_CLK_CTL_CDR2_MASK) { reg = SUN4I_CLK_CTL_CDR2(div) | SUN4I_CLK_CTL_DRS; } else { - div = ilog2(mclk_rate) - ilog2(tfr->speed_hz); + div = ilog2(roundup_pow_of_two(mclk_rate / tfr->speed_hz)); reg = SUN4I_CLK_CTL_CDR1(div); } -- 1.9.1 -- 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 v2 14/16] x86,nvdimm,kexec: Use walk_iomem_res_desc() for iomem search
Ccing kexec maillist. On 12/25/15 at 03:09pm, Toshi Kani wrote: > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > index c245085..e2bd737 100644 > --- a/kernel/kexec_file.c > +++ b/kernel/kexec_file.c > @@ -522,10 +522,10 @@ int kexec_add_buffer(struct kimage *image, char > *buffer, unsigned long bufsz, > > /* Walk the RAM ranges and allocate a suitable range for the buffer */ > if (image->type == KEXEC_TYPE_CRASH) > - ret = walk_iomem_res("Crash kernel", > - IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY, > - crashk_res.start, crashk_res.end, kbuf, > - locate_mem_hole_callback); > + ret = walk_iomem_res_desc(IORES_DESC_CRASH_KERNEL, Since crashk_res's desc has been assigned to IORES_DESC_CRASH_KERNEL, it is better to use crashk_res.desc, instead of using IORES_DESC_CRASH_KERNEL directly. Thanks Minfei > + IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY, > + crashk_res.start, crashk_res.end, kbuf, > + locate_mem_hole_callback); > else > ret = walk_system_ram_res(0, -1, kbuf, > locate_mem_hole_callback); -- 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 0/2] ABI: handle 32-bit off_t for 32-bit and compat ABIs
32-bit off_t is supported only for old 32-bit and compat ABIs. New ABIs are 64-bit length only. This patchset makes 64-bit length the default for off_t, and reverts it for old architectures where needed. It does not change the behaviour of existing code. First patch makes all compat users of generic unistd.h to use non-compat versions of openat and open_by_handle_at. Tile that requires old behaviour is turned around. Second patch introduces ARCH_32BIT_OFF_T config option, disabled by default, but enables it explicitly for existing 32-bit architectures. Yury Norov (2): ABI: compat: use non-compat openat and open_by_handle_at variants 32-bit ABI: introduce ARCH_32BIT_OFF_T config option arch/Kconfig | 4 arch/arc/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/blackfin/Kconfig | 1 + arch/cris/Kconfig | 1 + arch/frv/Kconfig | 1 + arch/h8300/Kconfig| 1 + arch/hexagon/Kconfig | 1 + arch/ia64/Kconfig | 1 + arch/m32r/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/metag/Kconfig| 1 + arch/microblaze/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/mn10300/Kconfig | 1 + arch/nios2/Kconfig| 1 + arch/openrisc/Kconfig | 1 + arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/score/Kconfig| 1 + arch/sh/Kconfig | 1 + arch/sparc/Kconfig| 1 + arch/tile/Kconfig | 1 + arch/tile/kernel/compat.c | 3 +++ arch/unicore32/Kconfig| 1 + arch/x86/Kconfig | 1 + arch/x86/um/Kconfig | 1 + arch/xtensa/Kconfig | 1 + include/linux/fcntl.h | 3 ++- include/uapi/asm-generic/unistd.h | 5 ++--- 31 files changed, 38 insertions(+), 4 deletions(-) -- 2.5.0 -- 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 1/2] compat ABI: use non-compat openat and open_by_handle_at variants
The only difference is that non-compat version forces O_LARGEFILE, and it should be the default behaviour for all architectures, as we don't support 32-bit off_t. The only exception is tile32, that continues with compat version of syscalls. Signed-off-by: Yury Norov --- arch/tile/kernel/compat.c | 3 +++ include/uapi/asm-generic/unistd.h | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c index 4912084..489ae19 100644 --- a/arch/tile/kernel/compat.c +++ b/arch/tile/kernel/compat.c @@ -94,6 +94,9 @@ COMPAT_SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned int, offset_high, #define compat_sys_readahead sys32_readahead #define sys_llseek compat_sys_llseek +#define sys_openat compat_sys_openat +#define sys_open_by_handle_at compat_sys_open_by_handle_at + /* Call the assembly trampolines where necessary. */ #define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn #define sys_clone _sys_clone diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index 1324b02..07761e5 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -175,7 +175,7 @@ __SYSCALL(__NR_fchownat, sys_fchownat) #define __NR_fchown 55 __SYSCALL(__NR_fchown, sys_fchown) #define __NR_openat 56 -__SC_COMP(__NR_openat, sys_openat, compat_sys_openat) +__SYSCALL(__NR_openat, sys_openat) #define __NR_close 57 __SYSCALL(__NR_close, sys_close) #define __NR_vhangup 58 @@ -673,8 +673,7 @@ __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) #define __NR_name_to_handle_at 264 __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) #define __NR_open_by_handle_at 265 -__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \ - compat_sys_open_by_handle_at) +__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) #define __NR_clock_adjtime 266 __SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) #define __NR_syncfs 267 -- 2.5.0 -- 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 2/2] 32-bit ABI: introduce ARCH_32BIT_OFF_T config option
All new 32-bit architectures should have 64-bit off_t type, but existing architectures has 32-bit ones. To handle it, new config option is added to arch/Kconfig that defaults ARCH_32BIT_OFF_T to be disabled by default. All existing 32-bit architectures enable it explicitly here. New option affects force_o_largefile() behaviour. Namely, if off_t is 64-bits long, we have no reason to reject user to open big files. Signed-off-by: Yury Norov --- arch/Kconfig| 4 arch/arc/Kconfig| 1 + arch/arm/Kconfig| 1 + arch/blackfin/Kconfig | 1 + arch/cris/Kconfig | 1 + arch/frv/Kconfig| 1 + arch/h8300/Kconfig | 1 + arch/hexagon/Kconfig| 1 + arch/ia64/Kconfig | 1 + arch/m32r/Kconfig | 1 + arch/m68k/Kconfig | 1 + arch/metag/Kconfig | 1 + arch/microblaze/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/mn10300/Kconfig| 1 + arch/nios2/Kconfig | 1 + arch/openrisc/Kconfig | 1 + arch/parisc/Kconfig | 1 + arch/powerpc/Kconfig| 1 + arch/s390/Kconfig | 1 + arch/score/Kconfig | 1 + arch/sh/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/tile/Kconfig | 1 + arch/unicore32/Kconfig | 1 + arch/x86/Kconfig| 1 + arch/x86/um/Kconfig | 1 + arch/xtensa/Kconfig | 1 + include/linux/fcntl.h | 3 ++- 29 files changed, 33 insertions(+), 1 deletion(-) diff --git a/arch/Kconfig b/arch/Kconfig index 4e949e5..1e5e6c8 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -233,6 +233,10 @@ config ARCH_THREAD_INFO_ALLOCATOR config ARCH_WANTS_DYNAMIC_TASK_STRUCT bool +config ARCH_32BIT_OFF_T + def_bool n + depends on !64BIT + config HAVE_REGS_AND_STACK_ACCESS_API bool help diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 6312f60..570dc39 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -9,6 +9,7 @@ config ARC def_bool y select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC + select ARCH_32BIT_OFF_T select BUILDTIME_EXTABLE_SORT select COMMON_CLK select CLONE_BACKWARDS diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 34e1569..dafdebe 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1,6 +1,7 @@ config ARM bool default y + select ARCH_32BIT_OFF_T select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index af76634..9b5fc06 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig @@ -12,6 +12,7 @@ config RWSEM_XCHGADD_ALGORITHM config BLACKFIN def_bool y + select ARCH_32BIT_OFF_T select HAVE_ARCH_KGDB select HAVE_ARCH_TRACEHOOK select HAVE_DYNAMIC_FTRACE diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index e086f9e..5bc9203 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig @@ -50,6 +50,7 @@ config LOCKDEP_SUPPORT config CRIS bool default y + select ARCH_32BIT_OFF_T select HAVE_IDE select GENERIC_ATOMIC64 select HAVE_UID16 diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index 34aa193..09b82fc 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig @@ -1,6 +1,7 @@ config FRV bool default y + select ARCH_32BIT_OFF_T select HAVE_IDE select HAVE_ARCH_TRACEHOOK select HAVE_PERF_EVENTS diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index dd3ac75..7761f4a 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -1,5 +1,6 @@ config H8300 def_bool y + select ARCH_32BIT_OFF_T select GENERIC_ATOMIC64 select HAVE_UID16 select VIRT_TO_BUS diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index 4dc89d1..29836fc 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig @@ -3,6 +3,7 @@ comment "Linux Kernel Configuration for Hexagon" config HEXAGON def_bool y + select ARCH_32BIT_OFF_T select HAVE_OPROFILE # Other pending projects/to-do items. # select HAVE_REGS_AND_STACK_ACCESS_API diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index eb0249e..370fcab 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -11,6 +11,7 @@ menu "Processor type and features" config IA64 bool + select ARCH_32BIT_OFF_T if !64BIT select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select PCI if (!IA64_HP_SIM) diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig index 9e44bbd..c6865a9 100644 --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig @@ -1,6 +1,7 @@ config M32R bool default y + select ARCH_32BIT_OFF_T select HAVE_IDE select HAVE_OPROFILE select INIT_ALL_POSSIBLE diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 498b567..e9897e4 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -
GPIO-driven RTS on TI hardware with 8250_omap driver
Hello. We are upgrading to the 4.1.x kernel for our smart metering appliance project, which is based on TI's Sitara hardware (AM335x SoC), and I decided to switch from omap-serial legacy driver to the newer 8250-based one. It marginally increases throughput efficiency, CPU cycle wise, among other goodies, but I'm looking to implement a rather important feature that is present in the legacy driver, but the newer one is lacking. Namely, our project makes use of RS232<->RS485 converters, which in turn need to consume RTS signals to switch between Rx and Tx modes at the RS485 side, due to the bus variant we use being half-duplex. However, the already manufactured hardware is already designed to make the use of certain pins to take the RTS signal from, which can only be configured as GPIO for that purpose (in other words, no "native" UART RTS) - and basically redesigning the h/w configuration now is definitely out of question. The omap-serial driver already provides FDT options for that, named "rts-gpio", "rs485-rts-active-high" etc. As far as I could ascertain, the 8250_omap driver (as well as the 8250 framework itself) at the moment lacks the means to make use of GPIO pins for that purpose. While trying to implement it myself, I noticed that the legacy driver has it made in a comparably straightforward approach, via dispatching the code to switch the pin in its .start_tx and .stop_tx handlers, and some timing adjustments. Unfortunately, the situation with 8250-based drivers is different - the aforementioned handlers are provided by the 8250_core module and are common for all drivers within the framework. At first, I thought that implementing such feature for the 8250 framework itself sounds like a good idea, but after reading this particular post: http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/271377.html I decided to comply with the point of view specified there. However, I'm not that familiar with the 8250 framework internals (or serial internals at all, for that matter), and my time is quite short, so I would appreciate much any useful directions on how to do it hardware-specific style, which functions/structs/handlers to use, etc. Of particular interest is the following part: > I don't care whether the drive does it via serial_out magic or a more > explicit hook but it doesn't belong here in core code. Any ideas/clarifications on what might be meant on that part? Regards, Ilyas G. -- 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 6/7] drivers: net: cpsw: fix error return code
Hello. On 12/26/2015 6:28 PM, Julia Lawall wrote: Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall --- drivers/net/ethernet/ti/cpsw.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 3409e80..6a76992 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2448,8 +2448,10 @@ static int cpsw_probe(struct platform_device *pdev) /* RX IRQ */ irq = platform_get_irq(pdev, 1); - if (irq < 0) + if (irq < 0) { + ret = -ENOENT; Why not just propagate an error returned by that function? goto clean_ale_ret; + } priv->irqs_table[0] = irq; ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt, @@ -2461,8 +2463,10 @@ static int cpsw_probe(struct platform_device *pdev) /* TX IRQ */ irq = platform_get_irq(pdev, 2); - if (irq < 0) + if (irq < 0) { + ret = -ENOENT; Likewise? [...] MBR, Sergei -- 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 6/7] drivers: net: cpsw: fix error return code
> > diff --git a/drivers/net/ethernet/ti/cpsw.c > > b/drivers/net/ethernet/ti/cpsw.c > > index 3409e80..6a76992 100644 > > --- a/drivers/net/ethernet/ti/cpsw.c > > +++ b/drivers/net/ethernet/ti/cpsw.c > > @@ -2448,8 +2448,10 @@ static int cpsw_probe(struct platform_device *pdev) > > > > /* RX IRQ */ > > irq = platform_get_irq(pdev, 1); > > - if (irq < 0) > > + if (irq < 0) { > > + ret = -ENOENT; > >Why not just propagate an error returned by that function? OK, I did what was done a few lines before in the same function: ndev->irq = platform_get_irq(pdev, 1); if (ndev->irq < 0) { dev_err(priv->dev, "error getting irq resource\n"); ret = -ENOENT; goto clean_ale_ret; } Maybe they should all be changed? julia > > goto clean_ale_ret; > > + } > > > > priv->irqs_table[0] = irq; > > ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt, > > @@ -2461,8 +2463,10 @@ static int cpsw_probe(struct platform_device *pdev) > > > > /* TX IRQ */ > > irq = platform_get_irq(pdev, 2); > > - if (irq < 0) > > + if (irq < 0) { > > + ret = -ENOENT; > >Likewise? > > [...] > > MBR, Sergei > > -- 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 6/7] drivers: net: cpsw: fix error return code
On 12/26/2015 8:40 PM, Julia Lawall wrote: diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 3409e80..6a76992 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2448,8 +2448,10 @@ static int cpsw_probe(struct platform_device *pdev) /* RX IRQ */ irq = platform_get_irq(pdev, 1); - if (irq < 0) + if (irq < 0) { + ret = -ENOENT; Why not just propagate an error returned by that function? OK, I did what was done a few lines before in the same function: ndev->irq = platform_get_irq(pdev, 1); if (ndev->irq < 0) { dev_err(priv->dev, "error getting irq resource\n"); ret = -ENOENT; goto clean_ale_ret; } Maybe they should all be changed? Yeah, I'd vote for it. I'm seeing no sense in overriding an actual error. [...] julia MBR, Sergei -- 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 v2 1/1] fix a dead loop when in heavy low memory
On Sun, Dec 27, 2015 at 03:39:42AM +0800, Figo wrote: > Android System UI hang when run heavy monkey stress test. What changed from v1 of this patch? Please describe that below the --- line. > > Signed-off-by: Figo I need a "full" name here, not a "short" name, sorry, before I can do anything with this patch. thanks, greg k-h -- 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 0/3] IDE-ACPI: Fine-tuning for a function
IDE is in deep freeze maintainence mode. Therefore patches that perform simplications and cleanups will not be accepted. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] nvme: consolidate kmallc + memset 0 into kzalloc
This is an API consolidation only. The use of kmalloc + memset to 0 here should be equivalent to kzalloc. Signed-off-by: Nicholas Mc Guire --- Found by coccinelle script (relaxed version of scripts/coccinelle/api/alloc/kzalloc-simple.cocci) Patch was compile tested with: x86_64_defconfig CONFIG_BLK_DEV_NVME=m Patch is against linux-next (localversion-next is -next-20151222) drivers/nvme/host/scsi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvme/host/scsi.c b/drivers/nvme/host/scsi.c index e947e29..8f447e3 100644 --- a/drivers/nvme/host/scsi.c +++ b/drivers/nvme/host/scsi.c @@ -715,7 +715,7 @@ static int nvme_trans_ext_inq_page(struct nvme_ns *ns, struct sg_io_hdr *hdr, u8 v_sup; u8 luiclr = 0x01; - inq_response = kmalloc(EXTENDED_INQUIRY_DATA_PAGE_LENGTH, GFP_KERNEL); + inq_response = kzalloc(EXTENDED_INQUIRY_DATA_PAGE_LENGTH, GFP_KERNEL); if (inq_response == NULL) return -ENOMEM; @@ -743,7 +743,6 @@ static int nvme_trans_ext_inq_page(struct nvme_ns *ns, struct sg_io_hdr *hdr, v_sup = id_ctrl->vwc; kfree(id_ctrl); - memset(inq_response, 0, EXTENDED_INQUIRY_DATA_PAGE_LENGTH); inq_response[1] = INQ_EXTENDED_INQUIRY_DATA_PAGE;/* Page Code */ inq_response[2] = 0x00;/* Page Length MSB */ inq_response[3] = 0x3C;/* Page Length LSB */ -- 2.1.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/
Re: [PATCH] ARM: dts: n900: Include adp1653 device
On Sat 2015-12-26 00:40:12, Pali Rohár wrote: > This patch adds adp1653 device into n900 DT structure. DT support in > adp1653 driver is there since v4.2-rc1 version. > > Signed-off-by: Pali Rohár Acked-by: Pavel Machek -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- 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] Fix documentation for adp1653 DT
On Sat 2015-12-26 00:37:16, Pali Rohár wrote: > Property names do not match real names needed by driver itself. > This patch fix this problem. > > Signed-off-by: Pali Rohár Acked-by: Pavel Machek Now... if someone could convert adp1653 to the LED subsystem so this is testable from the shell... Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- 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] block: add start and size to ABI documentation
Document the start and size fields (which were introduced in commit v2.5.42-215-gb288f6a) to avoid guesswork on the unit. Signed-off-by: Peter Wu --- Hi, As the meaning has not changed for over 13 years, I would like to formalize these attributes such that users can rely on it[1][2]. The sector definition was inspired by the block/stat.txt documentation. By the way, the ABI/README document is ambiguous on the meaning of "Date", is it the creation date of the documentation entry or the creation of the filesystem interface? I have chosen the latter here. Kind regards, Peter [1]: https://lkml.kernel.org/r/201012011729.18661.li...@egidy.de [2]: https://unix.stackexchange.com/questions/52215/determine-the-size-of-a-block-device#comment112867_52219 --- Documentation/ABI/testing/sysfs-block | 17 + 1 file changed, 17 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-block b/Documentation/ABI/testing/sysfs-block index 71d184d..b85a266 100644 --- a/Documentation/ABI/testing/sysfs-block +++ b/Documentation/ABI/testing/sysfs-block @@ -235,3 +235,20 @@ Description: write_same_max_bytes is 0, write same is not supported by the device. +What: /sys/block///start +Date: October 2002 +Contact: linux-bl...@vger.kernel.org +Kernel Version:2.5.43 +Description: + Starting position of the partition within the disk. + Measured in standard UNIX 512-byte sectors (not a + device-specific block size). + +What: /sys/block///size +Date: October 2002 +Contact: linux-bl...@vger.kernel.org +Kernel Version:2.5.43 +Description: + Size of the partition in standard UNIX 512-byte sectors + (not a device-specific block size). + -- 2.6.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 0/6] InfiniBand-ocrdma: Fine-tuning for some function implementations
From: Markus Elfring Date: Sat, 26 Dec 2015 19:30:54 +0100 Several update suggestions were taken into account from static source code analysis. Markus Elfring (6): One variable and jump label less in ocrdma_alloc_ucontext_pd() Delete unnecessary variable initialisations in 11 functions Returning only value constants in ocrdma_qp_state_change() Return a value from a function call in _ocrdma_modify_qp() directly Returning only value constants in ocrdma_resize_cq() Delete an unnecessary variable in ocrdma_dealloc_pd() drivers/infiniband/hw/ocrdma/ocrdma_ah.c| 2 +- drivers/infiniband/hw/ocrdma/ocrdma_hw.c| 7 +++--- drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 4 +-- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 39 +++-- 4 files changed, 20 insertions(+), 32 deletions(-) -- 2.6.3 -- 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: i2c-core: One function call less in acpi_i2c_space_handler() after error detection
On Sat, Dec 26, 2015 at 09:52:11AM +0100, SF Markus Elfring wrote: > >> The kfree() function was called in one case by the > >> acpi_i2c_space_handler() function during error handling > >> even if the passed variable "client" contained a null pointer. > > > > This is OK. kfree() is known to be NULL-tolerant and we rely on it in > > various places to keep the code simpler. > > I would appreciate if an unnecessary function call can be avoided here > so that the affected exception handling can become also a bit more efficient. Simpler code is easier to maintain. See your patch, you didn't get it correctly at your first try. Also, this is not a hot path, so I see it as a micro-optimization also adding complexity. I don't favor that. signature.asc Description: PGP signature
[PATCH 1/6] InfiniBand-ocrdma: One variable and jump label less in ocrdma_alloc_ucontext_pd()
From: Markus Elfring Date: Sat, 26 Dec 2015 17:16:00 +0100 This issue was detected by using the Coccinelle software. * Let us return directly if a call of the _ocrdma_alloc_pd() function failed. * Delete the jump label "err" and the local variable "status" then. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 583001b..374c839 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -483,19 +483,15 @@ static int ocrdma_alloc_ucontext_pd(struct ocrdma_dev *dev, struct ocrdma_ucontext *uctx, struct ib_udata *udata) { - int status = 0; - uctx->cntxt_pd = _ocrdma_alloc_pd(dev, uctx, udata); if (IS_ERR(uctx->cntxt_pd)) { - status = PTR_ERR(uctx->cntxt_pd); uctx->cntxt_pd = NULL; - goto err; + return PTR_ERR(uctx->cntxt_pd); } uctx->cntxt_pd->uctx = uctx; uctx->cntxt_pd->ibpd.device = &dev->ibdev; -err: - return status; + return 0; } static int ocrdma_dealloc_ucontext_pd(struct ocrdma_ucontext *uctx) -- 2.6.3 -- 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 2/6] InfiniBand-ocrdma: Delete unnecessary variable initialisations in 11 functions
From: Markus Elfring Date: Sat, 26 Dec 2015 18:18:18 +0100 The variable "status" will be set to an appropriate value a bit later. Thus let us omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/ocrdma/ocrdma_ah.c| 2 +- drivers/infiniband/hw/ocrdma/ocrdma_hw.c| 4 ++-- drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 4 ++-- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 12 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index 9820074..98c0abd 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c @@ -59,7 +59,7 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, struct ib_ah_attr *attr, union ib_gid *sgid, int pdid, bool *isvlan, u16 vlan_tag) { - int status = 0; + int status; struct ocrdma_eth_vlan eth; struct ocrdma_grh grh; int eth_sz; diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index 30f67be..6647aa6 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c @@ -1089,7 +1089,7 @@ mbx_err: static int ocrdma_nonemb_mbx_cmd(struct ocrdma_dev *dev, struct ocrdma_mqe *mqe, void *payload_va) { - int status = 0; + int status; struct ocrdma_mbx_rsp *rsp = payload_va; if ((mqe->hdr.spcl_sge_cnt_emb & OCRDMA_MQE_HDR_EMB_MASK) >> @@ -2842,7 +2842,7 @@ int ocrdma_mbx_destroy_srq(struct ocrdma_dev *dev, struct ocrdma_srq *srq) static int ocrdma_mbx_get_dcbx_config(struct ocrdma_dev *dev, u32 ptype, struct ocrdma_dcbx_cfg *dcbxcfg) { - int status = 0; + int status; dma_addr_t pa; struct ocrdma_mqe cmd; diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c index 86c303a..119baa3 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c @@ -608,7 +608,7 @@ static char *ocrdma_driver_dbg_stats(struct ocrdma_dev *dev) static void ocrdma_update_stats(struct ocrdma_dev *dev) { ulong now = jiffies, secs; - int status = 0; + int status; struct ocrdma_rdma_stats_resp *rdma_stats = (struct ocrdma_rdma_stats_resp *)dev->stats_mem.va; struct ocrdma_rsrc_stats *rsrc_stats = &rdma_stats->act_rsrc_stats; @@ -639,7 +639,7 @@ static ssize_t ocrdma_dbgfs_ops_write(struct file *filp, { char tmp_str[32]; long reset; - int status = 0; + int status; struct ocrdma_stats *pstats = filp->private_data; struct ocrdma_dev *dev = pstats->dev; diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 374c839..aba1b5a 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -419,7 +419,7 @@ static struct ocrdma_pd *_ocrdma_alloc_pd(struct ocrdma_dev *dev, struct ib_udata *udata) { struct ocrdma_pd *pd = NULL; - int status = 0; + int status; pd = kzalloc(sizeof(*pd), GFP_KERNEL); if (!pd) @@ -468,7 +468,7 @@ static inline int is_ucontext_pd(struct ocrdma_ucontext *uctx, static int _ocrdma_dealloc_pd(struct ocrdma_dev *dev, struct ocrdma_pd *pd) { - int status = 0; + int status; if (dev->pd_mgr->pd_prealloc_valid) status = ocrdma_put_pd_num(dev, pd->id, pd->dpp_enabled); @@ -592,7 +592,7 @@ map_err: int ocrdma_dealloc_ucontext(struct ib_ucontext *ibctx) { - int status = 0; + int status; struct ocrdma_mm *mm, *tmp; struct ocrdma_ucontext *uctx = get_ocrdma_ucontext(ibctx); struct ocrdma_dev *dev = get_ocrdma_dev(ibctx->device); @@ -619,7 +619,7 @@ int ocrdma_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) unsigned long vm_page = vma->vm_pgoff << PAGE_SHIFT; u64 unmapped_db = (u64) dev->nic_info.unmapped_db; unsigned long len = (vma->vm_end - vma->vm_start); - int status = 0; + int status; bool found; if (vma->vm_start & (PAGE_SIZE - 1)) @@ -1282,7 +1282,7 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp, struct ib_udata *udata, int dpp_offset, int dpp_credit_lmt, int srq) { - int status = 0; + int status; u64 usr_db; struct ocrdma_create_qp_uresp uresp; struct ocrdma_pd *pd = qp->pd; @@ -1946,7 +1946,7 @@ int ocrdma_modify_srq(struct ib_srq *ibsrq, enum ib_srq_attr_mask srq_attr_mask,
[PATCH 3/6] InfiniBand-ocrdma: Returning only value constants in ocrdma_qp_state_change()
From: Markus Elfring Date: Sat, 26 Dec 2015 18:28:35 +0100 Return zero at the end without using the local variable "status". Signed-off-by: Markus Elfring --- drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index 6647aa6..9a2b153 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c @@ -2110,7 +2110,6 @@ int ocrdma_qp_state_change(struct ocrdma_qp *qp, enum ib_qp_state new_ib_state, enum ib_qp_state *old_ib_state) { unsigned long flags; - int status = 0; enum ocrdma_qp_state new_state; new_state = get_ocrdma_qp_state(new_ib_state); @@ -2135,7 +2134,7 @@ int ocrdma_qp_state_change(struct ocrdma_qp *qp, enum ib_qp_state new_ib_state, qp->state = new_state; spin_unlock_irqrestore(&qp->q_lock, flags); - return status; + return 0; } static u32 ocrdma_set_create_qp_mbx_access_flags(struct ocrdma_qp *qp) -- 2.6.3 -- 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 4/6] InfiniBand-ocrdma: Return a value from a function call in _ocrdma_modify_qp() directly
From: Markus Elfring Date: Sat, 26 Dec 2015 18:40:43 +0100 Return the value from a call of the ocrdma_mbx_modify_qp() function without using an extra assignment for the local variable "status". Signed-off-by: Markus Elfring --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index aba1b5a..2de39d3 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -1491,9 +1491,7 @@ int _ocrdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, */ if (status < 0) return status; - status = ocrdma_mbx_modify_qp(dev, qp, attr, attr_mask); - - return status; + return ocrdma_mbx_modify_qp(dev, qp, attr, attr_mask); } int ocrdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, -- 2.6.3 -- 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 5/6] InfiniBand-ocrdma: Returning only value constants in ocrdma_resize_cq()
From: Markus Elfring Date: Sat, 26 Dec 2015 18:54:47 +0100 Return constant integer values without storing them in the local variable "status". Signed-off-by: Markus Elfring --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 2de39d3..7bedf44 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -1120,15 +1120,12 @@ ctx_err: int ocrdma_resize_cq(struct ib_cq *ibcq, int new_cnt, struct ib_udata *udata) { - int status = 0; struct ocrdma_cq *cq = get_ocrdma_cq(ibcq); - if (new_cnt < 1 || new_cnt > cq->max_hw_cqe) { - status = -EINVAL; - return status; - } + if (new_cnt < 1 || new_cnt > cq->max_hw_cqe) + return -EINVAL; ibcq->cqe = new_cnt; - return status; + return 0; } static void ocrdma_flush_cq(struct ocrdma_cq *cq) -- 2.6.3 -- 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] ARM: dts: omap3: Include missing bandgap data for ti-soc-thermal driver
On Sat 2015-12-26 00:32:25, Pali Rohár wrote: > Driver for omap3 with documentation is there since v4.4-rc1. > > Signed-off-by: Pali Rohár Acked-by: Pavel Machek Tested-by: Pavel Machek Thanks! Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- 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 6/6] InfiniBand-ocrdma: Delete an unnecessary variable in ocrdma_dealloc_pd()
From: Markus Elfring Date: Sat, 26 Dec 2015 19:09:23 +0100 1. Return zero in one case directly. 2. Return the value from a call of the _ocrdma_dealloc_pd() function without using an extra assignment for the local variable. 3. Remove the variable "status" in this function then. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 7bedf44..0f79a01 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -750,7 +750,6 @@ int ocrdma_dealloc_pd(struct ib_pd *ibpd) struct ocrdma_pd *pd = get_ocrdma_pd(ibpd); struct ocrdma_dev *dev = get_ocrdma_dev(ibpd->device); struct ocrdma_ucontext *uctx = NULL; - int status = 0; u64 usr_db; uctx = pd->uctx; @@ -764,11 +763,10 @@ int ocrdma_dealloc_pd(struct ib_pd *ibpd) if (is_ucontext_pd(uctx, pd)) { ocrdma_release_ucontext_pd(uctx); - return status; + return 0; } } - status = _ocrdma_dealloc_pd(dev, pd); - return status; + return _ocrdma_dealloc_pd(dev, pd); } static int ocrdma_alloc_lkey(struct ocrdma_dev *dev, struct ocrdma_mr *mr, -- 2.6.3 -- 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 6/7 v2] drivers: net: cpsw: fix error return code
Propagate the return value of platform_get_irq on failure. A simplified version of the semantic match that finds the two cases where no error code is returned at all is as follows: (http://coccinelle.lip6.fr/) // @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Julia Lawall --- v2: propagate platform_get_irq return value, at all calls drivers/net/ethernet/ti/cpsw.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 3409e80..34ce7dc 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2427,7 +2427,7 @@ static int cpsw_probe(struct platform_device *pdev) ndev->irq = platform_get_irq(pdev, 1); if (ndev->irq < 0) { dev_err(priv->dev, "error getting irq resource\n"); - ret = -ENOENT; + ret = ndev->irq; goto clean_ale_ret; } @@ -2448,8 +2448,10 @@ static int cpsw_probe(struct platform_device *pdev) /* RX IRQ */ irq = platform_get_irq(pdev, 1); - if (irq < 0) + if (irq < 0) { + ret = irq; goto clean_ale_ret; + } priv->irqs_table[0] = irq; ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt, @@ -2461,8 +2463,10 @@ static int cpsw_probe(struct platform_device *pdev) /* TX IRQ */ irq = platform_get_irq(pdev, 2); - if (irq < 0) + if (irq < 0) { + ret = irq; goto clean_ale_ret; + } priv->irqs_table[1] = irq; ret = devm_request_irq(&pdev->dev, irq, cpsw_tx_interrupt, -- 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: i2c-core: One function call less in acpi_i2c_space_handler() after error detection
>> I would appreciate if an unnecessary function call can be avoided here >> so that the affected exception handling can become also a bit more efficient. > > Simpler code is easier to maintain. There are different opinions available around the desired simplicity. > See your patch, you didn't get it correctly at your first try. I wonder myself about the circumstances on how my incomplete update suggestion did happen. > Also, this is not a hot path, I'm curious if approaches around better exception handling can eventually become a "hot topic". > so I see it as a micro-optimization I can agree to this view for this function implementation. > also adding complexity. There are the usual software development trade-offs. > I don't favor that. Thanks for your constructive feedback. Is an identifier like "free_client" a bit nicer (according to the Linux coding style recommendations) than the short jump label "err" in the discussed use case? Regards, Markus -- 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] coccinelle: api: check for propagation of error from platform_get_irq
The error return value of platform_get_irq seems to often get dropped. Signed-off-by: Julia Lawall --- scripts/coccinelle/api/platform_get_irq_return.cocci | 53 ++ 1 file changed, 53 insertions(+) diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci new file mode 100644 index 000..96fc560 --- /dev/null +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci @@ -0,0 +1,53 @@ +/// Propagate the return value of platform_get_irq. +//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0 +//# might not be an appropriate return value in an error case. +/// +// Confidence: Moderate +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2. +// URL: http://coccinelle.lip6.fr/ +// Options: --no-includes --include-headers + +virtual context +virtual org +virtual report + +// + +@r depends on context || org || report@ +constant C; +expression e, ret; +position j0, j1, j2; +@@ + +* e@j0 = platform_get_irq(...); +if (...) { + ... + ret@j1 = -C; + ... + return ret@j2; +} + +// + +@script:python r_org depends on org@ +j0 << r.j0; +j1 << r.j1; +j2 << r.j2; +@@ + +msg = "Propagate return value of platform_get_irq." +coccilib.org.print_todo(j0[0], msg) +coccilib.org.print_link(j1[0], "") +coccilib.org.print_link(j2[0], "") + +// + +@script:python r_report depends on report@ +j0 << r.j0; +j1 << r.j1; +j2 << r.j2; +@@ + +msg = "Propagate return value of platform_get_irq around lines %s,%s." % (j1[0].line,j2[0].line) +coccilib.report.print_report(j0[0], msg) + -- 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 1/6] InfiniBand-ocrdma: One variable and jump label less in ocrdma_alloc_ucontext_pd()
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system] Hi Markus, [auto build test WARNING on v4.4-rc6] [also build test WARNING on next-20151223] url: https://github.com/0day-ci/linux/commits/SF-Markus-Elfring/InfiniBand-ocrdma-Fine-tuning-for-some-function-implementations/20151227-025304 coccinelle warnings: (new ones prefixed by >>) >> drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:489:9-16: ERROR: PTR_ERR applied >> after initialization to constant on line 488 vim +489 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c 482 static int ocrdma_alloc_ucontext_pd(struct ocrdma_dev *dev, 483 struct ocrdma_ucontext *uctx, 484 struct ib_udata *udata) 485 { 486 uctx->cntxt_pd = _ocrdma_alloc_pd(dev, uctx, udata); 487 if (IS_ERR(uctx->cntxt_pd)) { > 488 uctx->cntxt_pd = NULL; > 489 return PTR_ERR(uctx->cntxt_pd); 490 } 491 492 uctx->cntxt_pd->uctx = uctx; --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -- 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 6/7] drivers: net: cpsw: fix error return code
Hello. On 12/26/2015 08:50 PM, Sergei Shtylyov wrote: diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 3409e80..6a76992 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2448,8 +2448,10 @@ static int cpsw_probe(struct platform_device *pdev) /* RX IRQ */ irq = platform_get_irq(pdev, 1); -if (irq < 0) +if (irq < 0) { +ret = -ENOENT; Why not just propagate an error returned by that function? OK, I did what was done a few lines before in the same function: ndev->irq = platform_get_irq(pdev, 1); if (ndev->irq < 0) { dev_err(priv->dev, "error getting irq resource\n"); ret = -ENOENT; goto clean_ale_ret; } Maybe they should all be changed? Yeah, I'd vote for it. I'm seeing no sense in overriding an actual error. Hm, I decided to check drivers/base/dd.c and I think I maybe know the reason now: -ENXIO, usually returned by platform_get_irq(), is silently "swallowed" by really_probe(); to be precise, -ENODEV and -ENXIO are only reported with pr_debug(), while -ENOENT causes printk(KERN_WARNING, ...)... [...] julia MBR, Sergei -- 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] coccinelle: api: check for propagation of error from platform_get_irq
On 12/26/2015 10:24 PM, Julia Lawall wrote: The error return value of platform_get_irq seems to often get dropped. Maybe it was intentional (see my recent follow-up to your netdev patch). But if an error gets unconditionally overriden, deferred probing can't work. So your patches seem good things in the end. Thank you! Signed-off-by: Julia Lawall [...] MBR, Sergei -- 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 6/7] drivers: net: cpsw: fix error return code
On Sat, 26 Dec 2015, Sergei Shtylyov wrote: > Hello. > > On 12/26/2015 08:50 PM, Sergei Shtylyov wrote: > > > > > > diff --git a/drivers/net/ethernet/ti/cpsw.c > > > > > b/drivers/net/ethernet/ti/cpsw.c > > > > > index 3409e80..6a76992 100644 > > > > > --- a/drivers/net/ethernet/ti/cpsw.c > > > > > +++ b/drivers/net/ethernet/ti/cpsw.c > > > > > @@ -2448,8 +2448,10 @@ static int cpsw_probe(struct platform_device > > > > > *pdev) > > > > > > > > > >/* RX IRQ */ > > > > >irq = platform_get_irq(pdev, 1); > > > > > -if (irq < 0) > > > > > +if (irq < 0) { > > > > > +ret = -ENOENT; > > > > > > > > Why not just propagate an error returned by that function? > > > > > > OK, I did what was done a few lines before in the same function: > > > > > > ndev->irq = platform_get_irq(pdev, 1); > > > if (ndev->irq < 0) { > > > dev_err(priv->dev, "error getting irq resource\n"); > > > ret = -ENOENT; > > > goto clean_ale_ret; > > > } > > > > > > Maybe they should all be changed? > > > > Yeah, I'd vote for it. I'm seeing no sense in overriding an actual > > error. > >Hm, I decided to check drivers/base/dd.c and I think I maybe know the > reason now: -ENXIO, usually returned by platform_get_irq(), is silently > "swallowed" by really_probe(); to be precise, -ENODEV and -ENXIO are only > reported with pr_debug(), while -ENOENT causes printk(KERN_WARNING, ...)... Sorry, I'm confused... What should it be? v1 or v2? Here are the counts of the different constants returned on failure of platform_get_irq: ENODEV: 84 ENXIO: 67 EINVAL: 61 ENOENT: 29 EBUSY: 11 EIO: 2 EPROBE_DEFER: 1 julia -- 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] coccinelle: api: check for propagation of error from platform_get_irq
On Sat, 26 Dec 2015, Sergei Shtylyov wrote: > On 12/26/2015 10:24 PM, Julia Lawall wrote: > > > The error return value of platform_get_irq seems to often get dropped. > >Maybe it was intentional (see my recent follow-up to your netdev patch). > But if an error gets unconditionally overriden, deferred probing can't work. > So your patches seem good things in the end. Thank you! Actually, this semantic patch overloos the case where a constant is returned directly, which is apparently also popular. I can update this if the whole concept is useful, but that's not clear at the moment... julia -- 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 6/7] drivers: net: cpsw: fix error return code
On 12/26/2015 11:07 PM, Julia Lawall wrote: diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 3409e80..6a76992 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2448,8 +2448,10 @@ static int cpsw_probe(struct platform_device *pdev) /* RX IRQ */ irq = platform_get_irq(pdev, 1); -if (irq < 0) +if (irq < 0) { +ret = -ENOENT; Why not just propagate an error returned by that function? OK, I did what was done a few lines before in the same function: ndev->irq = platform_get_irq(pdev, 1); if (ndev->irq < 0) { dev_err(priv->dev, "error getting irq resource\n"); ret = -ENOENT; goto clean_ale_ret; } Maybe they should all be changed? Yeah, I'd vote for it. I'm seeing no sense in overriding an actual error. Hm, I decided to check drivers/base/dd.c and I think I maybe know the reason now: -ENXIO, usually returned by platform_get_irq(), is silently "swallowed" by really_probe(); to be precise, -ENODEV and -ENXIO are only reported with pr_debug(), while -ENOENT causes printk(KERN_WARNING, ...)... Sorry, I'm confused... What should it be? v1 or v2? Here are the counts of the different constants returned on failure of platform_get_irq: I was somewhat confused myself but then I remembered about the deferred probing -- overriding error code basically just disables it in this case. ENODEV: 84 ENXIO: 67 Those 2 totally make no sense. :-) EINVAL: 61 ENOENT: 29 EBUSY: 11 Hm... EIO: 2 EPROBE_DEFER: 1 Hm, and that last one is unconditional? julia MBR, Sergei -- 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] ptrace: being capable wrt a process requires mapped uids/gids
On Sat, Dec 26, 2015 at 02:10:38AM +0100, Jann Horn wrote: > On Sat, Dec 12, 2015 at 09:12:41PM +0100, Jann Horn wrote: > > With this change, the entering process can first enter the > > namespace and then safely inspect the namespace's > > properties, e.g. through /proc/self/{uid_map,gid_map}, > > assuming that the namespace owner doesn't have access to > > uid 0. > > Actually, I think I missed something there. Well, at least it > should not directly lead to a container escape. > > > > -static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode) > > +static bool ptrace_has_cap(const struct cred *tcred, unsigned int mode) > > { > > + struct user_namespace *tns = tcred->user_ns; > > + struct user_namespace *curns = current_cred()->user_ns; > > + > > + /* When a root-owned process enters a user namespace created by a > > +* malicious user, the user shouldn't be able to execute code under > > +* uid 0 by attaching to the root-owned process via ptrace. > > +* Therefore, similar to the capable_wrt_inode_uidgid() check, > > +* verify that all the uids and gids of the target process are > > +* mapped into the current namespace. > > +* No fsuid/fsgid check because __ptrace_may_access doesn't do it > > +* either. > > +*/ > > + if (!kuid_has_mapping(curns, tcred->euid) || > > + !kuid_has_mapping(curns, tcred->suid) || > > + !kuid_has_mapping(curns, tcred->uid) || > > + !kgid_has_mapping(curns, tcred->egid) || > > + !kgid_has_mapping(curns, tcred->sgid) || > > + !kgid_has_mapping(curns, tcred->gid)) > > + return false; > > + > > if (mode & PTRACE_MODE_NOAUDIT) > > - return has_ns_capability_noaudit(current, ns, CAP_SYS_PTRACE); > > + return has_ns_capability_noaudit(current, tns, CAP_SYS_PTRACE); > > else > > - return has_ns_capability(current, ns, CAP_SYS_PTRACE); > > + return has_ns_capability(current, tns, CAP_SYS_PTRACE); > > } > > If the namespace owner can run code in the init namespace, the kuids are > mapped into curns but he is still capable wrt the target namespace. > > I think a proper fix should first determine the highest parent of > tcred->user_ns in which the caller still has privs, then do the > kxid_has_mapping() checks in there. Hi, I don't quite follow what you are concerned about. Based on the new patch you sent, I assume it's not the case where the tcred's kuid is actually mapped into the container. So is it the case where I unshare a userns which unshares a userns, then setns from the grandparent into the child? And if so, the concern is that if the setns()ing task's kuid is mappable all along into the grandhild, then container root should be able to ptrace it? thanks, -serge -- 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] coccinelle: api: check for propagation of error from platform_get_irq
The conclusion seems to be that it is useful to override the value, so we can just drop this semantic patch. julia -- 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] coccinelle: api: check for propagation of error from platform_get_irq
On 12/26/2015 11:24 PM, Julia Lawall wrote: The conclusion seems to be that it is useful to override the value, so we can just drop this semantic patch. No! As I said, unconditionally overriding an error value breaks the deferred probing. It's actually a bug to override it, so the patch seems *very* useful. julia MBR, Sergei -- 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] coccinelle: api: check for propagation of error from platform_get_irq
On Sat, 26 Dec 2015, Sergei Shtylyov wrote: > On 12/26/2015 11:24 PM, Julia Lawall wrote: > > > The conclusion seems to be that it is useful to override the value, so we > > can just drop this semantic patch. > >No! As I said, unconditionally overriding an error value breaks the > deferred probing. It's actually a bug to override it, so the patch seems > *very* useful. Ah, OK, I'll send an improved version then :) julia -- 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] ptrace: being capable wrt a process requires mapped uids/gids
On Sat, Dec 26, 2015 at 02:23:45PM -0600, Serge E. Hallyn wrote: > On Sat, Dec 26, 2015 at 02:10:38AM +0100, Jann Horn wrote: > > On Sat, Dec 12, 2015 at 09:12:41PM +0100, Jann Horn wrote: > > > With this change, the entering process can first enter the > > > namespace and then safely inspect the namespace's > > > properties, e.g. through /proc/self/{uid_map,gid_map}, > > > assuming that the namespace owner doesn't have access to > > > uid 0. > > > > Actually, I think I missed something there. Well, at least it > > should not directly lead to a container escape. > > > > > > > -static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode) > > > +static bool ptrace_has_cap(const struct cred *tcred, unsigned int mode) > > > { > > > + struct user_namespace *tns = tcred->user_ns; > > > + struct user_namespace *curns = current_cred()->user_ns; > > > + > > > + /* When a root-owned process enters a user namespace created by a > > > + * malicious user, the user shouldn't be able to execute code under > > > + * uid 0 by attaching to the root-owned process via ptrace. > > > + * Therefore, similar to the capable_wrt_inode_uidgid() check, > > > + * verify that all the uids and gids of the target process are > > > + * mapped into the current namespace. > > > + * No fsuid/fsgid check because __ptrace_may_access doesn't do it > > > + * either. > > > + */ > > > + if (!kuid_has_mapping(curns, tcred->euid) || > > > + !kuid_has_mapping(curns, tcred->suid) || > > > + !kuid_has_mapping(curns, tcred->uid) || > > > + !kgid_has_mapping(curns, tcred->egid) || > > > + !kgid_has_mapping(curns, tcred->sgid) || > > > + !kgid_has_mapping(curns, tcred->gid)) > > > + return false; > > > + > > > if (mode & PTRACE_MODE_NOAUDIT) > > > - return has_ns_capability_noaudit(current, ns, CAP_SYS_PTRACE); > > > + return has_ns_capability_noaudit(current, tns, CAP_SYS_PTRACE); > > > else > > > - return has_ns_capability(current, ns, CAP_SYS_PTRACE); > > > + return has_ns_capability(current, tns, CAP_SYS_PTRACE); > > > } > > > > If the namespace owner can run code in the init namespace, the kuids are > > mapped into curns but he is still capable wrt the target namespace. > > > > I think a proper fix should first determine the highest parent of > > tcred->user_ns in which the caller still has privs, then do the > > kxid_has_mapping() checks in there. > > Hi, > > I don't quite follow what you are concerned about. Based on the new > patch you sent, I assume it's not the case where the tcred's kuid is > actually mapped into the container. So is it the case where I > unshare a userns which unshares a userns, then setns from the grandparent > into the child? And if so, the concern is that if the setns()ing task's > kuid is mappable all along into the grandhild, then container root should > be able to ptrace it? Consider the following scenario: init_user_ns has a child namespace (I'll call it child_ns). child_ns is owned by an attacker (child_ns->owner == attacker_kuid). The attacking process has current_cred()->euid == attacker_kuid and lives in init_user_ns (which means it's capable in child_ns). The victim process (with euid==0) enters the namespace, then the attacking process tries to attach to it. ptrace_has_cap(tcred, mode) would, with my old patch, still be true because current is capable in tcred->user_ns and all kuids are mapped into init_user_ns. The new patch uses the following rule for cap checks: The caller is capable relative to a target if a user namespace exists for which all of the following conditions are true: - The caller has the requested capability inside the namespace. - The target is inside the namespace (either directly or in a child). - The target's kuids and kgids are mapped into the namespace. The first rule is enforced by the has_ns_capability(..., tns, ...) or has_ns_capability_noaudit(..., tns, ...) call at the bottom. The second rule is implicitly true because tns initially is the target's user namespace and then moves up through ->parent. The third rule is enforced by the while loop. This prevents the attack I described, but e.g. still allows someone who is capable in init_user_ns to ptrace anything, no matter in what weird namespace the target is - if a task was ptrace-able for a process before it called clone(CLONE_NEWUSER) / unshare(CLONE_NEWUSER) / setns(, CLONE_NEWUSER), it should still be ptrace-able afterwards. (Unless access was permitted based on the introspection rule.) signature.asc Description: Digital signature
[PATCH v2] coccinelle: api: check for propagation of error from platform_get_irq
The error return value of platform_get_irq seems to often get dropped. Signed-off-by: Julia Lawall --- v2: Check for the direct return case also. Added some mailing lists of common offenders. diff --git a/scripts/coccinelle/api/platform_get_irq_return.cocci b/scripts/coccinelle/api/platform_get_irq_return.cocci new file mode 100644 index 000..44680d0 --- /dev/null +++ b/scripts/coccinelle/api/platform_get_irq_return.cocci @@ -0,0 +1,58 @@ +/// Propagate the return value of platform_get_irq. +//# Sometimes the return value of platform_get_irq is tested using <= 0, but 0 +//# might not be an appropriate return value in an error case. +/// +// Confidence: Moderate +// Copyright: (C) 2015 Julia Lawall, Inria. GPLv2. +// URL: http://coccinelle.lip6.fr/ +// Options: --no-includes --include-headers + +virtual context +virtual org +virtual report + +// + +@r depends on context || org || report@ +constant C; +statement S; +expression e, ret; +position j0, j1; +@@ + +* e@j0 = platform_get_irq(...); +( +if@j1 (...) { + ... + return -C; +} else S +| +if@j1 (...) { + ... + ret = -C; + ... + return ret; +} else S +) + +// + +@script:python r_org depends on org@ +j0 << r.j0; +j1 << r.j1; +@@ + +msg = "Propagate return value of platform_get_irq." +coccilib.org.print_todo(j0[0], msg) +coccilib.org.print_link(j1[0], "") + +// + +@script:python r_report depends on report@ +j0 << r.j0; +j1 << r.j1; +@@ + +msg = "Propagate return value of platform_get_irq around line %s." % (j1[0].line) +coccilib.report.print_report(j0[0], msg) + -- 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] ptrace: being capable wrt a process requires mapped uids/gids
On Sat, Dec 26, 2015 at 09:55:50PM +0100, Jann Horn wrote: > On Sat, Dec 26, 2015 at 02:23:45PM -0600, Serge E. Hallyn wrote: > > On Sat, Dec 26, 2015 at 02:10:38AM +0100, Jann Horn wrote: > > > On Sat, Dec 12, 2015 at 09:12:41PM +0100, Jann Horn wrote: > > > > With this change, the entering process can first enter the > > > > namespace and then safely inspect the namespace's > > > > properties, e.g. through /proc/self/{uid_map,gid_map}, > > > > assuming that the namespace owner doesn't have access to > > > > uid 0. > > > > > > Actually, I think I missed something there. Well, at least it > > > should not directly lead to a container escape. > > > > > > > > > > -static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode) > > > > +static bool ptrace_has_cap(const struct cred *tcred, unsigned int mode) > > > > { > > > > + struct user_namespace *tns = tcred->user_ns; > > > > + struct user_namespace *curns = current_cred()->user_ns; > > > > + > > > > + /* When a root-owned process enters a user namespace created by > > > > a > > > > +* malicious user, the user shouldn't be able to execute code > > > > under > > > > +* uid 0 by attaching to the root-owned process via ptrace. > > > > +* Therefore, similar to the capable_wrt_inode_uidgid() check, > > > > +* verify that all the uids and gids of the target process are > > > > +* mapped into the current namespace. > > > > +* No fsuid/fsgid check because __ptrace_may_access doesn't do > > > > it > > > > +* either. > > > > +*/ > > > > + if (!kuid_has_mapping(curns, tcred->euid) || > > > > + !kuid_has_mapping(curns, tcred->suid) || > > > > + !kuid_has_mapping(curns, tcred->uid) || > > > > + !kgid_has_mapping(curns, tcred->egid) || > > > > + !kgid_has_mapping(curns, tcred->sgid) || > > > > + !kgid_has_mapping(curns, tcred->gid)) > > > > + return false; > > > > + > > > > if (mode & PTRACE_MODE_NOAUDIT) > > > > - return has_ns_capability_noaudit(current, ns, > > > > CAP_SYS_PTRACE); > > > > + return has_ns_capability_noaudit(current, tns, > > > > CAP_SYS_PTRACE); > > > > else > > > > - return has_ns_capability(current, ns, CAP_SYS_PTRACE); > > > > + return has_ns_capability(current, tns, CAP_SYS_PTRACE); > > > > } > > > > > > If the namespace owner can run code in the init namespace, the kuids are > > > mapped into curns but he is still capable wrt the target namespace. > > > > > > I think a proper fix should first determine the highest parent of > > > tcred->user_ns in which the caller still has privs, then do the > > > kxid_has_mapping() checks in there. > > > > Hi, > > > > I don't quite follow what you are concerned about. Based on the new > > patch you sent, I assume it's not the case where the tcred's kuid is > > actually mapped into the container. So is it the case where I > > unshare a userns which unshares a userns, then setns from the grandparent > > into the child? And if so, the concern is that if the setns()ing task's > > kuid is mappable all along into the grandhild, then container root should > > be able to ptrace it? > > Consider the following scenario: > > init_user_ns has a child namespace (I'll call it child_ns). > child_ns is owned by an attacker (child_ns->owner == attacker_kuid). > The attacking process has current_cred()->euid == attacker_kuid and lives > in init_user_ns (which means it's capable in child_ns). Ah, right. Special. Thanks. -serge -- 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/