Re: [RFC] mm/migrate: Add new migration reason MR_HUGETLB

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 08:37:14, Anshuman Khandual wrote:
> alloc_contig_range() initiates compaction and eventual migration for
> the purpose of either CMA or HugeTLB allocation. At present, reason
> code remains the same MR_CMA for either of those cases. Lets add a
> new reason code which will differentiate the purpose of migration
> as HugeTLB allocation instead.

Why do we need it?

> Signed-off-by: Anshuman Khandual 
> ---
>  include/linux/migrate.h|  1 +
>  include/trace/events/migrate.h |  3 ++-
>  mm/page_alloc.c| 14 ++
>  3 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/migrate.h b/include/linux/migrate.h
> index a732598fcf83..44381c33a2bd 100644
> --- a/include/linux/migrate.h
> +++ b/include/linux/migrate.h
> @@ -26,6 +26,7 @@ enum migrate_reason {
>   MR_MEMPOLICY_MBIND,
>   MR_NUMA_MISPLACED,
>   MR_CMA,
> + MR_HUGETLB,
>   MR_TYPES
>  };
>  
> diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h
> index bcf4daccd6be..61474c93f8f3 100644
> --- a/include/trace/events/migrate.h
> +++ b/include/trace/events/migrate.h
> @@ -20,7 +20,8 @@
>   EM( MR_SYSCALL, "syscall_or_cpuset")\
>   EM( MR_MEMPOLICY_MBIND, "mempolicy_mbind")  \
>   EM( MR_NUMA_MISPLACED,  "numa_misplaced")   \
> - EMe(MR_CMA, "cma")
> + EM( MR_CMA, "cma")  \
> + EMe(MR_HUGETLB, "hugetlb")
>  
>  /*
>   * First define the enums in the above macros to be exported to userspace
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 242565855d05..ce8a2f2d4994 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7588,13 +7588,14 @@ static unsigned long pfn_max_align_up(unsigned long 
> pfn)
>  
>  /* [start, end) must belong to a single zone. */
>  static int __alloc_contig_migrate_range(struct compact_control *cc,
> - unsigned long start, unsigned long end)
> + unsigned long start, unsigned long end,
> + unsigned migratetype)
>  {
>   /* This function is based on compact_zone() from compaction.c. */
>   unsigned long nr_reclaimed;
>   unsigned long pfn = start;
>   unsigned int tries = 0;
> - int ret = 0;
> + int ret = 0, migrate_reason = 0;
>  
>   migrate_prep();
>  
> @@ -7621,8 +7622,13 @@ static int __alloc_contig_migrate_range(struct 
> compact_control *cc,
>   &cc->migratepages);
>   cc->nr_migratepages -= nr_reclaimed;
>  
> + if (migratetype == MIGRATE_CMA)
> + migrate_reason = MR_CMA;
> + else
> + migrate_reason = MR_HUGETLB;
> +
>   ret = migrate_pages(&cc->migratepages, new_page_alloc_contig,
> - NULL, 0, cc->mode, MR_CMA);
> + NULL, 0, cc->mode, migrate_reason);
>   }
>   if (ret < 0) {
>   putback_movable_pages(&cc->migratepages);
> @@ -7710,7 +7716,7 @@ int alloc_contig_range(unsigned long start, unsigned 
> long end,
>* allocated.  So, if we fall through be sure to clear ret so that
>* -EBUSY is not accidentally used or returned to caller.
>*/
> - ret = __alloc_contig_migrate_range(&cc, start, end);
> + ret = __alloc_contig_migrate_range(&cc, start, end, migratetype);
>   if (ret && ret != -EBUSY)
>   goto done;
>   ret =0;
> -- 
> 2.11.0
> 

-- 
Michal Hocko
SUSE Labs


Re: [RFC PATCH 2/5] sched: Add NOHZ_STATS_KICK

2018-01-30 Thread Vincent Guittot
On 29 January 2018 at 19:43, Dietmar Eggemann  wrote:
> On 01/24/2018 09:25 AM, Vincent Guittot wrote:
>>
>> Hi,
>>
>> Le Thursday 18 Jan 2018 à 10:38:07 (+), Morten Rasmussen a écrit :
>>>
>>> On Mon, Jan 15, 2018 at 09:26:09AM +0100, Vincent Guittot wrote:

 Le Wednesday 03 Jan 2018 à 10:16:00 (+0100), Vincent Guittot a écrit :
>
>
> [...]
>
>

 Hi Peter,

 With the patch below on top of your branch, the blocked loads are
 updated and
 decayed regularly. The main differences are:
 - It doesn't use a timer to trig ilb but the tick and when a cpu becomes
 idle.
The main drawback of this solution is that the load is blocked when
 the
system is fully idle with the advantage of not waking up a fully idle
system. We have to wait for the next tick or newly idle event for
 updating
blocked load when the system leaves idle stat which can be up to a
 tick long.
If this is too long, we can check for kicking ilb when task wakes up
 so the
blocked load will be updated as soon as the system leaves idle state.
The main advantage is that we don't wake up a fully idle system every
 32ms to
update blocked load that will be not used.
 - I'm working on one more improvement to use nohz_idle_balance in the
 newly
idle case when the system is not overloaded and
(this_rq->avg_idle > sysctl_sched_migration_cost). In this case, we
 can try to
use nohz_idle_balance with NOHZ_STATS_KICK and abort as soon as it
 exceed
this_rq->avg_idle. This will remove some calls to kick_ilb and some
 wake up
of an idle cpus.
>>>
>>>
>>> This sound like what I meant in my other reply :-)
>>>
>>> It seems pointless to have a timer to update PELT if the system is
>>> completely idle, and when it isn't we can piggy back other events to
>>> make the updates happen.
>>
>>
>> The patch below implements what has been described above. It calls part of
>> nohz_idle_balance when a cpu becomes idle and kick a ilb if it takes too
>> much
>> time. This removes part of ilb that are kicked on an idle cpu for updating
>> the blocked load but the ratio really depends on when the tick happens
>> compared
>> to a cpu becoming idle and the 32ms boundary. I have an additionnal patch
>> that
>> enables to update the blocked loads when a cpu becomes idle 1 period
>> before
>> kicking an ilb and there is far less ilb because we give more chance to
>> the
>> newly idle case (time_after is replaced by time_after_eq in
>> idle_balance()).
>>
>> The patch also uses a function cfs_rq_has_blocked, which only checks the
>> util/load_avg, instead of the cfs_rq_is_decayed which check *_sum too.
>> This
>> reduce significantly the number of update of blocked load. the *_avg will
>> be
>> fully decayed in around 300~400ms but it's far longer for the *_sum which
>> have
>> a higher resolution and we can easily reach almost seconds. But only the
>> *_avg
>> are used to make decision so keeping some blocked *_sum is acceptable.
>>
>> ---
>>   kernel/sched/fair.c | 121
>> +++-
>>   1 file changed, 92 insertions(+), 29 deletions(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 898785d..ed90303 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -7356,6 +7356,17 @@ static inline bool cfs_rq_is_decayed(struct cfs_rq
>> *cfs_rq)
>> return true;
>>   }
>>   +static inline bool cfs_rq_has_blocked(struct cfs_rq *cfs_rq)
>> +{
>> +   if (cfs_rq->avg.load_avg)
>> +   return true;
>> +
>> +   if (cfs_rq->avg.util_avg)
>> +   return true;
>> +
>> +   return false;
>> +}
>> +
>
>
> Can we not change cfs_rq_is_decayed() to use avg.foo_avg instead of
> avg.foo_sum ?

I don't think so because the *_sum are used to keep coherency bewteen
cfs_rq and cgroups when task migrates and are enqueued/dequeued so wwe
can't remove it until the *_sum are null otherwise the all cfs_rq and
group will be out of sync

>
>>   #ifdef CONFIG_FAIR_GROUP_SCHED
>> static void update_blocked_averages(int cpu)
>> @@ -7393,7 +7404,9 @@ static void update_blocked_averages(int cpu)
>>  */
>> if (cfs_rq_is_decayed(cfs_rq))
>> list_del_leaf_cfs_rq(cfs_rq);
>> -   else
>> +
>> +   /* Don't need periodic decay once load/util_avg are null
>> */
>> +   if (cfs_rq_has_blocked(cfs_rq))
>> done = false;
>> }
>>   @@ -7463,7 +7476,7 @@ static inline void update_blocked_averages(int
>> cpu)
>> update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq);
>>   #ifdef CONFIG_NO_HZ_COMMON
>> rq->last_blocked_load_update_tick = jiffies;
>> -   if (cfs_rq_is_decayed(cfs_rq))
>> +   if (cfs_rq_has_blocked(cfs_rq))
>
>
> Schouldn't this be !cfs_rq_has_blocked(cfs_rq) ?

yes. I copy/

Re: [PATCH v2] of: use hash based search in of_find_node_by_phandle

2018-01-30 Thread Chintan Pandya

(1)

Can you point me to the driver code that is invoking
the search?

There are many locations. Few of them being,
https://source.codeaurora.org/quic/la/kernel/msm-4.9/tree/drivers/of/irq.c?h=msm-4.9#n214
https://source.codeaurora.org/quic/la/kernel/msm-4.9/tree/drivers/irqchip/irq-gic-v3.c?h=msm-4.9#n1107
https://source.codeaurora.org/quic/la/kernel/msm-4.9/tree/drivers/clk/msm/msm-clock-controller.c?h=msm-4.9#n492


(2)

And also the .dts devicetree source file that you are seeing
large overhead with.

SDM670 DTS tree starts here.
https://source.codeaurora.org/quic/la/kernel/msm-4.9/tree/arch/arm64/boot/dts/qcom/sdm670.dtsi?h=msm-4.9



(3) -- this one is less important, but if the info is easily
available to you

Sorry about dribbling out questions instead of all at once

What is the hardware you are testing this on?

SDM670

Processor?

Kryo-300 Silver

Cache size?

From DT,
L1 32KB (per CPU)
L2 128KB (per CPU)
L3 1MB (total)

Memory size?

6GB

Processor frequency?

Max 1.7GHz for core 0. Not sure about boot time frequency.

Any other attribute of the system that will help me understand
the boot performance you are seeing?

I'm not able to profile of_find_node_by_phandle specifically as timers are
not up by then. So, just observing overall boot time for comparison.

My recent results were taken on debug_defconfig which has many performance
slowing code. So, gap between base-build and w/ the test patches would be
more than the actual production build.

Thanks,
Chintan

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



Re: [PATCH -next v3 1/2] mtd: nand: toshiba: Retrieve ECC requirements from extended ID

2018-01-30 Thread Boris Brezillon
On Tue, 30 Jan 2018 08:44:30 +0900
KOBAYASHI Yoshitake  wrote:

> On 2017/12/27 15:06, KOBAYASHI Yoshitake wrote:
> > On 2017/12/19 20:56, Boris Brezillon wrote:  
> >> On Tue, 19 Dec 2017 20:42:36 +0900
> >> KOBAYASHI Yoshitake  wrote:
> >>  
> >>> On 2017/12/07 0:08, Boris Brezillon wrote:  
>  On Wed,  6 Dec 2017 23:04:57 +0900
>  KOBAYASHI Yoshitake  wrote:
>  
> > This patch enables support to read the ECC strength and size from the
> > NAND flash using Toshiba Memory SLC NAND extended-ID. This patch is
> > based on the information of the 6th ID byte of the Toshiba Memory SLC
> > NAND.
> >
> > Signed-off-by: KOBAYASHI Yoshitake 
> > ---
> >  drivers/mtd/nand/nand_toshiba.c | 28 
> >  1 file changed, 28 insertions(+)
> >
> > diff --git a/drivers/mtd/nand/nand_toshiba.c 
> > b/drivers/mtd/nand/nand_toshiba.c
> > index 57df857..c2c141b 100644
> > --- a/drivers/mtd/nand/nand_toshiba.c
> > +++ b/drivers/mtd/nand/nand_toshiba.c
> > @@ -35,6 +35,34 @@ static void toshiba_nand_decode_id(struct nand_chip 
> > *chip)
> > (chip->id.data[5] & 0x7) == 0x6 /* 24nm */ &&
> > !(chip->id.data[4] & 0x80) /* !BENAND */)
> > mtd->oobsize = 32 * mtd->writesize >> 9;
> > +
> > +   /*
> > +* Extract ECC requirements from 6th id byte.
> > +* For Toshiba SLC, ecc requrements are as follows:
> > +*  - 43nm: 1 bit ECC for each 512Byte is required.
> > +*  - 32nm: 4 bit ECC for each 512Byte is required.
> > +*  - 24nm: 8 bit ECC for each 512Byte is required.
> > +*/
> > +   if (chip->id.len >= 6 && nand_is_slc(chip)) {
> > +   chip->ecc_step_ds = 512;
> > +   switch (chip->id.data[5] & 0x7) {
> > +   case 0x4:
> > +   chip->ecc_strength_ds = 1;
> > +   break;
> > +   case 0x5:
> > +   chip->ecc_strength_ds = 4;
> > +   break;
> > +   case 0x6:
> > +   chip->ecc_strength_ds = 8;
> > +   break;
> > +   default:
> > +   WARN(1, "Could not get ECC info");
> > +   chip->ecc_step_ds = 0;
> > +   break;
> > +   }
> > +   } else if (chip->id.len < 6 && nand_is_slc(chip)) {
> > +   WARN(1, "Could not get ECC info, 6th nand id byte does 
> > not exist.");
> 
>  I'm pretty sure you have old NAND chips that do not have 6bytes ids
>  (see the table here [1]), and printing a huge backtrace in this case is
>  probably not what you want.
> 
>  If you're okay with dropping this else block, I'll do the change when
>  applying, no need to send a new version.
> >>>
> >>> Some controllers may have limitation in reading ids beyond 5 bytes, 
> >>> considering such scenario we think it is better to keep this warning.
> >>> However if you feel huge backtrace is an issue, how about we using 
> >>> pr_warn() instead?
> >>>  
> >>
> >> Toshiba NANDs with an id smaller than 6 bytes exist, so no, we should
> >> not complain at all. If the controller is broken and can't read the 8 id
> >> bytes the core is asking for, then it should be detected at the core
> >> level not in the NAND manufacturer driver.  
> > 
> > I understood your opinion. Please apply this patch with dropping the else 
> > block.  
> 
> Should I repost patch with else block dropped? Please let me know if that is 
> necessary.

I forgot to apply it :-/. Please, send a new version so I can track
it in patchwork.

Thanks,

Boris


v4.15 and I/O hang with BFQ

2018-01-30 Thread Oleksandr Natalenko

Hi, Paolo, Ivan, Ming et al.

It looks like I've just encountered the issue Ivan has already described 
in [1]. Since I'm able to reproduce it reliably in a VM, I'd like to 
draw more attention to it.


First, I'm using v4.15 kernel with all pending BFQ fixes:

===
2ad909a300c4 bfq-iosched: don't call bfqg_and_blkg_put for 
!CONFIG_BFQ_GROUP_IOSCHED

83c97a310f83 block, bfq: release oom-queue ref to root group on exit
5b9eb4716af1 block, bfq: put async queues for root bfq groups too
3c5529454a27 block, bfq: limit sectors served with interactive weight 
raising

e6c72be3486b block, bfq: limit tags for writes and async I/O
e579b91d96ce block, bfq: increase threshold to deem I/O as random
f6cbc16aac88 block, bfq: remove superfluous check in queue-merging setup
8045d8575183 block, bfq: let a queue be merged only shortly after 
starting I/O

242954975f5e block, bfq: check low_latency flag in bfq_bfqq_save_state()
8349c1bddd95 block, bfq: add missing rq_pos_tree update on rq removal
558200440cb9 block, bfq: fix occurrences of request finish method's old 
name
6ed2f47ee870 block, bfq: consider also past I/O in soft real-time 
detection

e5f295dd18f2 block, bfq: remove batches of confusing ifdefs
===

Next, I boot an Arch VM with this kernel and emulated USB stick 
attached:


===
qemu-system-x86_64 -display gtk,gl=on -machine q35,accel=kvm -cpu 
host,+vmx -enable-kvm -drive 
if=pflash,format=raw,readonly,file=/mnt/vms/ovmf/code.img -drive 
if=pflash,format=raw,file=/mnt/vms/ovmf/vars.img -cdrom 
/mnt/vms/ovmf/shell.iso -netdev user,id=user.0 -device 
virtio-net,netdev=user.0 -usb -device nec-usb-xhci,id=xhci -device 
usb-tablet,bus=xhci.0 -serial stdio -m 512 -hda sda.img -hdb sdb.img 
-smp 4 -drive if=none,id=stick,file=usb.img -device 
usb-storage,bus=xhci.0,drive=stick

===

Within the VM itself I use udev rule to set the I/O scheduler:

===
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/scheduler}="bfq"
===

Things boot and work fine until I try to create a partition on the 
emulated USB stick with cfdisk. On writing a new partition table it 
blocks, and I get the following stacktrace:


===
[  225.670702] INFO: task cfdisk:416 blocked for more than 20 seconds.
[  225.681427]   Not tainted 4.15.0-pf1 #1
[  225.685341] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" 
disables this message.

[  225.691910] cfdisk  D0   416407 0x
[  225.700777] Call Trace:
[  225.703654]  ? __schedule+0x35f/0x1000
[  225.706990]  ? __switch_to_asm+0x40/0x70
[  225.709943]  ? __switch_to_asm+0x34/0x70
[  225.712224]  ? __switch_to_asm+0x40/0x70
[  225.714225]  ? __switch_to_asm+0x40/0x70
[  225.716790]  schedule+0x32/0xc0
[  225.718355]  io_schedule+0x12/0x40
[  225.719747]  wait_on_page_bit+0xea/0x130
[  225.721266]  ? add_to_page_cache_lru+0xe0/0xe0
[  225.722622]  __filemap_fdatawait_range+0xbf/0x110
[  225.724625]  ? preempt_count_sub+0x50/0x90
[  225.726591]  ? sync_inodes_one_sb+0x20/0x20
[  225.727507]  filemap_fdatawait_keep_errors+0x1a/0x40
[  225.728491]  iterate_bdevs+0xa7/0x140
[  225.729304]  sys_sync+0x7c/0xb0
[  225.730095]  entry_SYSCALL_64_fastpath+0x20/0x83
[  225.732420] RIP: 0033:0x7f2631cf4a17
===

I've tried it several times with the same result. Next, I reboot the 
system, change the scheduler to Kyber, and then I can create a new 
partition successfully.


I also went further. While having Kyber activated to work with an 
emulated USB stick properly, I create RAID10 on it, then I create LVM 
PV, then VG, then LV, then XFS on top of that, then I set I/O scheduler 
back to BFQ, then reboot, and on reboot mdadm gets blocked while 
discovering things, producing the following stacktrace:


===
[   41.350763] INFO: task mdadm:354 blocked for more than 20 seconds.
[   41.356154]   Not tainted 4.15.0-pf1 #1
[   41.358674] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" 
disables this message.

[   41.363046] mdadm   D0   354352 0x0100
[   41.368700] Call Trace:
[   41.370417]  ? __schedule+0x35f/0x1000
[   41.372668]  ? blk_queue_exit+0x3e/0x60
[   41.374816]  ? generic_make_request+0x12f/0x2d0
[   41.377363]  schedule+0x32/0xc0
[   41.380416]  io_schedule+0x12/0x40
[   41.382698]  __blkdev_direct_IO_simple+0x206/0x360
[   41.382707]  ? bdget+0x120/0x120
[   41.382714]  ? blkdev_direct_IO+0x3a5/0x3f0
[   41.382718]  blkdev_direct_IO+0x3a5/0x3f0
[   41.382724]  ? current_time+0x18/0x70
[   41.382731]  ? __atime_needs_update+0x7f/0x190
[   41.382743]  ? generic_file_read_iter+0x8c/0x9d0
[   41.382747]  generic_file_read_iter+0x8c/0x9d0
[   41.382759]  ? __seccomp_filter+0x3b/0x260
[   41.382765]  __vfs_read+0xf5/0x170
[   41.382772]  vfs_read+0x91/0x130
[   41.382778]  SyS_read+0x52/0xc0
[   41.382819]  do_syscall_64+0x67/0x1a0
[   41.382828]  entry_SYSCALL64_slow_path+0x25/0x25
[   41.382833] RIP: 0033:0x7f4b8088a3a1
[   41.382836] RSP: 002b:7ffdd681def8 EFLAGS: 0246 ORIG_RAX: 

[   41.382841] RAX: ffda RBX: 

Re: [PATCH] Lock mmap_sem when calling migrate_pages() in do_move_pages_to_node()

2018-01-30 Thread Michal Hocko
On Mon 29-01-18 22:00:11, Zi Yan wrote:
> From: Zi Yan 
> 
> migrate_pages() requires at least down_read(mmap_sem) to protect
> related page tables and VMAs from changing. Let's do it in
> do_page_moves() for both do_move_pages_to_node() and
> add_page_for_migration().
> 
> Also add this lock requirement in the comment of migrate_pages().

This doesn't make much sense to me, to be honest. We are holding
mmap_sem for _read_ so we allow parallel updates like page faults
or unmaps. Therefore we are isolating pages prior to the migration.

The sole purpose of the mmap_sem in add_page_for_migration is to protect
from vma going away _while_ need it to get the proper page.

Moving the lock up is just wrong because it allows caller to hold the
lock for way too long if a lot of pages is migrated. Not only that,
it is even incorrect because we are doing get_user() (aka page fault)
and while read lock recursion is OK, we might block and deadlock when
there is a writer pending. I haven't checked the current implementation
of semaphores but I believe we do not allow recursive locking.

> Signed-off-by: Zi Yan 
> ---
>  mm/migrate.c | 13 +++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 5d0dc7b85f90..52d029953c32 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1354,6 +1354,9 @@ static int unmap_and_move_huge_page(new_page_t 
> get_new_page,
>   * or free list only if ret != 0.
>   *
>   * Returns the number of pages that were not migrated, or an error code.
> + *
> + * The caller must hold at least down_read(mmap_sem) for to-be-migrated pages
> + * to protect related page tables and VMAs from changing.
>   */
>  int migrate_pages(struct list_head *from, new_page_t get_new_page,
>   free_page_t put_new_page, unsigned long private,
> @@ -1457,6 +1460,12 @@ static int store_status(int __user *status, int start, 
> int value, int nr)
>   return 0;
>  }
>  
> +/*
> + * Migrates the pages from pagelist and put back those not migrated.
> + *
> + * The caller must at least hold down_read(mmap_sem), which is required
> + * for migrate_pages()
> + */
>  static int do_move_pages_to_node(struct mm_struct *mm,
>   struct list_head *pagelist, int node)
>  {
> @@ -1487,7 +1496,6 @@ static int add_page_for_migration(struct mm_struct *mm, 
> unsigned long addr,
>   unsigned int follflags;
>   int err;
>  
> - down_read(&mm->mmap_sem);
>   err = -EFAULT;
>   vma = find_vma(mm, addr);
>   if (!vma || addr < vma->vm_start || !vma_migratable(vma))
> @@ -1540,7 +1548,6 @@ static int add_page_for_migration(struct mm_struct *mm, 
> unsigned long addr,
>*/
>   put_page(page);
>  out:
> - up_read(&mm->mmap_sem);
>   return err;
>  }
>  
> @@ -1561,6 +1568,7 @@ static int do_pages_move(struct mm_struct *mm, 
> nodemask_t task_nodes,
>  
>   migrate_prep();
>  
> + down_read(&mm->mmap_sem);
>   for (i = start = 0; i < nr_pages; i++) {
>   const void __user *p;
>   unsigned long addr;
> @@ -1628,6 +1636,7 @@ static int do_pages_move(struct mm_struct *mm, 
> nodemask_t task_nodes,
>   if (!err)
>   err = err1;
>  out:
> + up_read(&mm->mmap_sem);
>   return err;
>  }
>  
> -- 
> 2.15.1

-- 
Michal Hocko
SUSE Labs


Re: [netfilter-core] kernel panic: Out of memory and no killable processes... (2)

2018-01-30 Thread Florian Westphal
Michal Hocko  wrote:
> On Mon 29-01-18 23:35:22, Florian Westphal wrote:
> > Kirill A. Shutemov  wrote:
> [...]
> > > I hate what I'm saying, but I guess we need some tunable here.
> > > Not sure what exactly.
> > 
> > Would memcg help?
> 
> That really depends. I would have to check whether vmalloc path obeys
> __GFP_ACCOUNT (I suspect it does except for page tables allocations but
> that shouldn't be a big deal). But then the other potential problem is
> the life time of the xt_table_info (or other potentially large) data
> structures. Are they bound to any process life time.

No.

> Because if they are
> not then the OOM killer will not help. The OOM panic earlier in this
> thread suggests it doesn't because the test case managed to eat all the
> available memory and killed all the eligible tasks which didn't help.

Yes, which is why we do not want any OOM killer invocation in first
place...

> So in some sense the memcg would help to stop the excessive allocation,
> but it wouldn't resolve it other than kill all tasks in the affected
> memcg/container. Whether this is sufficient or not, I dunno. It sounds
> quite suboptimal to me. But it is true this would be less tricky then
> adding a global knob...

Global knob doesn't really help at all, I can add multiple large
iptables rulesets (so we would have to account), and we have same issue
in virtually all of networking, so we need limits for interface count,
tunnel count, ipsec policies/SAs, nftables, tc, etc etc.


Re: v4.15 and I/O hang with BFQ

2018-01-30 Thread Ming Lei
Hi,

On Tue, Jan 30, 2018 at 09:05:26AM +0100, Oleksandr Natalenko wrote:
> Hi, Paolo, Ivan, Ming et al.
> 
> It looks like I've just encountered the issue Ivan has already described in
> [1]. Since I'm able to reproduce it reliably in a VM, I'd like to draw more
> attention to it.
> 
> First, I'm using v4.15 kernel with all pending BFQ fixes:
> 
> ===
> 2ad909a300c4 bfq-iosched: don't call bfqg_and_blkg_put for
> !CONFIG_BFQ_GROUP_IOSCHED
> 83c97a310f83 block, bfq: release oom-queue ref to root group on exit
> 5b9eb4716af1 block, bfq: put async queues for root bfq groups too
> 3c5529454a27 block, bfq: limit sectors served with interactive weight
> raising
> e6c72be3486b block, bfq: limit tags for writes and async I/O
> e579b91d96ce block, bfq: increase threshold to deem I/O as random
> f6cbc16aac88 block, bfq: remove superfluous check in queue-merging setup
> 8045d8575183 block, bfq: let a queue be merged only shortly after starting
> I/O
> 242954975f5e block, bfq: check low_latency flag in bfq_bfqq_save_state()
> 8349c1bddd95 block, bfq: add missing rq_pos_tree update on rq removal
> 558200440cb9 block, bfq: fix occurrences of request finish method's old name
> 6ed2f47ee870 block, bfq: consider also past I/O in soft real-time detection
> e5f295dd18f2 block, bfq: remove batches of confusing ifdefs
> ===
> 
> Next, I boot an Arch VM with this kernel and emulated USB stick attached:
> 
> ===
> qemu-system-x86_64 -display gtk,gl=on -machine q35,accel=kvm -cpu host,+vmx
> -enable-kvm -drive if=pflash,format=raw,readonly,file=/mnt/vms/ovmf/code.img
> -drive if=pflash,format=raw,file=/mnt/vms/ovmf/vars.img -cdrom
> /mnt/vms/ovmf/shell.iso -netdev user,id=user.0 -device
> virtio-net,netdev=user.0 -usb -device nec-usb-xhci,id=xhci -device
> usb-tablet,bus=xhci.0 -serial stdio -m 512 -hda sda.img -hdb sdb.img -smp 4
> -drive if=none,id=stick,file=usb.img -device
> usb-storage,bus=xhci.0,drive=stick
> ===
> 
> Within the VM itself I use udev rule to set the I/O scheduler:
> 
> ===
> ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/scheduler}="bfq"
> ===

We knew there is IO hang issue on BFQ over USB-storage wrt. blk-mq, and
last time I found it is inside BFQ. You can try the debug patch in the
following link[1] to see if it is same with the previous report[1][2]:

[1] https://marc.info/?l=linux-block&m=151214241518562&w=2
[2] https://bugzilla.kernel.org/show_bug.cgi?id=198023

If you aren't sure if they are same, please post the trace somewhere,
then I can check if it is a new bug.

Or Paolo should know if the issue is fixed or not in V4.15.

Thanks,
Ming


Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread David Woodhouse
On Mon, 2018-01-29 at 16:23 -0800, Linus Torvalds wrote:
>   And the "big hammer" approach to spectre would seem to
> be to just make sure the BTB and RSB are flushed at vmexit time - and
> even then you might decide that you really want to just move it to
> vmenter time, and only do it if the VM has changed since last time
> (per CPU).

The IBPB which flushes the BTB is *expensive*; we really want to reduce
the amount we do that. For VM guests it's not so bad — we do it only on
VMPTRLD which is sufficient to ensure it's done between running one
vCPU and the next. And if vCPUs are pinned to pCPUs that means we
basically never do it.

Even for userspace we've mostly settled on a heuristic where we only do
the IBPB flush for non-dumpable processes, precisely because it's so
expensive.

> Why do you even _care_ about the guest, and how it acts wrt Skylake?
> What you should care about is not so much the guests (which do their
> own thing) but protect guests from each other, no?

Well yes, that's the part we had to fix before anyone was allowed to
sleep. But customers kind of care about security *within* their part
too, and we care about customers. :)

Sure, the cloud *enables* a model where a given VM guest is just a
single-tenant standalone compute job, and the kernel is effectively
just a library to provide services to the application. In some sense
it's all about the app, and you might as well be using uCLinux from the
security point of view. So *some* (perhaps even *many*) guests don't
need to care.

But there are still plenty who *do* need to care, for various reasons.


smime.p7s
Description: S/MIME cryptographic signature


Re: [PATCH] IB/cxgb3: remove cxio_dbg.c

2018-01-30 Thread LABBE Corentin
On Sun, Jan 28, 2018 at 02:09:03PM -0700, Jason Gunthorpe wrote:
> On Sun, Jan 28, 2018 at 08:24:22AM -0800, Joe Perches wrote:
> > On Sun, 2018-01-28 at 15:11 +, Corentin Labbe wrote:
> > > cxio_dbg.c is uncompiled since commit 2b540355cd2f ("RDMA/cxgb3: 
> > > cleanups")
> > > 10 years after, we could remove it.
> > 
> > OK, now you could remove the prototypes and probably
> > CONFIG_INFINIBAND_CXGB3_DEBUG too.
> > 
> > There is a DEBUG test and many uses of pr_debug
> > that would have modified behavior.
> > 
> > The pr_debug uses would only be emitted via a
> > dynamic_debug enable and the #ifdef DEBUG is
> > probably not necessary or useful as it guards
> > a BUG_ON.
> > 
> >  drivers/infiniband/hw/cxgb3/Kconfig| 9 -
> >  drivers/infiniband/hw/cxgb3/Makefile   | 2 --
> >  drivers/infiniband/hw/cxgb3/cxio_hal.h | 9 -
> >  drivers/infiniband/hw/cxgb3/iwch_cq.c  | 7 ---
> >  4 files changed, 27 deletions(-)
> 
> Yes, can you resend the patch with Joe's hunks as well?
> 

Yes I will do

Regards


Re: [netfilter-core] kernel panic: Out of memory and no killable processes... (2)

2018-01-30 Thread Kirill A. Shutemov
On Tue, Jan 30, 2018 at 09:11:27AM +0100, Florian Westphal wrote:
> Michal Hocko  wrote:
> > On Mon 29-01-18 23:35:22, Florian Westphal wrote:
> > > Kirill A. Shutemov  wrote:
> > [...]
> > > > I hate what I'm saying, but I guess we need some tunable here.
> > > > Not sure what exactly.
> > > 
> > > Would memcg help?
> > 
> > That really depends. I would have to check whether vmalloc path obeys
> > __GFP_ACCOUNT (I suspect it does except for page tables allocations but
> > that shouldn't be a big deal). But then the other potential problem is
> > the life time of the xt_table_info (or other potentially large) data
> > structures. Are they bound to any process life time.
> 
> No.

Well, IIUC they bound to net namespace life time, so killing all
proccesses in the namespace would help to get memory back. :)

-- 
 Kirill A. Shutemov


Memory hotplug not increasing the total RAM

2018-01-30 Thread Bharata B Rao
Hi,

With the latest upstream, I see that memory hotplug is not working
as expected. The hotplugged memory isn't seen to increase the total
RAM pages. This has been observed with both x86 and Power guests.

1. Memory hotplug code intially marks pages as PageReserved via
__add_section().
2. Later the struct page gets cleared in __init_single_page().
3. Next online_pages_range() increments totalram_pages only when
   PageReserved is set.

The step 2 has been introduced recently by the following commit:

commit f7f99100d8d95dbcf09e0216a143211e79418b9f
Author: Pavel Tatashin 
Date:   Wed Nov 15 17:36:44 2017 -0800

mm: stop zeroing memory during allocation in vmemmap

Reverting this commit restores the correct behaviour of memory hotplug.

Regards,
Bharata.



Re: [PATCH] drm/stm: drv: Improve data transfers

2018-01-30 Thread Benjamin Gaignard
2018-01-22 11:33 GMT+01:00 Philippe Cornu :
> To optimize data transfers, align pitch on 128 bytes & height
> on 4 bytes. This optimization is not applicable without MMU.
>
> Signed-off-by: Yannick Fertre 
> Signed-off-by: Vincent Abriou 
> Signed-off-by: Philippe Cornu 
> ---
>  drivers/gpu/drm/stm/drv.c | 21 +
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index 8fe954c27fba..c2bd9d882b93 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -31,6 +31,23 @@ static const struct drm_mode_config_funcs 
> drv_mode_config_funcs = {
> .atomic_commit = drm_atomic_helper_commit,
>  };
>
> +#ifdef CONFIG_MMU
> +static int stm_dumb_create(struct drm_file *file, struct drm_device *dev,
> +  struct drm_mode_create_dumb *args)
> +{
> +   unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
> +
> +   /*
> +* in order to optimize data transfer, pitch is aligned on
> +* 128 bytes, height is aligned on 4 bytes
> +*/
> +   args->pitch = roundup(min_pitch, 128);
> +   args->height = roundup(args->height, 4);
> +
> +   return drm_gem_cma_dumb_create_internal(file, dev, args);
> +}
> +#endif

I would prefer to always call stm_dumb_create (maybe renamed
stm_gem_cma_dumb_create)
and change the parameters inside if the we have MMU.

> +
>  DEFINE_DRM_GEM_CMA_FOPS(drv_driver_fops);
>
>  static struct drm_driver drv_driver = {
> @@ -44,7 +61,11 @@ static struct drm_driver drv_driver = {
> .minor = 0,
> .patchlevel = 0,
> .fops = &drv_driver_fops,
> +#ifdef CONFIG_MMU
> +   .dumb_create = stm_dumb_create,
> +#else
> .dumb_create = drm_gem_cma_dumb_create,
> +#endif
> .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
> .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> .gem_free_object_unlocked = drm_gem_cma_free_object,
> --
> 2.15.1
>


Re: [PATCH v2 10/16] iio: adc: sun4i-gpadc-iio: add support for A83T thermal sensor

2018-01-30 Thread Maxime Ripard
1;5002;0c
On Mon, Jan 29, 2018 at 12:53:48PM +0100, Philipp Rossak wrote:
> 
> 
> On 29.01.2018 10:48, Maxime Ripard wrote:
> > On Mon, Jan 29, 2018 at 12:29:13AM +0100, Philipp Rossak wrote:
> > > This patch adds support for the A83T ths sensor.
> > > 
> > > The A83T supports interrupts. The interrupt is configured to update the
> > > the sensor values every second.
> > > 
> > > Signed-off-by: Philipp Rossak 
> > > ---
> > >   drivers/iio/adc/sun4i-gpadc-iio.c | 38 
> > > ++
> > >   include/linux/mfd/sun4i-gpadc.h   | 18 ++
> > >   2 files changed, 56 insertions(+)
> > > 
> > > diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c 
> > > b/drivers/iio/adc/sun4i-gpadc-iio.c
> > > index 8196203d65fe..9f7895ba1966 100644
> > > --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> > > +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> > > @@ -170,6 +170,40 @@ static const struct gpadc_data sun8i_h3_ths_data = {
> > >   SUN8I_H3_THS_TEMP_PERIOD(0x7),
> > >   };
> > > +static const struct gpadc_data sun8i_a83t_ths_data = {
> > > + .temp_offset = -2724,
> > > + .temp_scale = -70,
> > > + .temp_data = {SUN8I_H3_THS_TDATA0,
> > > + SUN8I_A83T_THS_TDATA1,
> > > + SUN8I_A83T_THS_TDATA2,
> > > + 0},
> > > + .sample_start = sunxi_ths_sample_start,
> > > + .sample_end = sunxi_ths_sample_end,
> > > + .sensor_count = 3,
> > > + .supports_nvmem = false,
> > > + .support_irq = true,
> > > + .ctrl0_map = SUN4I_GPADC_CTRL0_T_ACQ(0x1f3),
> > > + .ctrl2_map = SUN8I_H3_THS_ACQ1(0x1f3),
> > 
> > Where are these values coming from?
> > 
> 
> These values are calculated with the formulas from the datasheet and also
> tested on hardware. These settings seem ok.

You should at least put a comment explaining how you got to these values.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


Re: [RFC PATCH 2/5] sched: Add NOHZ_STATS_KICK

2018-01-30 Thread Vincent Guittot
On 29 January 2018 at 20:31, Valentin Schneider
 wrote:
> Hi Vincent, Peter,
>
> I've been running some tests on your patches (Peter's base + the 2 from
> Vincent). The results themselves are hosted at [1].
> The base of those tests is the same: a task ("accumulator") is ran for 5
> seconds (arbitrary value) to accumulate some load, then goes to sleep for .5
> seconds.
>
> I've set up 3 test scenarios:
>
> Update by nohz_balance_kick()
> -
> Right before the "accumulator" task goes to sleep, a CPU-hogging task (100%
> utilization) is spawned on another CPU. It won't go idle so the only way to
> update the blocked load generated by "accumulator" is to kick an ILB
> (NOHZ_STATS_KICK).
>
> The test shows that this is behaving nicely - we keep kicking an ILB every
> ~36ms (see next test for comments on that) until there is no more blocked
> load. I did however notice some interesting scenarios: after the load has
> been fully decayed, a tiny background task can spawn and end in less than a
> scheduling period. However, it still goes through nohz_balance_enter_idle(),
> and thus sets nohz.stats_state, which will later cause an ILB kick.
>
> This makes me wonder if it's worth kicking ILBs for such tiny load values -
> perhaps it could be worth having a margin to set rq->has_blocked_load ?

So it's difficult to know what will be the load/utilization on the
cfs_rq once the cpu wakes up. Even if it's for a really short time,
that's doesn't mean that the load/utilization is small because it can
be the migration of a big task that just have a very short wakes up
this time.
That's why I don't make any assumption on the utilization/load value
when a cpu goes to sleep

>
> Furthermore, this tiny task will cause the ILB to iterate over all of the
> idle CPUs, although only one has stale load. For load update via NEWLY_IDLE
> load_balance() we use:
>
> static bool update_nohz_stats(struct rq *rq)
> {
> if (!rq->has_blocked_load)
>  return false;
> [...]
> }
>
> But for load update via _nohz_idle_balance(), we iterate through all of the
> nohz CPUS and unconditionally call update_blocked_averages(). This could be
> avoided by remembering which CPUs have stale load before going idle.
> Initially I thought that was what nohz.stats_state was for, but it isn't.
> With Vincent's patches it's only ever set to either 0 or 1, but we could use
> it as a CPU mask, and use it to skip nohz CPUs that don't have stale load in
> _nohz_idle_balance() (when NOHZ_STATS_KICK).

I have studied a way to keep track of how many cpus still have blocked
load to try to minimize the number of useless ilb kick but this add
more atomic operations which can impact the system throughput with
heavy load and lot of very small wake up. that's why i have propose
this solution which is more simple. But it's probably just a matter of
where we want to "waste" time. Either we accept to spent a bit more
time to check the state of idle CPUs or we accept to kick ilb from
time to time for no good reason.

>
> Update by idle_balance()
> 
> Right before the "accumulator" task goes to sleep, a tiny periodic
> (period=32ms) task is spawned on another CPU. It's expected that it will
> update the blocked load in idle_balance(), either by running
> _nohz_idle_balance() locally or kicking an ILB (The overload flag shouldn't
> be set in this test case, so we shouldn't go through the NEWLY_IDLE
> load_balance()).
>
> This also seems to be working fine, but I'm noticing a delay between load
> updates that is closer to 64ms than 32ms. After digging into it I found out
> that the time checks done in idle_balance() and nohz_balancer_kick() are
> time_after(jiffies, next_stats), but IMHO they should be
> time_after_eq(jiffies, next_stats) to have 32ms-based updates. This also
> explains the 36ms periodicity of the updates in the test above.

I have use the 32ms as a minimum value between update. We must use the
time_after()  if we want to have at least 32ms between each update. We
will have a 36ms period if the previous update was triggered by the
tick (just after in fact) but there will be only 32ms if the last
update was done during an idle_balance that happens just before the
tick. With  time_after_eq,  the update period will between 28 and
32ms.

Then, I mention a possible optimization by using time_after_eq in the
idle_balance() so a newly_idle cpu will have more chance (between 0
and 4ms for hz250) to do the update before a ilb is kicked

Thanks,
Vincent

>
>
> No update (idle system)
> ---
> Nothing special here, just making sure nothing happens when the system is
> fully idle. On a sidenote, that's relatively hard to achieve - I had to
> switch over to Juno because my HiKey960 gets interrupts every 16ms. The Juno
> still gets woken up every now and then but it's a bit quieter.
>
>
> [1]: https://gist.github.com/valschneider/a8da7bb8e11fb1ec63a419710f56c0a0
>
>
>
> On 01/24/2018 08:25 AM, V

Re: [PATCH] sound/tlv320dac33: Add device tree support

2018-01-30 Thread Ladislav Michl
On Tue, Jan 30, 2018 at 12:33:01AM +0100, Pavel Machek wrote:
> On Tue 2018-01-30 00:20:31, Ladislav Michl wrote:
> > On Tue, Jan 30, 2018 at 12:05:39AM +0100, Pavel Machek wrote:
> > > 
> > > This adds device tree support to tlv320dac33.c.
> > > 
> > > Signed-off-by: Pavel Machek 
> > > 
> > > diff --git a/Documentation/devicetree/bindings/sound/tlv320dac33.txt 
> > > b/Documentation/devicetree/bindings/sound/tlv320dac33.txt
> > > new file mode 100644
> > > index 000..6cbd311
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/sound/tlv320dac33.txt
> > > @@ -0,0 +1,32 @@
> > > +Texas Instruments - tlv320dac33 Codec module
> > > +
> > > +The tlv320dac33 serial control bus communicates through I2C protocols.
> > > +
> > > +Required properties:
> > > +
> > > +- compatible - "ti,tlv320dac33"
> > > +- reg - I2C slave address
> > > +
> > > +Optional properties:
> > > +
> > > +- power-gpios - gpio pin to power the device, active high
> > 
> > While driver used gpio in platform data, isn't it more likely
> > regulator which powers device?
> 
> power-gpios = <&gpio2 28 0>; /* gpio_60 */
> 
> Looks like GPIO to me -- example is from Nokia N9. So this appears to
> be correct.

Device datasheet doesn't list any pin which looks like "power-gpio"
http://www.ti.com/lit/ds/symlink/tlv320dac32.pdf
Unfortunately I do not know much about N9, but was able to find Nokia 5610
scheme to get clue how could be tlv320dac33 hardwired (see page 2):
http://mastermobile.spb.ru/service/nokia_5610_rm-242_service_schematics.pdf
Here AVDD is powered by LP3985 voltage regulator which is enabled using
VEN pin which might be connected to gpio. Or there could be completely
different voltage regulator with different controls. And since Linux
already has voltage regulator class, lets not limit ourselves to gpio
pins.

See also here about deprecated power-gpios:
Documentation/devicetree/bindings/mmc/cavium-mmc.txt
so it seems others already fallen into that trap.

ladis



Re: [PATCH v2 07/16] iio: adc: sun4i-gpadc-iio: rework: support nvmem calibration data

2018-01-30 Thread Maxime Ripard
On Mon, Jan 29, 2018 at 01:33:12PM +0100, Philipp Rossak wrote:
> > >   static const struct gpadc_data sun4i_gpadc_data = {
> > > @@ -87,6 +89,7 @@ static const struct gpadc_data sun4i_gpadc_data = {
> > >   .sample_start = sun4i_gpadc_sample_start,
> > >   .sample_end = sun4i_gpadc_sample_end,
> > >   .sensor_count = 1,
> > > + .supports_nvmem = false,
> > 
> > That's already its value if you leave it out.
> > 
> > >   };
> > >   static const struct gpadc_data sun5i_gpadc_data = {
> > > @@ -100,6 +103,7 @@ static const struct gpadc_data sun5i_gpadc_data = {
> > >   .sample_start = sun4i_gpadc_sample_start,
> > >   .sample_end = sun4i_gpadc_sample_end,
> > >   .sensor_count = 1,
> > > + .supports_nvmem = false,
> > >   };
> > >   static const struct gpadc_data sun6i_gpadc_data = {
> > > @@ -113,6 +117,7 @@ static const struct gpadc_data sun6i_gpadc_data = {
> > >   .sample_start = sun4i_gpadc_sample_start,
> > >   .sample_end = sun4i_gpadc_sample_end,
> > >   .sensor_count = 1,
> > > + .supports_nvmem = false,
> > >   };
> > >   static const struct gpadc_data sun8i_a33_gpadc_data = {
> > > @@ -123,6 +128,7 @@ static const struct gpadc_data sun8i_a33_gpadc_data = 
> > > {
> > >   .sample_start = sun4i_gpadc_sample_start,
> > >   .sample_end = sun4i_gpadc_sample_end,
> > >   .sensor_count = 1,
> > > + .supports_nvmem = false,
> > >   };
> > >   struct sun4i_gpadc_iio {
> > > @@ -141,6 +147,8 @@ struct sun4i_gpadc_iio {
> > >   struct clk  *mod_clk;
> > >   struct reset_control*reset;
> > >   int sensor_id;
> > > + u32 calibration_data[2];
> > > + boolhas_calibration_data[2];
> > 
> > Why do you have two different values here?
> 
> I think my idea was too complex! I thought it would be better to check if
> calibration data was read, and is able to be written to hardware. those
> information were split per register.
> 
> I think a u64 should be fine for calibration_data. When I write the
> calibration data I can check on the sensor count and write only the lower 32
> bits if there are less than 3 sensors.
> 
> Is this ok for you?

I'd need to see the implementation, but make sure that this is
documented in your driver :)

> 
> > >   /* prevents concurrent reads of temperature and ADC */
> > >   struct mutexmutex;
> > >   struct thermal_zone_device  *tzd;
> > > @@ -561,6 +569,9 @@ static int sun4i_gpadc_probe_dt(struct 
> > > platform_device *pdev,
> > >   struct resource *mem;
> > >   void __iomem *base;
> > >   int ret;
> > > + struct nvmem_cell *cell;
> > > + ssize_t cell_size;
> > > + u64 *cell_data;
> > >   info->data = of_device_get_match_data(&pdev->dev);
> > >   if (!info->data)
> > > @@ -575,6 +586,39 @@ static int sun4i_gpadc_probe_dt(struct 
> > > platform_device *pdev,
> > >   if (IS_ERR(base))
> > >   return PTR_ERR(base);
> > > + info->has_calibration_data[0] = false;
> > > + info->has_calibration_data[1] = false;
> > > +
> > > + if (!info->data->supports_nvmem)
> > > + goto no_nvmem;
> > > +
> > > + cell = nvmem_cell_get(&pdev->dev, "calibration");
> > > + if (IS_ERR(cell)) {
> > > + if (PTR_ERR(cell) == -EPROBE_DEFER)
> > > + return PTR_ERR(cell);
> > > + goto no_nvmem;
> > 
> > goto considered evil ? :)
> 
> this was a suggestion from Jonatan in version one, to make the code better
> readable.

Isn't

if (info->data->supports_nvmem && IS_ERR(cell = nvmem_cell_get()))

pretty much the same thing?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


Re: [PATCH v4 3/6] arm: dts: sun8i: a83t: Add the cir pin for the A83T

2018-01-30 Thread Maxime Ripard
hi,

On Mon, Jan 29, 2018 at 04:58:07PM +0100, Philipp Rossak wrote:
> The CIR Pin of the A83T is located at PL12.
> 
> Signed-off-by: Philipp Rossak 
> ---
>  arch/arm/boot/dts/sun8i-a83t.dtsi | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi 
> b/arch/arm/boot/dts/sun8i-a83t.dtsi
> index de5119a2a91c..06e96db7c41a 100644
> --- a/arch/arm/boot/dts/sun8i-a83t.dtsi
> +++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
> @@ -617,6 +617,11 @@
>   interrupt-controller;
>   #interrupt-cells = <3>;
>  
> + cir_pins: cir-pins@0 {
> + pins = "PL12";
> + function = "s_cir_rx";
> + };
> +

Sorry for not noticing this earlier, but this should be r_cir_pin, and
you should drop the unit-address that generates a dtc warning.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


Re: [PATCH v4 4/6] arm: dts: sun8i: a83t: Add support for the cir interface

2018-01-30 Thread Maxime Ripard
hi,

On Mon, Jan 29, 2018 at 04:58:08PM +0100, Philipp Rossak wrote:
> The cir interface is like on the H3 located at 0x01f02000 and is exactly
> the same. This patch adds support for the ir interface on the A83T.
> 
> Signed-off-by: Philipp Rossak 
> ---
>  arch/arm/boot/dts/sun8i-a83t.dtsi | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi 
> b/arch/arm/boot/dts/sun8i-a83t.dtsi
> index 06e96db7c41a..ddc0d592107f 100644
> --- a/arch/arm/boot/dts/sun8i-a83t.dtsi
> +++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
> @@ -605,6 +605,16 @@
>   #reset-cells = <1>;
>   };
>  
> + cir: cir@01f02000 {

r_cir: ir@1f02000

> + compatible = "allwinner,sun5i-a13-ir";

You should have an A83t compatible there first.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


Re: [PATCH v5 5/6] arm: dts: sun8i: a83t: bananapi-m3: Enable IR controller

2018-01-30 Thread Maxime Ripard
On Mon, Jan 29, 2018 at 04:58:09PM +0100, Philipp Rossak wrote:
> The Bananapi M3 has an onboard IR receiver.
> This enables the onboard IR receiver subnode.
> Unlike the other IR receivers this one needs a base clock frequency
> of 300 Hz (3 MHz), to be able to work.
> 
> Signed-off-by: Philipp Rossak 
> Acked-by: Chen-Yu Tsai 
> ---
>  arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts 
> b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
> index 6550bf0e594b..ffc6445fd281 100644
> --- a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
> +++ b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
> @@ -82,6 +82,13 @@
>   };
>  };
>  
> +&cir {
> + pinctrl-names = "default";
> + pinctrl-0 = <&cir_pins>;

If this is the only muxing option (like your node name suggests), you
can put it directly in the DTSI to remove boilerplate from all the
DTS.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


[PATCH 2/4] libusbip: use per vhci_hcd controller attributes

2018-01-30 Thread Salvador Fandino
From: Salvador Fandiño 

Now every vhci_hcd device is controlled by its own sysfs attributes
(before all of them were controlled by vhci_hcd.0 attributes). This
patch addapts libusbip to this new interface.

Before this patch the library did not provide any mean to access a
specific vhci_hcd device. In order to keep backward compatibility
while at the same time allowing to access vhci_hcd devices
independently the following approach has been taken:

New functions accepting a vhci_hcd path or an index have been added
("usbip_vhci_driver_open_path" and "usbip_vhci_driver_open_ix"
respectively). The old function "usbip_vhci_driver_open" can only be
used to open "vhci_hcd.0"). That will make old programs fail to use
any other vhci_hcd device, but as that functionality was broken in the
kernel anyway until very recently (see
1ac7c8a78be85f84b019d3d2742d1a9f07255cc5) we consider it a good
compromise.

Signed-off-by: Salvador Fandiño 
---
 tools/usb/usbip/libsrc/vhci_driver.c | 105 +--
 tools/usb/usbip/libsrc/vhci_driver.h |  12 +++-
 2 files changed, 74 insertions(+), 43 deletions(-)

diff --git a/tools/usb/usbip/libsrc/vhci_driver.c 
b/tools/usb/usbip/libsrc/vhci_driver.c
index c9c81614a66a..34d15167bab3 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -114,13 +114,16 @@ static int refresh_imported_device_list(void)
char status[MAX_STATUS_NAME+1] = "status";
int i, ret;
 
-   for (i = 0; i < vhci_driver->ncontrollers; i++) {
+   for (i = 0; ; i++) {
if (i > 0)
snprintf(status, sizeof(status), "status.%d", i);
 
attr_status = 
udev_device_get_sysattr_value(vhci_driver->hc_device,
status);
if (!attr_status) {
+   if (i > 0)
+   break;
+
err("udev_device_get_sysattr_value failed");
return -1;
}
@@ -148,33 +151,6 @@ static int get_nports(void)
return (int)strtoul(attr_nports, NULL, 10);
 }
 
-static int vhci_hcd_filter(const struct dirent *dirent)
-{
-   return strcmp(dirent->d_name, "vhci_hcd") >= 0;
-}
-
-static int get_ncontrollers(void)
-{
-   struct dirent **namelist;
-   struct udev_device *platform;
-   int n;
-
-   platform = udev_device_get_parent(vhci_driver->hc_device);
-   if (platform == NULL)
-   return -1;
-
-   n = scandir(udev_device_get_syspath(platform), &namelist, 
vhci_hcd_filter, NULL);
-   if (n < 0)
-   err("scandir failed");
-   else {
-   for (int i = 0; i < n; i++)
-   free(namelist[i]);
-   free(namelist);
-   }
-
-   return n;
-}
-
 /*
  * Read the given port's record.
  *
@@ -199,7 +175,8 @@ static int read_record(int rhport, char *host, unsigned 
long host_len,
if (!buffer)
return -1;
 
-   snprintf(path, PATH_MAX, VHCI_STATE_PATH"/port%d", rhport);
+   snprintf(path, PATH_MAX, VHCI_STATE_PATH"/port%d-%d",
+vhci_driver->ix, rhport);
 
file = fopen(path, "r");
if (!file) {
@@ -238,9 +215,18 @@ static int read_record(int rhport, char *host, unsigned 
long host_len,
return 0;
 }
 
+static int vhci_path_to_ix(const char *path)
+{
+   int i = strlen(path);
+
+   while (--i >= 0 && isdigit(path[i]))
+   ;
+   return atoi(path + i + 1);
+}
+
 /* -- */
 
-int usbip_vhci_driver_open(void)
+int usbip_vhci_driver_open_path(const char *path)
 {
udev_context = udev_new();
if (!udev_context) {
@@ -252,14 +238,15 @@ int usbip_vhci_driver_open(void)
 
/* will be freed in usbip_driver_close() */
vhci_driver->hc_device =
-   udev_device_new_from_subsystem_sysname(udev_context,
-  USBIP_VHCI_BUS_TYPE,
-  USBIP_VHCI_DEVICE_NAME);
+   udev_device_new_from_syspath(udev_context, path);
+
if (!vhci_driver->hc_device) {
err("udev_device_new_from_subsystem_sysname failed");
goto err;
}
 
+   vhci_driver->ix = vhci_path_to_ix(path);
+
vhci_driver->nports = get_nports();
dbg("available ports: %d", vhci_driver->nports);
 
@@ -271,14 +258,6 @@ int usbip_vhci_driver_open(void)
goto err;
}
 
-   vhci_driver->ncontrollers = get_ncontrollers();
-   dbg("available controllers: %d", vhci_driver->ncontrollers);
-
-   if (vhci_driver->ncontrollers <=0) {
-   err("no available usb controllers");
-   goto err;
-   }
-
if (refresh_imported_device_list())
goto err;
 
@@ -297,6 +276,45 @@ int usbip

[PATCH 4/4] config: make USB_MAXBUS configurable and adjust VHCI_NR_HCS top limit

2018-01-30 Thread Salvador Fandino
From: Salvador Fandiño 

The maximum number of USB host controllers supported by the kernel had
a hard-coded limit of 64. In some scenarios that limit may be not
enough. For instance, in my particular case, I have systems with
thousands of containers running and would like to provide a VHCI
(USBIP host controller) device to every one of them but can't because
of this limit.

This patch adds a new configuration entry for USB_MAXBUS and also
increases the top limit for USBIP_VHCI_NR_HCS (number of VHCI
controllers) accordingly.

Signed-off-by: Salvador Fandiño 
---
 drivers/usb/Kconfig   | 9 +
 drivers/usb/core/hcd.c| 2 +-
 drivers/usb/usbip/Kconfig | 5 -
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index f699abab1787..78b3e2805d8f 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -72,6 +72,15 @@ config USB
  To compile this driver as a module, choose M here: the
  module will be called usbcore.
 
+config USB_MAXBUS
+   int "Maximum number of USB host controllers"
+   range 1 4096
+   default 64
+   ---help---
+ This defines the number of USB host controllers that would be
+ available, both physical and virtual (for instance, those
+ used by USB/IP).
+
 config USB_PCI
bool "PCI based USB host interface"
depends on PCI
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fc32391a34d5..e1589e950b86 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -83,7 +83,7 @@ DEFINE_IDR (usb_bus_idr);
 EXPORT_SYMBOL_GPL (usb_bus_idr);
 
 /* used when allocating bus numbers */
-#define USB_MAXBUS 64
+#define USB_MAXBUS CONFIG_USB_MAXBUS
 
 /* used when updating list of hcds */
 DEFINE_MUTEX(usb_bus_idr_lock);/* exported only for usbfs */
diff --git a/drivers/usb/usbip/Kconfig b/drivers/usb/usbip/Kconfig
index eeefa29f8aa2..cb87bec9dbbb 100644
--- a/drivers/usb/usbip/Kconfig
+++ b/drivers/usb/usbip/Kconfig
@@ -37,7 +37,7 @@ config USBIP_VHCI_HC_PORTS
 
 config USBIP_VHCI_NR_HCS
int "Number of USB/IP virtual host controllers"
-   range 1 128
+   range 1 2048
default 1
depends on USBIP_VHCI_HCD
---help---
@@ -46,6 +46,9 @@ config USBIP_VHCI_NR_HCS
  virtual host controllers as if adding physical host
  controllers.
 
+ Note that the number of host controllers is also limited by
+ USB_MAXBUS.
+
 config USBIP_HOST
tristate "Host driver"
depends on USBIP_CORE && USB
-- 
2.14.1



[PATH 0/4] usbip: make vhci_hcd.* objects independent of vhci_hcd.0

2018-01-30 Thread Salvador Fandino
Let me start by explaining the problem that have motivated me to write
this patches:

I work on the QVD, a virtual desktop platform for Linux. This software
runs Linux desktops (i.e. XFCE, KDE) and their applications inside LXC
containers, and makes then available through the network to remote
users.

Supporting USB devices is a common feature customers have been
requesting us for a long time (in order to use, for instance, remote
signature pads, bar-code scanners, fingerprint readers, etc.). So, we
have been working on that feature using the USB/IP layer on the
kernel.

Connecting and disconnecting devices and transferring data works
seamless for the devices listed above. But we also want to make the
usbip operations private to the container where they are run.  For
instance, it is unacceptable for our product, that one user could list
the devices connected by other users or access them.

We can control how can access every device using cgroups once those
are attached, but the usbip layer is not providing any mechanism for
controlling who can attach, detach or list the devices.

So, we got the idea that in order to enforce that remote usbip devices
are only visible inside the container where they were imported, we
could conveniently mount-bind inside every container just one of the
vhci_hcd directories below /sys/devices/platform. So that it is as if
every container had a vhci_hcd just for itself (and also, we restrict
access to the matching USB ports in cgroups).

Unfortunately, all the vhci_hcd.* devices are controlled through
attributes in vhci_hcd.0 making our approach fail and so... well, that
is what this patch series changes. It makes every vhci_hcd device
controllable through attributes inside its own sysfs directory.

The first patch, does that in the kernel, and the second and third
patches change user space, adapting the libusbip and the usbip tools
code respectively.

Then there is a fourth patch, that allows to create much more USB
hubs per machine. It was limited to 64 and we are running thousands of
containers (every one requiring a hub) per host.

These changes are not completely backward compatible. In the sysfs
side, besides moving around the attribute files, now the port numbers
go from 0 to CONFIG_USBIP_VHCI_HC_PORTS * 2 - 1 and are reused for
every vhci_hcd device. I could have maintained the absolute numeration
but I think reusing the numbers is a better and simpler approach.

I have considered that until very recently, support for vhci_hcd
devices above the .0 was broken in the uspip tools (see
1ac7c8a78be85f84b019d3d2742d1a9f07255cc5 "usbip: fix usbip attach to
find a port that matches the requested speed") and that has been the
place where I have set the bar for backward compatibility: usage of
the tools must remain unchanged for accessing "vhci_hcd.0", but may
require changes otherwise. The same is true for the library functions
which now provides new functions for selecting the target vhci_hcd
device. The old functions now always target "vhci_hcd.0".

So, for instance, now, "usbip port" by default only shows "vhci_hcd.0"
ports but "usbip port -a" shows all of them, and, for instance, "usbip
port -i 4", shows the ports in "vhci_hcd.4".

Cheers.




[PATCH 1/4] usbip: make vhci_hcd.* objects independent of vhci_hcd.0

2018-01-30 Thread Salvador Fandino
From: Salvador Fandiño 

The usbip VHCI layer supports multiple "vhci_hcd" devices, every one
emulating both a high speed and a super speed USB hub. These devices
are exposed in sysfs as "vhci_hcd.0", "vhci_hcd.1", etc.

But instead of controlling then by attributes inside their respective
directories, all of then were controlled through "vhci_hcd.0" where the
attributes "attach" and "detach" were used to connect and disconnect
respectively remote USB devices to any of the virtual hub ports. Also
port status was show but a series of "status.X" attributes, all inside
"vhci_hcd.0".

Besides the rather unusuality of this approach, it precludes users
from doing interesting things, as for instance, restricting the access
to vhci_hcd devices independently.

This patch adds "attach", "detach", "status" and "nports" attributes
inside every "vhci_hcd" object, besides "vhci_hcd.0" making then
independent.

Attribute "debug", allowing to control when debug messages for the
usbip subsystems are generated is, as before, only attached to
"vhci_hcd.0".

Signed-off-by: Salvador Fandiño 
---
 drivers/usb/usbip/vhci.h   |  21 ++-
 drivers/usb/usbip/vhci_hcd.c   |  25 ++--
 drivers/usb/usbip/vhci_sysfs.c | 311 +
 3 files changed, 132 insertions(+), 225 deletions(-)

diff --git a/drivers/usb/usbip/vhci.h b/drivers/usb/usbip/vhci.h
index 5659dce1526e..c1b848775be1 100644
--- a/drivers/usb/usbip/vhci.h
+++ b/drivers/usb/usbip/vhci.h
@@ -88,7 +88,14 @@ enum hub_speed {
 #define VHCI_NR_HCS 1
 #endif
 
-#define MAX_STATUS_NAME 16
+struct vhci_attrs {
+   struct dev_ext_attribute dev_attr_status;
+   struct dev_ext_attribute dev_attr_attach;
+   struct dev_ext_attribute dev_attr_detach;
+   struct dev_ext_attribute dev_attr_nports;
+
+   struct attribute_group attribute_group;
+};
 
 struct vhci {
spinlock_t lock;
@@ -97,6 +104,8 @@ struct vhci {
 
struct vhci_hcd *vhci_hcd_hs;
struct vhci_hcd *vhci_hcd_ss;
+
+   struct vhci_attrs *attrs;
 };
 
 /* for usb_hcd.hcd_priv[0] */
@@ -126,8 +135,8 @@ extern struct attribute_group vhci_attr_group;
 void rh_port_connect(struct vhci_device *vdev, enum usb_device_speed speed);
 
 /* vhci_sysfs.c */
-int vhci_init_attr_group(void);
-void vhci_finish_attr_group(void);
+int vhci_init_attr_group(struct vhci_hcd *vhci_hcd, int id);
+void vhci_finish_attr_group(struct vhci_hcd *vhci_hcd);
 
 /* vhci_rx.c */
 struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, __u32 seqnum);
@@ -171,4 +180,10 @@ static inline struct vhci_hcd *vdev_to_vhci_hcd(struct 
vhci_device *vdev)
return container_of((void *)(vdev - vdev->rhport), struct vhci_hcd, 
vdev);
 }
 
+static inline struct vhci *device_attribute_to_vhci(
+   struct device_attribute *attr)
+{
+   return (struct vhci *)((struct dev_ext_attribute *)attr)->var;
+}
+
 #endif /* __USBIP_VHCI_H */
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index c3e1008aa491..daabb06c9f46 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -1110,13 +1110,14 @@ static int vhci_setup(struct usb_hcd *hcd)
 static int vhci_start(struct usb_hcd *hcd)
 {
struct vhci_hcd *vhci_hcd = hcd_to_vhci_hcd(hcd);
+   struct vhci *vhci = vhci_hcd->vhci;
int id, rhport;
int err;
 
-   usbip_dbg_vhci_hc("enter vhci_start\n");
+   usbip_dbg_vhci_hc("enter vhci_start for %s\n", hcd_name(hcd));
 
if (usb_hcd_is_primary_hcd(hcd))
-   spin_lock_init(&vhci_hcd->vhci->lock);
+   spin_lock_init(&vhci->lock);
 
/* initialize private data of usb_hcd */
 
@@ -1143,16 +1144,17 @@ static int vhci_start(struct usb_hcd *hcd)
}
 
/* vhci_hcd is now ready to be controlled through sysfs */
-   if (id == 0 && usb_hcd_is_primary_hcd(hcd)) {
-   err = vhci_init_attr_group();
+   if (usb_hcd_is_primary_hcd(hcd)) {
+   err = vhci_init_attr_group(vhci_hcd, id);
if (err) {
pr_err("init attr group\n");
return err;
}
-   err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group);
+   err = sysfs_create_group(&hcd_dev(hcd)->kobj,
+&vhci->attrs->attribute_group);
if (err) {
pr_err("create sysfs files\n");
-   vhci_finish_attr_group();
+   vhci_finish_attr_group(vhci_hcd);
return err;
}
pr_info("created sysfs %s\n", hcd_name(hcd));
@@ -1164,15 +1166,16 @@ static int vhci_start(struct usb_hcd *hcd)
 static void vhci_stop(struct usb_hcd *hcd)
 {
struct vhci_hcd *vhci_hcd = hcd_to_vhci_hcd(hcd);
-   int id, rhport;
+   struct vhci *vhci = vhci_hcd->vhci;
+   int rhport;
 
usbip_dbg_vhci_hc("stop VHCI controller\n");
 

[PATCH 3/4] usbip tools: use per vhci_hcd controller attributes

2018-01-30 Thread Salvador Fandino
From: Salvador Fandiño 

Now every vhci_hcd device is controlled by its own sysfs attributes
(before all of them were controlled by vhci_hcd.0 attributes). This
patch addapts the usbip tools to use the new interface through
libusbip.

The user visible changes are as follows:

- The files containing port information are named as "port$ix-$port"
(they were "port$port" before), as port numbers are local to the
vhci_hcd device now.

- Command "usbip port" by default only list ports attached to
"vhci_hcd.0", the new flag "--vhci-ix" can be used to list other
device. The flag "--all" is also available for listing all the devices
(it has not been made the default because it inserts per vhci_hcd
device headers, changing the output format).

Signed-off-by: Salvador Fandiño 
---
 tools/usb/usbip/src/Makefile.am   |   3 +-
 tools/usb/usbip/src/usbip_attach.c| 101 
 tools/usb/usbip/src/usbip_detach.c|  57 --
 tools/usb/usbip/src/usbip_enumerate.c |  55 +
 tools/usb/usbip/src/usbip_enumerate.h |  25 ++
 tools/usb/usbip/src/usbip_port.c  | 143 +-
 tools/usb/usbip/src/utils.c   |  16 
 tools/usb/usbip/src/utils.h   |   1 +
 8 files changed, 322 insertions(+), 79 deletions(-)
 create mode 100644 tools/usb/usbip/src/usbip_enumerate.c
 create mode 100644 tools/usb/usbip/src/usbip_enumerate.h

diff --git a/tools/usb/usbip/src/Makefile.am b/tools/usb/usbip/src/Makefile.am
index e26f39e0579d..50436aaa3900 100644
--- a/tools/usb/usbip/src/Makefile.am
+++ b/tools/usb/usbip/src/Makefile.am
@@ -7,6 +7,7 @@ sbin_PROGRAMS := usbip usbipd
 
 usbip_SOURCES := usbip.h utils.h usbip.c utils.c usbip_network.c \
 usbip_attach.c usbip_detach.c usbip_list.c \
-usbip_bind.c usbip_unbind.c usbip_port.c
+usbip_bind.c usbip_unbind.c usbip_port.c \
+usbip_enumerate.c
 
 usbipd_SOURCES := usbip_network.h usbipd.c usbip_network.c
diff --git a/tools/usb/usbip/src/usbip_attach.c 
b/tools/usb/usbip/src/usbip_attach.c
index 7f07b2d50f59..3901dd507451 100644
--- a/tools/usb/usbip/src/usbip_attach.c
+++ b/tools/usb/usbip/src/usbip_attach.c
@@ -35,6 +35,7 @@
 #include "usbip_common.h"
 #include "usbip_network.h"
 #include "usbip.h"
+#include "usbip_enumerate.h"
 
 static const char usbip_attach_usage_string[] =
"usbip attach \n"
@@ -48,7 +49,8 @@ void usbip_attach_usage(void)
 }
 
 #define MAX_BUFF 100
-static int record_connection(char *host, char *port, char *busid, int rhport)
+static int record_connection(char *host, char *port,
+char *busid, int vhci_ix, int rhport)
 {
int fd;
char path[PATH_MAX+1];
@@ -70,7 +72,7 @@ static int record_connection(char *host, char *port, char 
*busid, int rhport)
return -1;
}
 
-   snprintf(path, PATH_MAX, VHCI_STATE_PATH"/port%d", rhport);
+   snprintf(path, PATH_MAX, VHCI_STATE_PATH"/port%d-%d", vhci_ix, rhport);
 
fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU);
if (fd < 0)
@@ -90,46 +92,78 @@ static int record_connection(char *host, char *port, char 
*busid, int rhport)
return 0;
 }
 
-static int import_device(int sockfd, struct usbip_usb_device *udev)
+static int import_device(int sockfd, struct usbip_usb_device *udev,
+int *pvhci_ix, int *pport)
 {
-   int rc;
-   int port;
uint32_t speed = udev->speed;
+   int rc = -1;
 
-   rc = usbip_vhci_driver_open();
-   if (rc < 0) {
-   err("open vhci_driver");
-   goto err_out;
+   struct udev_enumerate *enumerate;
+   struct udev_list_entry *list, *entry;
+
+   enumerate = vhci_enumerate();
+   if (!enumerate) {
+   err("unable to list vhci_hcd drivers");
+   return -1;
+   }
+
+   list = udev_enumerate_get_list_entry(enumerate);
+   if (!list) {
+   err("unable to list vhci_hcd drivers");
+   return -1;
}
 
-   do {
-   port = usbip_vhci_get_free_port(speed);
-   if (port < 0) {
-   err("no free port");
-   goto err_driver_close;
+   udev_list_entry_foreach(entry, list) {
+   const char *path = udev_list_entry_get_name(entry);
+   int port, vhci_ix;
+
+   if (usbip_vhci_driver_open_path(path) < 0)
+   continue;
+
+   vhci_ix = usbip_vhci_driver_ix();
+
+   /* Between the moment we read and parse the status
+* files and the one we try to attach a socket to the
+* port, the later one may become occupied from some
+* other process. In order to avoid that race
+* condition, we retry on EBUSY errors. On any other
+* error we just jump to the next vhci_hcd device
+*/
+

Re: [PATCH 3/3] fs: fat: add ioctl method in fat filesystem driver

2018-01-30 Thread Pali Rohár
On Tuesday 30 January 2018 14:33:49 Chen Guanqiao wrote:
> On Mon, 2018-01-29 at 17:43 +0100, Pali Rohár wrote:
> > On Monday 29 January 2018 15:18:42 Andy Shevchenko wrote:
> > > +Cc: Pali, who AFAIRC is interested in FAT labeling mess.
> > 
> > Yes, please CC me for FAT labeling discussing in future.
> > 
> > > On Wed, Jan 17, 2018 at 12:43 PM, ChenGuanqiao
> > >  wrote:
> > > 
> > > Commit message?
> > > 
> > > > Signed-off-by: ChenGuanqiao 
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > +#include 
> > > 
> > > It would be better to squeeze it to have order (to some extent)
> > > preserved.
> > > 
> > > > +static int fat_check_d_characters(char *label, unsigned long
> > > > len)
> > > > +{
> > > > +   int i;
> > > > +
> > > > +   for (i = 0; i < len; ++i) {
> > > 
> > > Oy vey, unsigned long len vs. int i.
> > > 
> > > > +   switch (label[i]) {
> > > > +   case 'a' ... 'z':
> > > > +   label[i] = __toupper(label[i]);
> > 
> > Why only lower a..z? á or ó are also valid (according to some OEM
> > codepage) and are lower case.
> > 
> > Also please look at my testing results. Even old DOS versions are
> > able
> > to correctly read lower case label. Therefore I do not see any reason
> > why to have such "force" code in kernel.
> > 
> > https://www.spinics.net/lists/kernel/msg2645732.html
> > 
> > Here I proposed how should be linux tools unified which manipulates
> > with
> > fat label.
> In character detection, I refer to the FAT standard document "Ecma-
> 107".

So please stick with implementation which is already used in kernel
driver or refer to one of two MS documentations for FAT12/16/32. We do
not want to have part of kernel fs driver to be written according one
documentation, other parts according to another documentation and
remaining parts according to guess or something else. We already have
compatibility with MS FAT, so inventing something new does not make
sense. Also in past there was found mistakes in MS documentation (like
incorrect formulas for counting clusters, etc.), so beware of facts that
documentation/specification does not have to be 100% correct.

In above email I did investigation for FAT labels and come to the
conclusion which seems to make sense. So if you disagree with it, please
open discussion what is wrong with proposed solution for unifying
handling label on Linux. Instead of inventing fully new way how to
handle FAT label in Linux. It really does not make any sense to use
fully different way how to handle FAT label which is incompatible with
existing Linux and Windows implementations.

In namei_msdos.c you can find already used functions. Others should be
available in dir.c.

> The document limits the volume label to a range of characters
> called "d-characters". The "d-characters" only includes uppercase
> letter, '-' and numbers.

msdos.ko and vfat.ko already handles also other characters.

> And I have found the volume label can be written as extended ASCII,
> double-byte characters in Windows. such as Chinese characters, Arabic
> characters, and others are not all characters that control characters
> and punctuation mark in ASCII. This is obviously no correct if we copy
> the implementation of windows completely, let the maximum length of
> volume label is variable?

Label is stored in two locations: boot sector and as entry in root
directory structure. For directory entry there are strict rules which
msdos.ko/vfat.ko uses and which are verified by years of usage. Maximum
length is fixed to 11 bytes due to length of directory entry. Also note
that label cannot be stored as LFN entry.

-- 
Pali Rohár
pali.ro...@gmail.com


Re: [PATCH 1/2] arm64: dts: sdm845: Add minimal dts/dtsi files for sdm845 SoC and MTP

2018-01-30 Thread Rajendra Nayak

On 01/27/2018 02:01 AM, Evan Green wrote:
> Hi Rajendra,
> 
> On Thu, Jan 25, 2018 at 8:32 AM, Rajendra Nayak  wrote:
>> Add a skeletal sdm845 SoC dtsi and MTP board dts/dtsi files
>>
>> Signed-off-by: Rajendra Nayak 
>> ---
>>  arch/arm64/boot/dts/qcom/Makefile|   1 +
>>  arch/arm64/boot/dts/qcom/sdm845-mtp.dts  |  13 ++
>>  arch/arm64/boot/dts/qcom/sdm845-mtp.dtsi |  11 ++
>>  arch/arm64/boot/dts/qcom/sdm845.dtsi | 308 
>> +++
>>  4 files changed, 333 insertions(+)
>>  create mode 100644 arch/arm64/boot/dts/qcom/sdm845-mtp.dts
>>  create mode 100644 arch/arm64/boot/dts/qcom/sdm845-mtp.dtsi
>>  create mode 100644 arch/arm64/boot/dts/qcom/sdm845.dtsi
>>
>> diff --git a/arch/arm64/boot/dts/qcom/Makefile 
>> b/arch/arm64/boot/dts/qcom/Makefile
>> index 55ec5ee7f7e8..c57701bed084 100644
>> --- a/arch/arm64/boot/dts/qcom/Makefile
>> +++ b/arch/arm64/boot/dts/qcom/Makefile
>> @@ -6,3 +6,4 @@ dtb-$(CONFIG_ARCH_QCOM) += msm8916-mtp.dtb
>>  dtb-$(CONFIG_ARCH_QCOM)+= msm8992-bullhead-rev-101.dtb
>>  dtb-$(CONFIG_ARCH_QCOM)+= msm8994-angler-rev-101.dtb
>>  dtb-$(CONFIG_ARCH_QCOM)+= msm8996-mtp.dtb
>> +dtb-$(CONFIG_ARCH_QCOM) += sdm845-mtp.dtb
> 
> Minor nit: This should be a tab before the += to be consistent.

thanks, will fix when I respin.

> 
> (Unfortunately I don't have the expertise quite yet to comment on the
> rest of this).
> 
> -Evan
> 

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


Re: [patch -mm v2 1/3] mm, memcg: introduce per-memcg oom policy tunable

2018-01-30 Thread Michal Hocko
On Mon 29-01-18 14:38:02, David Rientjes wrote:
> On Fri, 26 Jan 2018, Michal Hocko wrote:
> 
> > > The cgroup aware oom killer is needlessly declared for the entire system
> > > by a mount option.  It's unnecessary to force the system into a single
> > > oom policy: either cgroup aware, or the traditional process aware.
> > > 
> > > This patch introduces a memory.oom_policy tunable for all mem cgroups.
> > > It is currently a no-op: it can only be set to "none", which is its
> > > default policy.  It will be expanded in the next patch to define cgroup
> > > aware oom killer behavior.
> > > 
> > > This is an extensible interface that can be used to define cgroup aware
> > > assessment of mem cgroup subtrees or the traditional process aware
> > > assessment.
> > > 
> > 
> > So what is the actual semantic and scope of this policy. Does it apply
> > only down the hierarchy. Also how do you compare cgroups with different
> > policies? Let's say you have
> >   root
> >  / |  \
> > A  B   C
> >/ \/ \
> >   D   E  F   G
> > 
> > Assume A: cgroup, B: oom_group=1, C: tree, G: oom_group=1
> > 
> 
> At each level of the hierarchy, memory.oom_policy compares immediate 
> children, it's the only way that an admin can lock in a specific oom 
> policy like "tree" and then delegate the subtree to the user.  If you've 
> configured it as above, comparing A and C should be the same based on the 
> cumulative usage of their child mem cgroups.

So cgroup == tree if we are memcg aware OOM killing, right? Why do we
need both then? Just to make memcg aware OOM killing possible?

> The policy for B hasn't been specified, but since it does not have any 
> children "cgroup" and "tree" should be the same.

So now you have a killable cgroup selected by process criterion? That
just doesn't make any sense. So I guess it would at least require to
enforce (cgroup || tree) to allow oom_group.

But even then it doesn't make much sense to me because having a memcg
killable or not is an attribute of the _memcg_ rather than the OOM
context, no? In other words how much sense does it make to have B OOM
intity or not depending on whether this is a global OOM or B OOM. Either
the workload running inside B can cope with partial tear down or it
cannot. Or do you have an example when something like that would be
useful?
 
> > Now we have the global OOM killer to choose a victim. From a quick
> > glance over those patches, it seems that we will be comparing only
> > tasks because root->oom_policy != MEMCG_OOM_POLICY_CGROUP. A, B and C
> > policies are ignored.
> 
> Right, a policy of "none" reverts its subtree back to per-process 
> comparison if you are either not using the cgroup aware oom killer or your 
> subtree is not using the cgroup aware oom killer.

So how are you going to compare none cgroups with those that consider
full memcg or hierarchy (cgroup, tree)? Are you going to consider
oom_score_adj?

> > Moreover If I select any of B's tasks then I will
> > happily kill it breaking the expectation that the whole memcg will go
> > away. Weird, don't you think? Or did I misunderstand?
> > 
> 
> It's just as weird as the behavior of memory.oom_group today without using 
> the mount option :)

Which is why oom_group returns -ENOTSUPP, so you simply cannot even set
any memcg as oom killable. And you do not have this weirdness.

> In that case, mem_cgroup_select_oom_victim() always 
> returns false and the value of memory.oom_group is ignored.  I agree that 
> it's weird in -mm and there's nothing preventing us from separating 
> memory.oom_group from the cgroup aware oom killer and allowing it to be 
> set regardless of a selection change.

it is not weird. I suspect you misunderstood the code and its intention.

> If memory.oom_group is set, and the 
> kill originates from that mem cgroup, kill all processes attached to it 
> and its subtree.
> 
> This is a criticism of the current implementation in -mm, however, my 
> extension only respects its weirdness.
> 
> > So let's assume that root: cgroup. Then we are finally comparing
> > cgroups. D, E, B, C. Of those D, E and F do not have any
> > policy. Do they inherit their policy from the parent? If they don't then
> > we should be comparing their tasks separately, no? The code disagrees
> > because once we are in the cgroup mode, we do not care about separate
> > tasks.
> > 
> 
> No, perhaps I wasn't clear in the documentation: the policy at each level 
> of the hierarchy is specified by memory.oom_policy and compares its 
> immediate children with that policy.  So the per-cgroup usage of A, B, and 
> C and compared regardless of A, B, and C's own oom policies.

You are still operating in terms of levels. And that is rather confusing
because we are operating on a _tree_ and that walk has to be independent
on the way we walk that tree - i.e. whether we do DFS or BFS ordering.

> > Let's say we choose C because it has the largest cumulative consumption.
> > It

Re: [PATCH V2] print kdump kernel loaded status in stack dump

2018-01-30 Thread Sergey Senozhatsky
On (01/27/18 12:11), Dave Young wrote:
> It is useful to print kdump kernel loaded status in dump_stack() 
> especially when panic happens so that we can differenciate 
> kdump kernel early hang and a normal panic in a bug report.
> 
> Signed-off-by: Dave Young 

Looks OK to me.

Reviewed-by: Sergey Senozhatsky 


I agree with Steven, would be better to move the whole thing
to lib/dump_stack.c

-ss


Re: [PATCH 8/8] platform: vivid-cec: fix potential integer overflow in vivid_cec_pin_adap_events

2018-01-30 Thread Gustavo A. R. Silva

Hi Hans,

Quoting Hans Verkuil :


Hi Gustavo,

On 01/30/2018 01:33 AM, Gustavo A. R. Silva wrote:

Cast len to const u64 in order to avoid a potential integer
overflow. This variable is being used in a context that expects
an expression of type const u64.

Addresses-Coverity-ID: 1454996 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/media/platform/vivid/vivid-cec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/vivid/vivid-cec.c  
b/drivers/media/platform/vivid/vivid-cec.c

index b55d278..30240ab 100644
--- a/drivers/media/platform/vivid/vivid-cec.c
+++ b/drivers/media/platform/vivid/vivid-cec.c
@@ -83,7 +83,7 @@ static void vivid_cec_pin_adap_events(struct  
cec_adapter *adap, ktime_t ts,

if (adap == NULL)
return;
ts = ktime_sub_us(ts, (CEC_TIM_START_BIT_TOTAL +
-  len * 10 * CEC_TIM_DATA_BIT_TOTAL));
+  (const u64)len * 10 * CEC_TIM_DATA_BIT_TOTAL));


This makes no sense. Certainly the const part is pointless. And given that
len is always <= 16 there definitely is no overflow.



Yeah, I understand your point and I know there is no chance of an  
overflow in this particular case.



I don't really want this cast in the code.

Sorry,



I'm working through all the Linux kernel Coverity reports, and I  
thought of sending a patch for this because IMHO it doesn't hurt to  
give the compiler complete information about the arithmetic in which  
an expression is intended to be evaluated.


I agree that the _const_ part is a bit odd. What do you think about  
the cast to u64 alone?


I appreciate your feedback.

Thanks
--
Gustavo







[tip:x86/pti] objtool: Add support for alternatives at the end of a section

2018-01-30 Thread tip-bot for Josh Poimboeuf
Commit-ID:  b18cbc614b4ddca4019ecd2e6663d54bd495d413
Gitweb: https://git.kernel.org/tip/b18cbc614b4ddca4019ecd2e6663d54bd495d413
Author: Josh Poimboeuf 
AuthorDate: Mon, 29 Jan 2018 22:00:40 -0600
Committer:  Ingo Molnar 
CommitDate: Tue, 30 Jan 2018 07:55:05 +0100

objtool: Add support for alternatives at the end of a section

Now that the previous patch gave objtool the ability to read retpoline
alternatives, it shows a new warning:

  arch/x86/entry/entry_64.o: warning: objtool: .entry_trampoline: don't know 
how to handle alternatives at end of section

This is due to the JMP_NOSPEC in entry_SYSCALL_64_trampoline().

Previously, objtool ignored this situation because it wasn't needed, and
it would have required a bit of extra code.  Now that this case exists,
add proper support for it.

Signed-off-by: Josh Poimboeuf 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Dave Hansen 
Cc: David Woodhouse 
Cc: Greg Kroah-Hartman 
Cc: Guenter Roeck 
Cc: H. Peter Anvin 
Cc: Juergen Gross 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/2a30a3c2158af47d891a76e69bb1ef347e0443fd.1517284349.git.jpoim...@redhat.com
Signed-off-by: Ingo Molnar 
---
 tools/objtool/check.c | 53 ++-
 1 file changed, 31 insertions(+), 22 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index bc3490d..9cd028a 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -594,7 +594,7 @@ static int handle_group_alt(struct objtool_file *file,
struct instruction *orig_insn,
struct instruction **new_insn)
 {
-   struct instruction *last_orig_insn, *last_new_insn, *insn, *fake_jump;
+   struct instruction *last_orig_insn, *last_new_insn, *insn, *fake_jump = 
NULL;
unsigned long dest_off;
 
last_orig_insn = NULL;
@@ -610,28 +610,30 @@ static int handle_group_alt(struct objtool_file *file,
last_orig_insn = insn;
}
 
-   if (!next_insn_same_sec(file, last_orig_insn)) {
-   WARN("%s: don't know how to handle alternatives at end of 
section",
-special_alt->orig_sec->name);
-   return -1;
-   }
-
-   fake_jump = malloc(sizeof(*fake_jump));
-   if (!fake_jump) {
-   WARN("malloc failed");
-   return -1;
+   if (next_insn_same_sec(file, last_orig_insn)) {
+   fake_jump = malloc(sizeof(*fake_jump));
+   if (!fake_jump) {
+   WARN("malloc failed");
+   return -1;
+   }
+   memset(fake_jump, 0, sizeof(*fake_jump));
+   INIT_LIST_HEAD(&fake_jump->alts);
+   clear_insn_state(&fake_jump->state);
+
+   fake_jump->sec = special_alt->new_sec;
+   fake_jump->offset = -1;
+   fake_jump->type = INSN_JUMP_UNCONDITIONAL;
+   fake_jump->jump_dest = list_next_entry(last_orig_insn, list);
+   fake_jump->ignore = true;
}
-   memset(fake_jump, 0, sizeof(*fake_jump));
-   INIT_LIST_HEAD(&fake_jump->alts);
-   clear_insn_state(&fake_jump->state);
-
-   fake_jump->sec = special_alt->new_sec;
-   fake_jump->offset = -1;
-   fake_jump->type = INSN_JUMP_UNCONDITIONAL;
-   fake_jump->jump_dest = list_next_entry(last_orig_insn, list);
-   fake_jump->ignore = true;
 
if (!special_alt->new_len) {
+   if (!fake_jump) {
+   WARN("%s: empty alternative at end of section",
+special_alt->orig_sec->name);
+   return -1;
+   }
+
*new_insn = fake_jump;
return 0;
}
@@ -654,8 +656,14 @@ static int handle_group_alt(struct objtool_file *file,
continue;
 
dest_off = insn->offset + insn->len + insn->immediate;
-   if (dest_off == special_alt->new_off + special_alt->new_len)
+   if (dest_off == special_alt->new_off + special_alt->new_len) {
+   if (!fake_jump) {
+   WARN("%s: alternative jump to end of section",
+special_alt->orig_sec->name);
+   return -1;
+   }
insn->jump_dest = fake_jump;
+   }
 
if (!insn->jump_dest) {
WARN_FUNC("can't find alternative jump destination",
@@ -670,7 +678,8 @@ static int handle_group_alt(struct objtool_file *file,
return -1;
}
 
-   list_add(&fake_jump->list, &last_new_insn->list);
+   if (fake_jump)
+   list_add(&fake_jump->list, &last_new_insn->list);
 
return 0;
 }


[tip:x86/pti] objtool: Don't print '.tmp_' prefix for .o files when CONFIG_MODVERSIONS=y

2018-01-30 Thread tip-bot for Josh Poimboeuf
Commit-ID:  dfcb8dae5d28b7cf259b367ed9ccbc1296284e0d
Gitweb: https://git.kernel.org/tip/dfcb8dae5d28b7cf259b367ed9ccbc1296284e0d
Author: Josh Poimboeuf 
AuthorDate: Mon, 29 Jan 2018 22:00:42 -0600
Committer:  Ingo Molnar 
CommitDate: Tue, 30 Jan 2018 07:55:05 +0100

objtool: Don't print '.tmp_' prefix for .o files when CONFIG_MODVERSIONS=y

With the following commit:

  2a0098d70640 ("objtool: Fix seg fault with gold linker")

... objtool warnings started showing the modversions '.tmp_' prefix in
the .o file name, like:

  arch/x86/mm/.tmp_mem_encrypt_boot.o: warning: objtool: 
sme_encrypt_execute()+0x48: indirect call found in RETPOLINE build

The prefix is confusing.  Remove it from the printed 'objname' variable.

Signed-off-by: Josh Poimboeuf 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Dave Hansen 
Cc: David Woodhouse 
Cc: Greg Kroah-Hartman 
Cc: Guenter Roeck 
Cc: H. Peter Anvin 
Cc: Juergen Gross 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Fixes: 2a0098d70640 ("objtool: Fix seg fault with gold linker")
Link: 
http://lkml.kernel.org/r/3788b5aec1c279184b78cdbd8b520903c0fb8a80.1517284349.git.jpoim...@redhat.com
Signed-off-by: Ingo Molnar 
---
 tools/objtool/check.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 9cd028a..d45ab4d 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1978,6 +1978,25 @@ static void cleanup(struct objtool_file *file)
elf_close(file->elf);
 }
 
+/*
+ * With CONFIG_MODVERSIONS=y, the object name has '.tmp_' prepended to it.
+ * After the file has been opened, remove the prefix so warnings will look
+ * sensible.
+ */
+static void fix_objname(void)
+{
+   char *s;
+
+   s = strstr(objname, ".tmp_");
+   if (!s)
+   return;
+
+   for (; s[5]; s++)
+   s[0] = s[5];
+
+   s[0] = 0;
+}
+
 int check(const char *_objname, bool _no_fp, bool no_unreachable, bool orc)
 {
struct objtool_file file;
@@ -1990,6 +2009,8 @@ int check(const char *_objname, bool _no_fp, bool 
no_unreachable, bool orc)
if (!file.elf)
return 1;
 
+   fix_objname();
+
INIT_LIST_HEAD(&file.insn_list);
hash_init(file.insn_hash);
file.whitelist = find_section_by_name(file.elf, 
".discard.func_stack_frame_non_standard");


Re: [PATCH] sound/tlv320dac33: Add device tree support

2018-01-30 Thread Pavel Machek
On Tue 2018-01-30 09:34:46, Ladislav Michl wrote:
> On Tue, Jan 30, 2018 at 12:33:01AM +0100, Pavel Machek wrote:
> > On Tue 2018-01-30 00:20:31, Ladislav Michl wrote:
> > > On Tue, Jan 30, 2018 at 12:05:39AM +0100, Pavel Machek wrote:
> > > > 
> > > > This adds device tree support to tlv320dac33.c.
> > > > 
> > > > Signed-off-by: Pavel Machek 
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/sound/tlv320dac33.txt 
> > > > b/Documentation/devicetree/bindings/sound/tlv320dac33.txt
> > > > new file mode 100644
> > > > index 000..6cbd311
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/sound/tlv320dac33.txt
> > > > @@ -0,0 +1,32 @@
> > > > +Texas Instruments - tlv320dac33 Codec module
> > > > +
> > > > +The tlv320dac33 serial control bus communicates through I2C protocols.
> > > > +
> > > > +Required properties:
> > > > +
> > > > +- compatible - "ti,tlv320dac33"
> > > > +- reg - I2C slave address
> > > > +
> > > > +Optional properties:
> > > > +
> > > > +- power-gpios - gpio pin to power the device, active high
> > > 
> > > While driver used gpio in platform data, isn't it more likely
> > > regulator which powers device?
> > 
> > power-gpios = <&gpio2 28 0>; /* gpio_60 */
> > 
> > Looks like GPIO to me -- example is from Nokia N9. So this appears to
> > be correct.
> 
> Device datasheet doesn't list any pin which looks like "power-gpio"
> http://www.ti.com/lit/ds/symlink/tlv320dac32.pdf
> Unfortunately I do not know much about N9, but was able to find Nokia 5610
> scheme to get clue how could be tlv320dac33 hardwired (see page 2):
> http://mastermobile.spb.ru/service/nokia_5610_rm-242_service_schematics.pdf
> Here AVDD is powered by LP3985 voltage regulator which is enabled using
> VEN pin which might be connected to gpio. Or there could be completely
> different voltage regulator with different controls. And since Linux
> already has voltage regulator class, lets not limit ourselves to gpio
> pins.

Well, notice I'm converting existing driver to device tree. And that
one already has GPIO dependency. It is possible that more work needs
to be done there, but that should not be a reason to delay this. Feel
free to help.

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


[tip:x86/pti] objtool: Warn on stripped section symbol

2018-01-30 Thread tip-bot for Josh Poimboeuf
Commit-ID:  2e9490ba5830a60a18a359192e938b2ad1710120
Gitweb: https://git.kernel.org/tip/2e9490ba5830a60a18a359192e938b2ad1710120
Author: Josh Poimboeuf 
AuthorDate: Mon, 29 Jan 2018 22:00:41 -0600
Committer:  Ingo Molnar 
CommitDate: Tue, 30 Jan 2018 07:55:05 +0100

objtool: Warn on stripped section symbol

With the following fix:

  2a0098d70640 ("objtool: Fix seg fault with gold linker")

... a seg fault was avoided, but the original seg fault condition in
objtool wasn't fixed.  Replace the seg fault with an error message.

Suggested-by: Ingo Molnar 
Signed-off-by: Josh Poimboeuf 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Dave Hansen 
Cc: David Woodhouse 
Cc: Greg Kroah-Hartman 
Cc: Guenter Roeck 
Cc: H. Peter Anvin 
Cc: Juergen Gross 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/dc4585a70d6b975c99fc51d1957ccdde7bd52f3a.1517284349.git.jpoim...@redhat.com
Signed-off-by: Ingo Molnar 
---
 tools/objtool/orc_gen.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c
index e5ca314..e2c3b4b 100644
--- a/tools/objtool/orc_gen.c
+++ b/tools/objtool/orc_gen.c
@@ -98,6 +98,11 @@ static int create_orc_entry(struct section *u_sec, struct 
section *ip_relasec,
struct orc_entry *orc;
struct rela *rela;
 
+   if (!insn_sec->sym) {
+   WARN("missing symbol for section %s", insn_sec->name);
+   return -1;
+   }
+
/* populate ORC data */
orc = (struct orc_entry *)u_sec->data->d_buf + idx;
memcpy(orc, o, sizeof(*orc));


Re: [PATCH v2 15/16] arm/arm64: smccc: Implement SMCCC v1.1 inline primitive

2018-01-30 Thread Marc Zyngier
On 29/01/18 19:07, Robin Murphy wrote:
> On 29/01/18 17:45, Marc Zyngier wrote:
>> One of the major improvement of SMCCC v1.1 is that it only clobbers
>> the first 4 registers, both on 32 and 64bit. This means that it
>> becomes very easy to provide an inline version of the SMC call
>> primitive, and avoid performing a function call to stash the
>> registers that would otherwise be clobbered by SMCCC v1.0.
> 
> This is disgusting... I love it :D

I expected nothing less from you! ;-)

> 
>> Signed-off-by: Marc Zyngier 
>> ---
>>   include/linux/arm-smccc.h | 157 
>> ++
>>   1 file changed, 157 insertions(+)
>>
>> diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
>> index dd44d8458c04..bc5843728909 100644
>> --- a/include/linux/arm-smccc.h
>> +++ b/include/linux/arm-smccc.h
>> @@ -150,5 +150,162 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, 
>> unsigned long a1,
>>   
>>   #define arm_smccc_hvc_quirk(...) __arm_smccc_hvc(__VA_ARGS__)
>>   
>> +/* SMCCC v1.1 implementation madness follows */
>> +#ifdef CONFIG_ARM64
>> +
>> +#define SMCCC_SMC_INST  "smc#0"
>> +#define SMCCC_HVC_INST  "hvc#0"
>> +
>> +#define __arm_smccc_1_1_prologue(inst)  
>> \
>> +inst "\n"   \
>> +"cbz%[ptr], 1f\n"   \
>> +"stp%x[r0], %x[r1], %[ra0]\n"   \
>> +"stp%x[r2], %x[r3], %[ra2]\n"   \
>> +"1:\n"  \
>> +: [ra0] "=Ump" (*(&___res->a0)),\
>> +  [ra2] "=Ump" (*(&___res->a2)),
> 
> Rather than embedding a guaranteed spill to memory, I wonder if there's 
> money in just always declaring r0-r3 as in-out operands, and propagating 
> them by value afterwards, i.e.:
> 
>   asm(...);
>   if (___res)
>   *___res = (struct arm_smccc_res){ r0, r1, r2, r3 };
> 
> In theory, for sufficiently simple callers that might allow res to stay 
> in registers for its entire lifetime and give nicer codegen. It *might* 
> also simplify some of this macro machinery too, although at this point 
> in the evening I can't really tell...

I just implemented it, and this is indeed much better. In most cases,
the store gets optimized away, mostly because we either pass NULL (and
the condition is dropped) or the store doesn't need to take place as we
evaluate a condition and discard the structure, like in
check_smccc_arch_workaround_1.

In all cases, this allows for slightly reduced levels of cpp madness,
and better codegen. I also suspect it will solve Ard's register
allocation issue.

Thanks,

M.
-- 
Jazz is not dead. It just smells funny...


[tip:x86/pti] objtool: Improve retpoline alternative handling

2018-01-30 Thread tip-bot for Josh Poimboeuf
Commit-ID:  44510d9e1656fbc52721e7ceb41033359576f2a7
Gitweb: https://git.kernel.org/tip/44510d9e1656fbc52721e7ceb41033359576f2a7
Author: Josh Poimboeuf 
AuthorDate: Mon, 29 Jan 2018 22:00:39 -0600
Committer:  Ingo Molnar 
CommitDate: Tue, 30 Jan 2018 07:55:04 +0100

objtool: Improve retpoline alternative handling

Currently objtool requires all retpolines to be:

  a) patched in with alternatives; and

  b) annotated with ANNOTATE_NOSPEC_ALTERNATIVE.

If you forget to do both of the above, objtool segfaults trying to
dereference a NULL 'insn->call_dest' pointer.

Avoid that situation and print a more helpful error message:

  quirks.o: warning: objtool: efi_delete_dummy_variable()+0x99: unsupported 
intra-function call
  quirks.o: warning: objtool: If this is a retpoline, please patch it in with 
alternatives and annotate it with ANNOTATE_NOSPEC_ALTERNATIVE.

Future improvements can be made to make objtool smarter with respect to
retpolines, but this is a good incremental improvement for now.

Reported-and-tested-by: Guenter Roeck 
Signed-off-by: Josh Poimboeuf 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Dave Hansen 
Cc: David Woodhouse 
Cc: Greg Kroah-Hartman 
Cc: H. Peter Anvin 
Cc: Juergen Gross 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/819e50b6d9c2e1a22e34c1a636c0b2057cc8c6e5.1517284349.git.jpoim...@redhat.com
Signed-off-by: Ingo Molnar 
---
 tools/objtool/check.c | 36 
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index f40d46e..bc3490d 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -543,18 +543,14 @@ static int add_call_destinations(struct objtool_file 
*file)
dest_off = insn->offset + insn->len + insn->immediate;
insn->call_dest = find_symbol_by_offset(insn->sec,
dest_off);
-   /*
-* FIXME: Thanks to retpolines, it's now considered
-* normal for a function to call within itself.  So
-* disable this warning for now.
-*/
-#if 0
-   if (!insn->call_dest) {
-   WARN_FUNC("can't find call dest symbol at 
offset 0x%lx",
- insn->sec, insn->offset, dest_off);
+
+   if (!insn->call_dest && !insn->ignore) {
+   WARN_FUNC("unsupported intra-function call",
+ insn->sec, insn->offset);
+   WARN("If this is a retpoline, please patch it 
in with alternatives and annotate it with ANNOTATE_NOSPEC_ALTERNATIVE.");
return -1;
}
-#endif
+
} else if (rela->sym->type == STT_SECTION) {
insn->call_dest = find_symbol_by_offset(rela->sym->sec,
rela->addend+4);
@@ -648,6 +644,8 @@ static int handle_group_alt(struct objtool_file *file,
 
last_new_insn = insn;
 
+   insn->ignore = orig_insn->ignore_alts;
+
if (insn->type != INSN_JUMP_CONDITIONAL &&
insn->type != INSN_JUMP_UNCONDITIONAL)
continue;
@@ -729,10 +727,6 @@ static int add_special_section_alts(struct objtool_file 
*file)
goto out;
}
 
-   /* Ignore retpoline alternatives. */
-   if (orig_insn->ignore_alts)
-   continue;
-
new_insn = NULL;
if (!special_alt->group || special_alt->new_len) {
new_insn = find_insn(file, special_alt->new_sec,
@@ -1089,11 +1083,11 @@ static int decode_sections(struct objtool_file *file)
if (ret)
return ret;
 
-   ret = add_call_destinations(file);
+   ret = add_special_section_alts(file);
if (ret)
return ret;
 
-   ret = add_special_section_alts(file);
+   ret = add_call_destinations(file);
if (ret)
return ret;
 
@@ -1720,10 +1714,12 @@ static int validate_branch(struct objtool_file *file, 
struct instruction *first,
 
insn->visited = true;
 
-   list_for_each_entry(alt, &insn->alts, list) {
-   ret = validate_branch(file, alt->insn, state);
-   if (ret)
-   return 1;
+   if (!insn->ignore_alts) {
+   list_for_each_entry(alt, &insn->alts, list) {
+   ret = validate_branch(file, alt->insn, state);
+   if (ret)
+   return 1;
+   }
 

Re: [patch -mm v2 2/3] mm, memcg: replace cgroup aware oom killer mount option with tunable

2018-01-30 Thread Michal Hocko
On Mon 29-01-18 11:11:39, Tejun Heo wrote:
> Hello, Michal.
> 
> On Mon, Jan 29, 2018 at 11:46:57AM +0100, Michal Hocko wrote:
> > @@ -1292,7 +1292,11 @@ the memory controller considers only cgroups 
> > belonging to the sub-tree
> >  of the OOM'ing cgroup.
> >  
> >  The root cgroup is treated as a leaf memory cgroup, so it's compared
> > -with other leaf memory cgroups and cgroups with oom_group option set.
> > +with other leaf memory cgroups and cgroups with oom_group option
> > +set. Due to internal implementation restrictions the size of the root
> > +cgroup is a cumulative sum of oom_badness of all its tasks (in other
> > +words oom_score_adj of each task is obeyed). This might change in the
> > +future.
> 
> Thanks, we can definitely use more documentation.  However, it's a bit
> difficult to follow.  Maybe expand it to a separate paragraph on the
> current behavior with a clear warning that the default OOM heuristics
> is subject to changes?

Does this sound any better?

>From ea4fa9c36d3ec2cf13d1949169924a1a54b9fcd6 Mon Sep 17 00:00:00 2001
From: Michal Hocko 
Date: Tue, 30 Jan 2018 09:54:15 +0100
Subject: [PATCH] oom, memcg: clarify root memcg oom accounting

David Rientjes has pointed out that the current way how the root memcg
is accounted for the cgroup aware OOM killer is undocumented. Unlike
regular cgroups there is no accounting going on in the root memcg
(mostly for performance reasons). Therefore we are suming up oom_badness
of its tasks. This might result in an over accounting because of the
oom_score_adj setting. Document this for now.

Signed-off-by: Michal Hocko 
---
 Documentation/cgroup-v2.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/cgroup-v2.txt b/Documentation/cgroup-v2.txt
index 2eaed1e2243d..67bdf19f8e5b 100644
--- a/Documentation/cgroup-v2.txt
+++ b/Documentation/cgroup-v2.txt
@@ -1291,8 +1291,14 @@ This affects both system- and cgroup-wide OOMs. For a 
cgroup-wide OOM
 the memory controller considers only cgroups belonging to the sub-tree
 of the OOM'ing cgroup.
 
-The root cgroup is treated as a leaf memory cgroup, so it's compared
-with other leaf memory cgroups and cgroups with oom_group option set.
+Leaf cgroups are compared based on their cumulative memory usage. The
+root cgroup is treated as a leaf memory cgroup as well, so it's
+compared with other leaf memory cgroups. Due to internal implementation
+restrictions the size of the root cgroup is a cumulative sum of
+oom_badness of all its tasks (in other words oom_score_adj of each task
+is obeyed). Relying on oom_score_adj (appart from OOM_SCORE_ADJ_MIN)
+can lead to overestimating of the root cgroup consumption and it is
+therefore discouraged. This might change in the future, though.
 
 If there are no cgroups with the enabled memory controller,
 the OOM killer is using the "traditional" process-based approach.
-- 
2.15.1
-- 
Michal Hocko
SUSE Labs


Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Christian König

Am 30.01.2018 um 08:55 schrieb Michal Hocko:

On Tue 30-01-18 02:56:51, He, Roger wrote:

Hi Michal:

We need a API to tell TTM module the system totally has how many swap
cache.  Then TTM module can use it to restrict how many the swap cache
it can use to prevent triggering OOM.  For Now we set the threshold of
swap size TTM used as 1/2 * total size and leave the rest for others
use.

Why do you so much memory? Are you going to use TB of memory on large
systems? What about memory hotplug when the memory is added/released?


For graphics and compute applications on GPUs it isn't unusual to use 
large amounts of system memory.


Our standard policy in TTM is to allow 50% of system memory to be pinned 
for use with GPUs (the hardware can't do page faults).


When that limit is exceeded (or the shrinker callbacks tell us to make 
room) we wait for any GPU work to finish and copy buffer content into a 
shmem file.


This copy into a shmem file can easily trigger the OOM killer if there 
isn't any swap space left and that is something we want to avoid.


So what we want to do is to apply this 50% rule to swap space as well 
and deny allocation of buffer objects when it is exceeded.



But get_nr_swap_pages is the only API we can accessed from other
module now.  It can't cover the case of the dynamic swap size
increment.  I mean: user can use "swapon" to enable new swap file or
swap disk dynamically or "swapoff" to disable swap space.

Exactly. Your scaling configuration based on get_nr_swap_pages or the
available memory simply sounds wrong.


Why? That is pretty much exactly what we are doing with buffer objects 
and system memory for years.


Regards,
Christian.


Re: [PATCH v3 0/4] KVM: Expose speculation control feature to guests

2018-01-30 Thread David Woodhouse


On Tue, 2018-01-30 at 01:10 +0100, KarimAllah Ahmed wrote:
> Add direct access to speculation control MSRs for KVM guests. This allows the
> guest to protect itself against Spectre V2 using IBRS+IBPB instead of a
> retpoline+IBPB based approach.
> 
> It also exposes the ARCH_CAPABILITIES MSR which is going to be used by future
> Intel processors to indicate RDCL_NO and IBRS_ALL.

Thanks. I think you've already fixed the SPEC_CTRL patch in the git
tree so that it adds F(IBRS) to kvm_cpuid_8000_0008_ebx_x86_features,
right?

The SVM part of Ashok's IBPB patch is still exposing the PRED_CMD MSR
to guests based on boot_cpu_has(IBPB), not based on the *guest*
capabilities. Looking back at Paolo's patch set from January 9th, it
was done differently there but I think it had the same behaviour?

The rest of Paolo's patch set I think has been covered, except 6/8:
 lkml.kernel.org/r/20180109120311.27565-7-pbonz...@redhat.com

That exposes SPEC_CTRL for SVM too (since AMD now apparently has it).
If adding that ends up with duplicate MSR handling for get/set, perhaps
that wants shifting up into kvm_[sg]et_msr_common()? Although I don't
see offhand where you'd put the ->spec_ctrl field in that case. It
doesn't want to live in the generic (even to non-x86) struct kvm_vcpu.
So maybe a little bit of duplication is the best answer.

Other than those details, I think we're mostly getting close. Do we
want to add STIBP on top? There is some complexity there which meant I
was happier getting these first bits ready first, before piling that on
too.

I believe Ashok sent you a change which made us do IBPB on *every*
vmexit; I don't think we need that. It's currently done in vcpu_load()
which means we'll definitely have done it between running one vCPU and
the next, and when vCPUs are pinned we basically never need to do it.

We know that VMM (e.g. qemu) userspace could be vulnerable to attacks
from guest ring 3, because there is no flush between the vmexit and the
host kernel "returning" to the userspace thread. Doing a full IBPB on
*every* vmexit would protect from that, but it's overkill. If that's
the reason, let's come up with something better.


smime.p7s
Description: S/MIME cryptographic signature


Re: [PATCH v19 03/10] video: backlight: Add of_find_backlight helper in backlight.c

2018-01-30 Thread Lee Jones
On Mon, 29 Jan 2018, Sean Paul wrote:
> On Mon, Jan 29, 2018 at 4:11 AM, Lee Jones  wrote:
> > On Fri, 26 Jan 2018, Randy Dunlap wrote:
> >
> >> On 01/26/2018 01:48 AM, Lee Jones wrote:
> >> > On Wed, 24 Jan 2018, Meghana Madhyastha wrote:
> >> >
> >> >> Add of_find_backlight, a helper function which is a generic version
> >> >> of tinydrm_of_find_backlight that can be used by other drivers to avoid
> >> >> repetition of code and simplify things.
> >> >>
> >> >> Acked-by: Daniel Thompson 
> >> >> Reviewed-by: Noralf Trønnes 
> >> >> Reviewed-by: Sean Paul
> >> >> Signed-off-by: Meghana Madhyastha 
> >> >
> >> > Nit: These should be in chronological order.
> >>
> >> Where does that tidbit of information come from?
> >> I have never heard or read that.
> >
> > Not sure it is documented anywhere.  It appeared to be the widely
> > used, most sensible approach, so I adopted it a few years ago.
> >
> > This method provides us with information which would otherwise be
> > absent; including description of the patch submission/acceptance path
> > and an idea of who did what, when.
> >
> > For example:
> >
> > Original Author sign-off
> > Original Co-author sign-off
> > [Additional contributions: rebase, API changes, fix-ups]
> > Re-worker's sign-off
> > Tester's tested-by
> > Reviewer's acked-by/reviewed-by
> > Level-2 Maintainer sign-off
> > Level-1 Maintainer sign-off
> >
> > Are you aware of a more functional/practical/useful method?
> 
> Our tooling adds a Link: tag to the commit message pointing back to
> mailing list archives. This provides more detailed patch provenance in

I've been avoiding using tooling for Maintainership for a long time.
I really do not want to go via that route.  The simpler the better as
far as I'm concerned (KISS [no, I'm not coming on to you!]).

Also, a ML link only provides you with information on the final
iteration of the submitted patch, and still does not provide
information on who did what, when.

> addition to reducing the burden on contributors to order tags

It's not really much of a burden.  Just keep putting the tags at the
bottom when you collect them.  Fortunately this is most developer's
default pattern, so I do not have to bring this up much.

> correctly (I had never heard of this as a requirement either). Check
> out [1]  if you're interested.
> 
> Sean
> 
> [1]- https://01.org/linuxgraphics/gfx-docs/maintainer-tools/dim.html
> 
> >

-- 
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [netfilter-core] kernel panic: Out of memory and no killable processes... (2)

2018-01-30 Thread Dmitry Vyukov
On Tue, Jan 30, 2018 at 9:28 AM, Kirill A. Shutemov
 wrote:
> On Tue, Jan 30, 2018 at 09:11:27AM +0100, Florian Westphal wrote:
>> Michal Hocko  wrote:
>> > On Mon 29-01-18 23:35:22, Florian Westphal wrote:
>> > > Kirill A. Shutemov  wrote:
>> > [...]
>> > > > I hate what I'm saying, but I guess we need some tunable here.
>> > > > Not sure what exactly.
>> > >
>> > > Would memcg help?
>> >
>> > That really depends. I would have to check whether vmalloc path obeys
>> > __GFP_ACCOUNT (I suspect it does except for page tables allocations but
>> > that shouldn't be a big deal). But then the other potential problem is
>> > the life time of the xt_table_info (or other potentially large) data
>> > structures. Are they bound to any process life time.
>>
>> No.
>
> Well, IIUC they bound to net namespace life time, so killing all
> proccesses in the namespace would help to get memory back. :)

... unless the namespace is mounted into file system.

Let's start with NOWARN as that's what kernel generally uses for
allocations with user-controllable size. ENOMEM is roughly as
informative as the WARNING message in this case.

I think we also need to consider setting up memory cgroup for
syzkaller test processes (we do RLIMIT_AS, but that's weak).


Re: [PATCH 4/4] rtc: isl1208: add support for isl1219 with hwmon for tamper detection

2018-01-30 Thread Denis OSTERLAND
Am Montag, den 29.01.2018, 17:41 -0600 schrieb Rob Herring:
> On Tue, Jan 23, 2018 at 01:18:01PM +0100, Michael Grzeschik wrote:
> > 
> > We add support for the ISL1219 chip that got an integrated tamper
> > detection function. This patch implements the feature by using an hwmon
> > interface.
> > 
> > The ISL1219 can also describe the timestamp of the intrusion
> > event. For this we add the documentation of the new interface
> > intrusion[0-*]_timestamp.
> > 
> > The devicetree documentation for the ISL1219 device tree
> > binding is added with an short example.
> > 
> > Signed-off-by: Michael Grzeschik 
> > Signed-off-by: Denis Osterland 
> > ---
> >  .../rtc/{intersil,isl1208.txt => isil,isl1208.txt} |  18 +-
> >  Documentation/hwmon/sysfs-interface|   7 +
> >  drivers/rtc/rtc-isl1208.c  | 190 
> > +++--
> >  3 files changed, 201 insertions(+), 14 deletions(-)
> >  rename Documentation/devicetree/bindings/rtc/{intersil,isl1208.txt => 
> > isil,isl1208.txt} (57%)
> > 
> > diff --git a/Documentation/devicetree/bindings/rtc/intersil,isl1208.txt 
> > b/Documentation/devicetree/bindings/rtc/isil,isl1208.txt
> > similarity index 57%
> > rename from Documentation/devicetree/bindings/rtc/intersil,isl1208.txt
> > rename to Documentation/devicetree/bindings/rtc/isil,isl1208.txt
> > index a54e99feae1ca..d549699e1cfc4 100644
> > --- a/Documentation/devicetree/bindings/rtc/intersil,isl1208.txt
> > +++ b/Documentation/devicetree/bindings/rtc/isil,isl1208.txt
> > @@ -1,14 +1,21 @@
> > -Intersil ISL1208, ISL1218 I2C RTC/Alarm chip
> > +Intersil ISL1208, ISL1218, ISL1219 I2C RTC/Alarm chip
> >  
> >  ISL1208 is a trivial I2C device (it has simple device tree bindings,
> >  consisting of a compatible field, an address and possibly an interrupt
> >  line).
> >  
> > +ISL1219 supports tamper detection user space representation through
> > +case intrusion hwmon sensor.
> User space and hwmon are Linux details not relevant to the binding. Just 
> describe the h/w.
OK.
> 
> > 
> > +ISL1219 has additional pins EVIN and #EVDET for tamper detection.
> > +I2C devices support only one irq. #IRQ and #EVDET are open-drain active 
> > low,
> > +so it is possible layout them to one SoC pin with pull-up.
> > +
> >  Required properties supported by the device:
> >  
> >   - "compatible": must be one of
> >     "isil,isl1208"
> >     "isil,isl1218"
> > +   "isil,isl1219"
> >   - "reg": I2C bus address of the device
> >  
> >  Optional properties:
> > @@ -33,3 +40,12 @@ Example isl1208 node with #IRQ pin connected to SoC 
> > gpio1 pin 12:
> >     interrupt-parent = <&gpio1>;
> >     interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
> >     };
> > +
> > +Example isl1219 node with #IRQ pin and #EVDET pin connected to SoC gpio1 
> > pin 12:
> > +
> > +   isl1219: isl1219@68 {
> > +   compatible = "intersil,isl1219";
> > +   reg = <0x68>;
> > +   interrupts-extended = <&gpio1 12 IRQ_TYPE_EDGE_FALLING>;
> With 2 interrupts, you should have 2 values. If they are connected 
> together, just repeat the connection. Otherwise, you can't tell if EVDET 
> is a no connect.
If I got you right, you suggest an additional IRQ entry to parse.
A short example, #IRQ pin connected to gpio1 pin 12 and
#EVDET pin connected to gpio2 pin 24:

isl1219: rtc@68 {
compatible = "intersil,isl1219";
reg = <0x68>;
interrupt-names = "irq", "evdet";
interrupts-extended = <&gpio1 12 IRQ_TYPE_EDGE_FALLING>,
<&gpio2 24 IRQ_TYPE_EDGE_FALLING>;
};

In driver implementation we need only one interrupt, because we can
determinate action to take based on value of status register.
In current implementation there was no need to do some additional
OF parsing, everything is done by I2C generic code.
I guess, it is not much additional work to do so, but I am not sure
if it´s worthwhile.
> 
> There's not much point in having an example for every compatible. This 
> binding is simple enough, one should be enough.
Shell we remove the example without an interrupt?
> 
> > 
> > +   };
> > +
Diehl AKO Stiftung & Co. KG, Pfannerstraße 75-83, 88239 Wangen im Allgäu
Bereichsvorstand: Dr.-Ing. Michael Siedentop (Sprecher), Josef Fellner 
(Mitglied)
Sitz der Gesellschaft: Wangen i.A. – Registergericht: Amtsgericht Ulm HRA 
620609 – Persönlich haftende Gesellschafterin: Diehl Verwaltungs-Stiftung – 
Sitz: Nürnberg – Registergericht: Amtsgericht Nürnberg HRA 11756 –
Vorstand: Dr.-Ing. E.h. Thomas Diehl (†) (Vorsitzender), Herr 
Dipl.-Wirtsch.-Ing. Wolfgang Weggen (stellvertretender Vorsitzender), 
Dipl.-Kfm. Claus Günther, Dipl.-Kfm. Frank Gutzeit, Dr.-Ing. Heinrich Schunk, 
Dr.-Ing. Michael Siedentop , Dipl.-Kfm. Dr.-Ing. Martin Sommer, Dipl.-Ing. (FH) 
Rainer von Borstel, Vorsitzender des Aufsichtsrates: Dr. Klaus Maier
___
Der Inhalt der vorstehenden E-Mail ist nicht r

Re: possible deadlock in xt_find_table_lock

2018-01-30 Thread Florian Westphal
#syz dup: possible deadlock in do_ip_getsockopt


Re: [PATCH V2] print kdump kernel loaded status in stack dump

2018-01-30 Thread Dave Young
On 01/30/18 at 05:50pm, Sergey Senozhatsky wrote:
> On (01/27/18 12:11), Dave Young wrote:
> > It is useful to print kdump kernel loaded status in dump_stack() 
> > especially when panic happens so that we can differenciate 
> > kdump kernel early hang and a normal panic in a bug report.
> > 
> > Signed-off-by: Dave Young 
> 
> Looks OK to me.
> 
> Reviewed-by: Sergey Senozhatsky 
> 

Thank you Sergey

> 
> I agree with Steven, would be better to move the whole thing
> to lib/dump_stack.c

If nobody has plan I can put it in my todo list, probably do it next
week.

> 
>   -ss

Thanks
Dave


Re: possible deadlock in xt_find_revision

2018-01-30 Thread Florian Westphal
#syz dup: possible deadlock in do_ip_getsockopt


Re: [PATCH] sound/tlv320dac33: Add device tree support

2018-01-30 Thread Filip Matijević
Hi,

On 01/30/2018 09:53 AM, Pavel Machek wrote:
> On Tue 2018-01-30 09:34:46, Ladislav Michl wrote:
>> On Tue, Jan 30, 2018 at 12:33:01AM +0100, Pavel Machek wrote:
>>> On Tue 2018-01-30 00:20:31, Ladislav Michl wrote:
 On Tue, Jan 30, 2018 at 12:05:39AM +0100, Pavel Machek wrote:
>
> This adds device tree support to tlv320dac33.c.
>
> Signed-off-by: Pavel Machek 
>
> diff --git a/Documentation/devicetree/bindings/sound/tlv320dac33.txt 
> b/Documentation/devicetree/bindings/sound/tlv320dac33.txt
> new file mode 100644
> index 000..6cbd311
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/tlv320dac33.txt
> @@ -0,0 +1,32 @@
> +Texas Instruments - tlv320dac33 Codec module
> +
> +The tlv320dac33 serial control bus communicates through I2C protocols.
> +
> +Required properties:
> +
> +- compatible - "ti,tlv320dac33"
> +- reg - I2C slave address
> +
> +Optional properties:
> +
> +- power-gpios - gpio pin to power the device, active high

 While driver used gpio in platform data, isn't it more likely
 regulator which powers device?
>>>
>>> power-gpios = <&gpio2 28 0>; /* gpio_60 */
>>>
>>> Looks like GPIO to me -- example is from Nokia N9. So this appears to
>>> be correct.
>>
>> Device datasheet doesn't list any pin which looks like "power-gpio"
>> http://www.ti.com/lit/ds/symlink/tlv320dac32.pdf
>> Unfortunately I do not know much about N9, but was able to find Nokia 5610
>> scheme to get clue how could be tlv320dac33 hardwired (see page 2):
>> http://mastermobile.spb.ru/service/nokia_5610_rm-242_service_schematics.pdf
>> Here AVDD is powered by LP3985 voltage regulator which is enabled using
>> VEN pin which might be connected to gpio. Or there could be completely
>> different voltage regulator with different controls. And since Linux
>> already has voltage regulator class, lets not limit ourselves to gpio
>> pins.
> 
> Well, notice I'm converting existing driver to device tree. And that
> one already has GPIO dependency. It is possible that more work needs
> to be done there, but that should not be a reason to delay this. Feel
> free to help.
> 
>   Pavel
> 

According to N9 schematics
http://www.s-manuals.com/manuals/phone/nokia/nokia_n9_rm-696_service_schematics_v1.pdf
it's in fact GPIO pin that is connected to reset line (labeled
CODEC_RST). So calling it "power" might be misleading, but the driver
code is quite clear as it labels that GPIO as "tlv320dac33 reset"

Filip


Re: [PATCH] lib/strscpy: remove word-at-a-time optimization.

2018-01-30 Thread Dmitry Vyukov
On Thu, Jan 25, 2018 at 8:13 PM, Andrey Ryabinin
 wrote:
> On 01/25/2018 08:55 PM, Linus Torvalds wrote:
>> On Thu, Jan 25, 2018 at 12:32 AM, Dmitry Vyukov  wrote:
>>> On Wed, Jan 24, 2018 at 6:52 PM, Linus Torvalds
>>>  wrote:

 So I'd *much* rather have some way to tell KASAN that word-at-a-time
 is going on. Because that approach definitely makes a difference in
 other places.
>>>
>>> The other option was to use READ_ONCE_NOCHECK().
>>
>> How about just using the same accessor that we do for the dcache case.
>> That gives a reasonable example of the whole word-at-a-time model, and
>> should be good.
>>
>
> If we also instrument load_unaligned_zeropad() with kasan_check_read(addr, 1),
> than it should be fine. We don't want completely unchecked read of a source 
> string.
>
> But I also would like to revert df4c0e36f1b1 ("fs: dcache: manually unpoison 
> dname after allocation to shut up kasan's reports")
> So I was going to send something like the hunk bellow (split in several 
> patches).
>
> Or we could just use instrumented load_unalingned_zeropad() everywhere, but 
> it seems wrong
> to use it to load *cs only to shut up KASAN.
>
>
> ---
>  fs/dcache.c  |  2 +-
>  include/linux/compiler.h | 11 +++
>  lib/string.c |  2 +-
>  3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/fs/dcache.c b/fs/dcache.c
> index 5c7df1df81ff..6aa7be55a96d 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -195,7 +195,7 @@ static inline int dentry_string_cmp(const unsigned char 
> *cs, const unsigned char
> unsigned long a,b,mask;
>
> for (;;) {
> -   a = *(unsigned long *)cs;
> +   a = READ_PARTIAL_CHECK(*(unsigned long *)cs);
> b = load_unaligned_zeropad(ct);
> if (tcount < sizeof(unsigned long))
> break;
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index 52e611ab9a6c..85b63c2e196e 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -240,6 +240,7 @@ static __always_inline void __write_once_size(volatile 
> void *p, void *res, int s
>   * required ordering.
>   */
>  #include 
> +#include 
>
>  #define __READ_ONCE(x, check)  \
>  ({ \
> @@ -259,6 +260,16 @@ static __always_inline void __write_once_size(volatile 
> void *p, void *res, int s
>   */
>  #define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0)
>
> +#ifdef CONFIG_KASAN
> +#define READ_PARTIAL_CHECK(x)  \
> +({ \
> +   kasan_check_read(&(x), 1);  \
> +   READ_ONCE_NOCHECK(x);   \
> +})
> +#else
> +#define READ_PARTIAL_CHECK(x) (x)
> +#endif
> +
>  #define WRITE_ONCE(x, val) \
>  ({ \
> union { typeof(x) __val; char __c[1]; } __u =   \
> diff --git a/lib/string.c b/lib/string.c
> index 64a9e33f1daa..2396856e4c56 100644
> --- a/lib/string.c
> +++ b/lib/string.c
> @@ -203,7 +203,7 @@ ssize_t strscpy(char *dest, const char *src, size_t count)
> while (max >= sizeof(unsigned long)) {
> unsigned long c, data;
>
> -   c = *(unsigned long *)(src+res);
> +   c = READ_PARTIAL_CHECK(*(unsigned long *)(src+res));
> if (has_zero(c, &data, &constants)) {
> data = prep_zero_mask(c, data, &constants);
> data = create_zero_mask(data);


Looks good to me a general way to support word-at-a-time pattern.

This will also get rid of this in fs/dcache.c:

if (IS_ENABLED(CONFIG_DCACHE_WORD_ACCESS))
kasan_unpoison_shadow(dname,
round_up(name->len + 1, sizeof(unsigned long)));


Backport Mellanox mlx5 patches to stable 4.9.y

2018-01-30 Thread Marta Rybczynska
Hello Mellanox maintainers,
I'd like to ask you to OK backporting two patches in mlx5 driver to 4.9 stable
tree (they're in master for some time already).

We have multiple deployment in 4.9 that are running into the bug fixed by those
patches. We're deploying patched kernels and the issue disappears.

The patches are:
1410a90ae449061b7e1ae19d275148f36948801b net/mlx5: Define interface bits for 
fencing UMR wqe
6e8484c5cf07c7ee632587e98c1a12d319dacb7c RDMA/mlx5: set UMR wqe fence according 
to HCA cap
 
Regards,
Marta


Re: Memory hotplug not increasing the total RAM

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 14:00:06, Bharata B Rao wrote:
> Hi,
> 
> With the latest upstream, I see that memory hotplug is not working
> as expected. The hotplugged memory isn't seen to increase the total
> RAM pages. This has been observed with both x86 and Power guests.
> 
> 1. Memory hotplug code intially marks pages as PageReserved via
> __add_section().
> 2. Later the struct page gets cleared in __init_single_page().
> 3. Next online_pages_range() increments totalram_pages only when
>PageReserved is set.

You are right. I have completely forgot about this late struct page
initialization during onlining. memory hotplug really doesn't want
zeroying. Let me think about a fix.
-- 
Michal Hocko
SUSE Labs


Re: [PATCH V3 0/5] bugs fix for large PEBS mmap read and rdpmc read

2018-01-30 Thread Stephane Eranian
Hi,

On Mon, Jan 29, 2018 at 8:29 AM,  wrote:
>
> From: Kan Liang 
>
> --
>
> Changes since V2:
>  - Refined the changelog
>  - Introduced specific read function for large PEBS.
>The previous generic PEBS read function is confusing.
>Disabled PMU in pmu::read() path for large PEBS.
>Handled the corner case when reload_times == 0.
>  - Modified the parameter of intel_pmu_save_and_restart_reload()
>Discarded local64_cmpxchg
>  - Added fixes tag
>  - Added WARN to handle reload_times == 0 || reload_val == 0
>
> Changes since V1:
>  - Check PERF_X86_EVENT_AUTO_RELOAD before call
>intel_pmu_save_and_restore()

It is not yet clear to me why PERF_SAMPLE_PERIOD is not allowed
with large PEBS. Large PEBS requires fixed period. So the kernel could
make up the period from the event and store it in the sampling buffer.

I tried using large PEBS recently, and despite trying different option
combination of perf record, I was not able to get it to work.

$ perf record  -c 1  -e cpu/event=0xd1,umask=0x10,period=19936/pp
--no-timestamp --no-period -a -C 0

But I was able to make this work with a much older kernel.

Another annoyance I ran into is with perf record requiring -c period
in order not to set
PERF_SAMPLE_PERIOD in the event.

If I do:
perf record  -c 1  -e cpu/event=0xd1,umask=0x10,period=19936/pp
--no-timestamp --no-period -a -C 0

I get

perf_event_attr:
  type 4
  size 112
  config   0x10d1
  { sample_period, sample_freq }   199936
  sample_type  IP|TID|CPU

But if I do:
perf record  -e cpu/event=0xd1,umask=0x10,period=19936/pp
--no-timestamp --no-period -a -C 0

I get

perf_event_attr:
  type 4
  size 112
  config   0x10d1
  { sample_period, sample_freq }   199936
  sample_type  IP|TID|CPU|PERIOD

Perf should check if all events have a period=, then it should not
pass PERF_SAMPLE_PERIOD, even
more so when only one event is defined.

Also it does not seem to honor --no-period.

All of this makes it hard to use large PEBS in general.

So I think your series should also address this part.

>  - Introduce a special purpose intel_pmu_save_and_restart()
>just for AUTO_RELOAD.
>  - New patch to disable userspace RDPMC usage if large PEBS is enabled.
>
> --
>
> There is a bug when mmap read event->count with large PEBS enabled.
> Here is an example.
>  #./read_count
>  0x71f0
>  0x122c0
>  0x11c54
>  0x10001257d
>  0x2bdc5
>
> The bug is caused by two issues.
> - In x86_perf_event_update, the calculation of event->count does not
>   take the auto-reload values into account.
> - In x86_pmu_read, it doesn't count the undrained values in large PEBS
>   buffers.
>
> The first issue was introduced with the auto-reload mechanism enabled
> since commit 851559e35fd5 ("perf/x86/intel: Use the PEBS auto reload
> mechanism when possible")
>
> Patch 1 fixed the issue in x86_perf_event_update.
>
> The second issue was introduced since commit b8241d20699e
> ("perf/x86/intel: Implement batched PEBS interrupt handling (large PEBS
> interrupt threshold)")
>
> Patch 2-4 fixed the issue in x86_pmu_read.
>
> Besides the two issues, the userspace RDPMC usage is broken for large
> PEBS as well.
> The RDPMC issue was also introduced since commit b8241d20699e
> ("perf/x86/intel: Implement batched PEBS interrupt handling (large PEBS
> interrupt threshold)")
>
> Patch 5 fixed the RDPMC issue.
>
> The source code of read_count is as below.
>
> struct cpu {
> int fd;
> struct perf_event_mmap_page *buf;
> };
>
> int perf_open(struct cpu *ctx, int cpu)
> {
> struct perf_event_attr attr = {
> .type = PERF_TYPE_HARDWARE,
> .size = sizeof(struct perf_event_attr),
> .sample_period = 10,
> .config = 0,
> .sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID |
> PERF_SAMPLE_TIME | PERF_SAMPLE_CPU,
> .precise_ip = 3,
> .mmap = 1,
> .comm = 1,
> .task = 1,
> .mmap2 = 1,
> .sample_id_all = 1,
> .comm_exec = 1,
> };
> ctx->buf = NULL;
> ctx->fd = syscall(__NR_perf_event_open, &attr, -1, cpu, -1, 0);
> if (ctx->fd < 0) {
> perror("perf_event_open");
> return -1;
> }
> return 0;
> }
>
> void perf_close(struct cpu *ctx)
> {
> close(ctx->fd);
> if (ctx->buf)
> munmap(ctx->buf, pagesize);
> }
>
> int main(int ac, char **av)
> {
> struct cpu ctx;
> u64 count;
>
> perf_open(&ctx, 0);
>
> while (1) {
> sleep(5);
>
> if (read(ctx.fd, &count, 8) != 8) {
> perror("counter read");
> 

Re: [PATCH 4/4] dmaengine: qcom: bam_dma: Add num-ees dt binding for remotely controlled

2018-01-30 Thread Srinivas Kandagatla

Thanks for the review,

On 29/01/18 16:21, Rob Herring wrote:

On Tue, Jan 16, 2018 at 07:02:36PM +, srinivas.kandaga...@linaro.org wrote:

From: Srinivas Kandagatla 

When Linux is master of BAM, it can directly read registers to know number
of supported execution enviroments, however when its remotely controlled
reading these registers would trigger a crash if the BAM is not yet
intialized/powered up on the remote side.

This patch adds new binding num-ees to specify supported number of
Execution Environments when BAM is remotely controlled.

Signed-off-by: Srinivas Kandagatla 
---
  Documentation/devicetree/bindings/dma/qcom_bam_dma.txt |  2 ++
  drivers/dma/qcom/bam_dma.c | 15 ---
  2 files changed, 14 insertions(+), 3 deletions(-)


The correct split is the binding changes in 1 patch. Driver changes
separate.


Sure, Will Split it in next version.


diff --git a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt 
b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
index aa6822cbb230..f0d10c2b393e 100644
--- a/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
+++ b/Documentation/devicetree/bindings/dma/qcom_bam_dma.txt
@@ -17,6 +17,8 @@ Required properties:
remote proccessor i.e. execution environment.
  - num-channels : optional, indicates supported number of DMA channels in a
remotely controlled bam.
+- num-ees : optional, indicates supported number of Execution Environments in a
+  remotely controlled bam.


This one needs a vendor prefix as it is not a common property.


Make sense, I will change it in next version.

Thanks,
Srini
  
  Example:
  


Re: [PATCH 4/4] drm/amdgpu: Use drm_oom_badness for amdgpu.

2018-01-30 Thread Daniel Vetter
On Thu, Jan 18, 2018 at 11:47:52AM -0500, Andrey Grodzovsky wrote:
> Signed-off-by: Andrey Grodzovsky 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 46a0c93..6a733cdc8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -828,6 +828,7 @@ static const struct file_operations 
> amdgpu_driver_kms_fops = {
>  #ifdef CONFIG_COMPAT
>   .compat_ioctl = amdgpu_kms_compat_ioctl,
>  #endif
> + .oom_file_badness = drm_oom_badness,

Would be neat if we could roll this out for all gem drivers (once it's no
longer an RFC ofc).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [PATCH v6 0/4] x86, kasan: add KASAN checks to atomic operations

2018-01-30 Thread Dmitry Vyukov
On Mon, Jan 29, 2018 at 6:26 PM, Dmitry Vyukov  wrote:
> KASAN uses compiler instrumentation to intercept all memory accesses.
> But it does not see memory accesses done in assembly code.
> One notable user of assembly code is atomic operations. Frequently,
> for example, an atomic reference decrement is the last access to an
> object and a good candidate for a racy use-after-free.
>
> Atomic operations are defined in arch files, but KASAN instrumentation
> is required for several archs that support KASAN. Later we will need
> similar hooks for KMSAN (uninit use detector) and KTSAN (data race
> detector).
>
> This change introduces wrappers around atomic operations that can be
> used to add KASAN/KMSAN/KTSAN instrumentation across several archs,
> and adds KASAN checks to them.
>
> This patch uses the wrappers only for x86 arch. Arm64 will be switched
> later. And we also plan to instrument bitops in a similar way.
>
> Within a day it has found its first bug:
>
> BUG: KASAN: use-after-free in atomic_dec_and_test
> arch/x86/include/asm/atomic.h:123 [inline] at addr 880079c30158
> Write of size 4 by task syz-executor6/25698
> CPU: 2 PID: 25698 Comm: syz-executor6 Not tainted 4.10.0+ #302
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> Call Trace:
>  kasan_check_write+0x14/0x20 mm/kasan/kasan.c:344
>  atomic_dec_and_test arch/x86/include/asm/atomic.h:123 [inline]
>  put_task_struct include/linux/sched/task.h:93 [inline]
>  put_ctx+0xcf/0x110 kernel/events/core.c:1131
>  perf_event_release_kernel+0x3ad/0xc90 kernel/events/core.c:4322
>  perf_release+0x37/0x50 kernel/events/core.c:4338
>  __fput+0x332/0x800 fs/file_table.c:209
>  fput+0x15/0x20 fs/file_table.c:245
>  task_work_run+0x197/0x260 kernel/task_work.c:116
>  exit_task_work include/linux/task_work.h:21 [inline]
>  do_exit+0xb38/0x29c0 kernel/exit.c:880
>  do_group_exit+0x149/0x420 kernel/exit.c:984
>  get_signal+0x7e0/0x1820 kernel/signal.c:2318
>  do_signal+0xd2/0x2190 arch/x86/kernel/signal.c:808
>  exit_to_usermode_loop+0x200/0x2a0 arch/x86/entry/common.c:157
>  syscall_return_slowpath arch/x86/entry/common.c:191 [inline]
>  do_syscall_64+0x6fc/0x930 arch/x86/entry/common.c:286
>  entry_SYSCALL64_slow_path+0x25/0x25
> RIP: 0033:0x4458d9
> RSP: 002b:7f3f07187cf8 EFLAGS: 0246 ORIG_RAX: 00ca
> RAX: fe00 RBX: 007080c8 RCX: 004458d9
> RDX:  RSI:  RDI: 007080c8
> RBP: 007080a8 R08:  R09: 
> R10:  R11: 0246 R12: 
> R13:  R14: 7f3f071889c0 R15: 7f3f07188700
> Object at 880079c30140, in cache task_struct size: 5376
> Allocated:
> PID = 25681
>  kmem_cache_alloc_node+0x122/0x6f0 mm/slab.c:3662
>  alloc_task_struct_node kernel/fork.c:153 [inline]
>  dup_task_struct kernel/fork.c:495 [inline]
>  copy_process.part.38+0x19c8/0x4aa0 kernel/fork.c:1560
>  copy_process kernel/fork.c:1531 [inline]
>  _do_fork+0x200/0x1010 kernel/fork.c:1994
>  SYSC_clone kernel/fork.c:2104 [inline]
>  SyS_clone+0x37/0x50 kernel/fork.c:2098
>  do_syscall_64+0x2e8/0x930 arch/x86/entry/common.c:281
>  return_from_SYSCALL_64+0x0/0x7a
> Freed:
> PID = 25681
>  __cache_free mm/slab.c:3514 [inline]
>  kmem_cache_free+0x71/0x240 mm/slab.c:3774
>  free_task_struct kernel/fork.c:158 [inline]
>  free_task+0x151/0x1d0 kernel/fork.c:370
>  copy_process.part.38+0x18e5/0x4aa0 kernel/fork.c:1931
>  copy_process kernel/fork.c:1531 [inline]
>  _do_fork+0x200/0x1010 kernel/fork.c:1994
>  SYSC_clone kernel/fork.c:2104 [inline]
>  SyS_clone+0x37/0x50 kernel/fork.c:2098
>  do_syscall_64+0x2e8/0x930 arch/x86/entry/common.c:281
>  return_from_SYSCALL_64+0x0/0x7a
>
> Changes since v1:
>  - dropped "x86: remove unused atomic_inc_short()" patch
>it is mailed separately
>  - rebased on top of tip/locking/core head
>  - other changes noted within individual patches
>
> Changes since v2:
>  - rebased on top of tip/locking/core head
>  - dropped a pervasive "x86: use long long for 64-bit atomic ops" commit,
>instead use s64 type in wrappers
>  - added "x86: use s64* for old arg of atomic64_try_cmpxchg()" commit
>
> Changes since v3 are noted in individual commits.
>
> Changes since v4:
>  - rebased on tip/locking/core HEAD
>
> Changes since v5:
>  - rework cmpxchg* implementations so that we have less
>code in macros and more code in functions

Some context.
This revives a half-year old patch. v5 of this was applied to
tip/locking/core, but then reverted due to a reported crash:
https://groups.google.com/d/msg/kasan-dev/ZJl66N7smmk/lJY99HmmAgAJ

The root cause was in the cmpxchg macros:

#define cmpxchg64(ptr, old, new)   \
({ \
   __typeof__(ptr) ptr = (ptr);\
   kasan_check_write(ptr, sizeof(*ptr));   \
   arch_cmpxchg64(ptr, (old), (new));  

Re: [PATCH v6 2/2] media: V3s: Add support for Allwinner CSI.

2018-01-30 Thread Arnd Bergmann
On Tue, Jan 30, 2018 at 8:54 AM, Maxime Ripard
 wrote:
> On Mon, Jan 29, 2018 at 03:34:02PM +0100, Arnd Bergmann wrote:
>> On Mon, Jan 29, 2018 at 10:25 AM, Linus Walleij
>>  wrote:
>> > On Mon, Jan 29, 2018 at 9:25 AM, Maxime Ripard
>> >  wrote:
>> >> On Sat, Jan 27, 2018 at 05:14:26PM +0100, Linus Walleij wrote:

>>
>> At one point we had discussed adding a 'dma-masters' property that
>> lists all the buses on which a device can be a dma master, and
>> the respective properties of those masters (iommu, coherency,
>> offset, ...).
>>
>> IIRC at the time we decided that we could live without that complexity,
>> but perhaps we cannot.
>
> Are you talking about this ?
> https://elixir.free-electrons.com/linux/latest/source/Documentation/devicetree/bindings/dma/dma.txt#L41
>
> It doesn't seem to be related to that issue to me. And in our
> particular cases, all the devices are DMA masters, the RAM is just
> mapped to another address.

No, that's not the one I was thinking of. The idea at the time was much
more generic, and not limited to dma engines. I don't recall the details,
but I think that Thierry was either involved or made the proposal at the
time.

   Arnd


[GIT PULL] printk for 4.16

2018-01-30 Thread Petr Mladek
Linus,

please pull the latest printk changes from

  git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk.git for-linus

=

- Add console_msg_format command line option. The value "default" keeps
  the old "[time stamp] text\n" format. The value "syslog" allows to see
  the syslog-like "[timestamp] text" format.

  This feature was requested by people doing regression tests, for example,
  0day robot. They want to have both filtered and full logs at hands.


- Reduce the risk of softlockup by passing the console owner in a busy loop.

  This is a new approach to the old problem. It was first proposed
  by Steven Rostedt on Kernel Summit 2017. It marks a context in which
  the console_lock owner calls console drivers and could not sleep.
  On the other side, printk() callers could detect this state and
  use a busy wait instead of a simple console_trylock(). Finally,
  the console_lock owner checks if there is a busy waiter at
  the end of the special context and eventually passes
  the console_lock to the waiter.

  The hand-off works surprisingly well and helps in many situations.
  Well, there is still a possibility of the softlockup, for example,
  when the flood of messages stops and the last owner still has too
  much to flush.

  There is increasing number of people having problems with
  printk-related softlockups. We might eventually need to get
  better solution. Anyway, this looks like a good start and
  promising direction.


- Do not allow to schedule in console_unlock() called from
  printk().

  This reverts an older controversial commit. The reschedule
  helped to avoid softlockups. But it also slowed down the console
  output. This patch is obsoleted by the new console waiter logic
  described above. In fact, the reschedule made the hand-off
  less effective.


- Deprecate "%pf" and "%pF" format specifier. It was needed on
  ia64, ppc64 and parisc64 to dereference function descriptors
  and show the real function address. It is done transparently
  by "%ps" and "pS" format specifier now.

  Sergey Senozhatsky found that all the function descriptors
  were in a special elf section and could be easily detected.


- Remove printk_symbol() API. It has been obsoleted by "%pS" format
  specifier.

  This change helped to remove few continuous lines and a less
  intuitive old API.


- Sergey removed unnecessary memset when processing printk.devkmsg
  command line option.

===

There will be few merge conflicts:

- in Documentation/printk-formats.txt:

   - This merge commit removes the obsolete examples for "%pf"
 format specifier.

   - The commit 553d8e8b107159088cc4 ("docs: correct documentation for
 %pK") removed empty line right below this paragraph.


- scripts/checkpatch.pl:

   - This merge commit removes "fF" from the list of valid specifiers.
 checkpatch.pl is going to suggests "%ps" or "%pS" instead.

   - the commit 7b1924a1d930eb27fc ("vsprintf: add printk specifier %px")
 added the "x" specifier to the list.


- one more in Documentation/printk-formats.txt:

   - Jonathan Corbet is going to send conversion of this file to the .rst
 format.


Just in case, you might find the first two conflicts resolved
in
git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk.git tmp



Joel Stanley (1):
  openrisc: Fix conflicting types for _exext and _stext

Petr Mladek (4):
  printk: Hide console waiter logic into helpers
  Merge branch 'for-4.16-deprecate-printk-pf' into for-4.16
  Merge branch 'for-4.16-print-symbol' into for-4.16
  Merge branch 'for-4.16-console-waiter-logic' into for-4.16

Sergey Senozhatsky (24):
  sched/autogroup: remove unneeded kallsyms include
  sched/autogroup: move sched.h include
  printk: add console_msg_format command line option
  arm: do not use print_symbol()
  arm64: do not use print_symbol()
  c6x: do not use print_symbol()
  ia64: do not use print_symbol()
  mn10300: do not use print_symbol()
  sh: do not use print_symbol()
  unicore32: do not use print_symbol()
  x86: do not use print_symbol()
  drivers: do not use print_symbol()
  sysfs: do not use print_symbol()
  irq debug: do not use print_symbol()
  lib: do not use print_symbol()
  sections: split dereference_function_descriptor()
  ia64: Add .opd based function descriptor dereference
  powerpc64: Add .opd based function descriptor dereference
  parisc64: Add .opd based function descriptor dereference
  symbol lookup: introduce dereference_symbol_descriptor()
  checkpatch: add pF/pf deprecation warning
  kallsyms: remove print_symbol() function
  printk: Never set console_may_schedule in console_trylock()
  printk: drop redundant devkmsg_log_str memsets

Steven Rostedt (VMware) (1):
  printk: Add console owner and waiter logic to load balance console writes

 Documentati

Re: [PATCH v6 0/4] x86, kasan: add KASAN checks to atomic operations

2018-01-30 Thread Dmitry Vyukov
On Tue, Jan 30, 2018 at 10:23 AM, Dmitry Vyukov  wrote:
> On Mon, Jan 29, 2018 at 6:26 PM, Dmitry Vyukov  wrote:
>> KASAN uses compiler instrumentation to intercept all memory accesses.
>> But it does not see memory accesses done in assembly code.
>> One notable user of assembly code is atomic operations. Frequently,
>> for example, an atomic reference decrement is the last access to an
>> object and a good candidate for a racy use-after-free.
>>
>> Atomic operations are defined in arch files, but KASAN instrumentation
>> is required for several archs that support KASAN. Later we will need
>> similar hooks for KMSAN (uninit use detector) and KTSAN (data race
>> detector).
>>
>> This change introduces wrappers around atomic operations that can be
>> used to add KASAN/KMSAN/KTSAN instrumentation across several archs,
>> and adds KASAN checks to them.
>>
>> This patch uses the wrappers only for x86 arch. Arm64 will be switched
>> later. And we also plan to instrument bitops in a similar way.
>>
>> Within a day it has found its first bug:
>>
>> BUG: KASAN: use-after-free in atomic_dec_and_test
>> arch/x86/include/asm/atomic.h:123 [inline] at addr 880079c30158
>> Write of size 4 by task syz-executor6/25698
>> CPU: 2 PID: 25698 Comm: syz-executor6 Not tainted 4.10.0+ #302
>> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
>> Call Trace:
>>  kasan_check_write+0x14/0x20 mm/kasan/kasan.c:344
>>  atomic_dec_and_test arch/x86/include/asm/atomic.h:123 [inline]
>>  put_task_struct include/linux/sched/task.h:93 [inline]
>>  put_ctx+0xcf/0x110 kernel/events/core.c:1131
>>  perf_event_release_kernel+0x3ad/0xc90 kernel/events/core.c:4322
>>  perf_release+0x37/0x50 kernel/events/core.c:4338
>>  __fput+0x332/0x800 fs/file_table.c:209
>>  fput+0x15/0x20 fs/file_table.c:245
>>  task_work_run+0x197/0x260 kernel/task_work.c:116
>>  exit_task_work include/linux/task_work.h:21 [inline]
>>  do_exit+0xb38/0x29c0 kernel/exit.c:880
>>  do_group_exit+0x149/0x420 kernel/exit.c:984
>>  get_signal+0x7e0/0x1820 kernel/signal.c:2318
>>  do_signal+0xd2/0x2190 arch/x86/kernel/signal.c:808
>>  exit_to_usermode_loop+0x200/0x2a0 arch/x86/entry/common.c:157
>>  syscall_return_slowpath arch/x86/entry/common.c:191 [inline]
>>  do_syscall_64+0x6fc/0x930 arch/x86/entry/common.c:286
>>  entry_SYSCALL64_slow_path+0x25/0x25
>> RIP: 0033:0x4458d9
>> RSP: 002b:7f3f07187cf8 EFLAGS: 0246 ORIG_RAX: 00ca
>> RAX: fe00 RBX: 007080c8 RCX: 004458d9
>> RDX:  RSI:  RDI: 007080c8
>> RBP: 007080a8 R08:  R09: 
>> R10:  R11: 0246 R12: 
>> R13:  R14: 7f3f071889c0 R15: 7f3f07188700
>> Object at 880079c30140, in cache task_struct size: 5376
>> Allocated:
>> PID = 25681
>>  kmem_cache_alloc_node+0x122/0x6f0 mm/slab.c:3662
>>  alloc_task_struct_node kernel/fork.c:153 [inline]
>>  dup_task_struct kernel/fork.c:495 [inline]
>>  copy_process.part.38+0x19c8/0x4aa0 kernel/fork.c:1560
>>  copy_process kernel/fork.c:1531 [inline]
>>  _do_fork+0x200/0x1010 kernel/fork.c:1994
>>  SYSC_clone kernel/fork.c:2104 [inline]
>>  SyS_clone+0x37/0x50 kernel/fork.c:2098
>>  do_syscall_64+0x2e8/0x930 arch/x86/entry/common.c:281
>>  return_from_SYSCALL_64+0x0/0x7a
>> Freed:
>> PID = 25681
>>  __cache_free mm/slab.c:3514 [inline]
>>  kmem_cache_free+0x71/0x240 mm/slab.c:3774
>>  free_task_struct kernel/fork.c:158 [inline]
>>  free_task+0x151/0x1d0 kernel/fork.c:370
>>  copy_process.part.38+0x18e5/0x4aa0 kernel/fork.c:1931
>>  copy_process kernel/fork.c:1531 [inline]
>>  _do_fork+0x200/0x1010 kernel/fork.c:1994
>>  SYSC_clone kernel/fork.c:2104 [inline]
>>  SyS_clone+0x37/0x50 kernel/fork.c:2098
>>  do_syscall_64+0x2e8/0x930 arch/x86/entry/common.c:281
>>  return_from_SYSCALL_64+0x0/0x7a
>>
>> Changes since v1:
>>  - dropped "x86: remove unused atomic_inc_short()" patch
>>it is mailed separately
>>  - rebased on top of tip/locking/core head
>>  - other changes noted within individual patches
>>
>> Changes since v2:
>>  - rebased on top of tip/locking/core head
>>  - dropped a pervasive "x86: use long long for 64-bit atomic ops" commit,
>>instead use s64 type in wrappers
>>  - added "x86: use s64* for old arg of atomic64_try_cmpxchg()" commit
>>
>> Changes since v3 are noted in individual commits.
>>
>> Changes since v4:
>>  - rebased on tip/locking/core HEAD
>>
>> Changes since v5:
>>  - rework cmpxchg* implementations so that we have less
>>code in macros and more code in functions
>
> Some context.
> This revives a half-year old patch. v5 of this was applied to
> tip/locking/core, but then reverted due to a reported crash:
> https://groups.google.com/d/msg/kasan-dev/ZJl66N7smmk/lJY99HmmAgAJ
>
> The root cause was in the cmpxchg macros:
>
> #define cmpxchg64(ptr, old, new)   \
> ({   

Re: Memory hotplug not increasing the total RAM

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 10:16:00, Michal Hocko wrote:
> On Tue 30-01-18 14:00:06, Bharata B Rao wrote:
> > Hi,
> > 
> > With the latest upstream, I see that memory hotplug is not working
> > as expected. The hotplugged memory isn't seen to increase the total
> > RAM pages. This has been observed with both x86 and Power guests.
> > 
> > 1. Memory hotplug code intially marks pages as PageReserved via
> > __add_section().
> > 2. Later the struct page gets cleared in __init_single_page().
> > 3. Next online_pages_range() increments totalram_pages only when
> >PageReserved is set.
> 
> You are right. I have completely forgot about this late struct page
> initialization during onlining. memory hotplug really doesn't want
> zeroying. Let me think about a fix.

Could you test with the following please? Not an act of beauty but
we are initializing memmap in sparse_add_one_section for memory
hotplug. I hate how this is different from the initialization case
but there is quite a long route to unify those two... So a quick
fix should be as follows.
---
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6129f989223a..97a1d7e96110 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1178,9 +1178,10 @@ static void free_one_page(struct zone *zone,
 }
 
 static void __meminit __init_single_page(struct page *page, unsigned long pfn,
-   unsigned long zone, int nid)
+   unsigned long zone, int nid, bool zero)
 {
-   mm_zero_struct_page(page);
+   if (zero)
+   mm_zero_struct_page(page);
set_page_links(page, zone, nid, pfn);
init_page_count(page);
page_mapcount_reset(page);
@@ -1195,9 +1196,9 @@ static void __meminit __init_single_page(struct page 
*page, unsigned long pfn,
 }
 
 static void __meminit __init_single_pfn(unsigned long pfn, unsigned long zone,
-   int nid)
+   int nid, bool zero)
 {
-   return __init_single_page(pfn_to_page(pfn), pfn, zone, nid);
+   return __init_single_page(pfn_to_page(pfn), pfn, zone, nid, zero);
 }
 
 #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
@@ -1218,7 +1219,7 @@ static void __meminit init_reserved_page(unsigned long 
pfn)
if (pfn >= zone->zone_start_pfn && pfn < zone_end_pfn(zone))
break;
}
-   __init_single_pfn(pfn, zid, nid);
+   __init_single_pfn(pfn, zid, nid, true);
 }
 #else
 static inline void init_reserved_page(unsigned long pfn)
@@ -1535,7 +1536,7 @@ static unsigned long  __init deferred_init_pages(int nid, 
int zid,
} else {
page++;
}
-   __init_single_page(page, pfn, zid, nid);
+   __init_single_page(page, pfn, zid, nid, true);
nr_pages++;
}
return (nr_pages);
@@ -5404,11 +5405,13 @@ void __meminit memmap_init_zone(unsigned long size, int 
nid, unsigned long zone,
if (!(pfn & (pageblock_nr_pages - 1))) {
struct page *page = pfn_to_page(pfn);
 
-   __init_single_page(page, pfn, zone, nid);
+   __init_single_page(page, pfn, zone, nid,
+   context != MEMMAP_HOTPLUG);
set_pageblock_migratetype(page, MIGRATE_MOVABLE);
cond_resched();
} else {
-   __init_single_pfn(pfn, zone, nid);
+   __init_single_pfn(pfn, zone, nid,
+   context != MEMMAP_HOTPLUG);
}
}
 }
-- 
Michal Hocko
SUSE Labs


Re: [RFC] Per file OOM badness

2018-01-30 Thread Michel Dänzer
On 2018-01-24 12:50 PM, Michal Hocko wrote:
> On Wed 24-01-18 12:23:10, Michel Dänzer wrote:
>> On 2018-01-24 12:01 PM, Michal Hocko wrote:
>>> On Wed 24-01-18 11:27:15, Michel Dänzer wrote:
> [...]
 2. If the OOM killer kills a process which is sharing BOs with another
 process, this should result in the other process dropping its references
 to the BOs as well, at which point the memory is released.
>>>
>>> OK. How exactly are those BOs mapped to the userspace?
>>
>> I'm not sure what you're asking. Userspace mostly uses a GEM handle to
>> refer to a BO. There can also be userspace CPU mappings of the BO's
>> memory, but userspace doesn't need CPU mappings for all BOs and only
>> creates them as needed.
> 
> OK, I guess you have to bear with me some more. This whole stack is a
> complete uknonwn. I am mostly after finding a boundary where you can
> charge the allocated memory to the process so that the oom killer can
> consider it. Is there anything like that? Except for the proposed file
> handle hack?

How about the other way around: what APIs can we use to charge /
"uncharge" memory to a process? If we have those, we can experiment with
different places to call them.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


Re: [PATCH v5 1/5] pwm-backlight: enable/disable the PWM before/after LCD enable toggle.

2018-01-30 Thread Enric Balletbo Serra
Hi,

2017-12-01 13:06 GMT+01:00 Enric Balletbo i Serra
:
> Before this patch the enable signal was set before the PWM signal and
> vice-versa on power off. This sequence is wrong, at least, it is on
> the different panels datasheets that I checked, so I inverted the sequence
> to follow the specs.
>
> For reference the following panels have the mentioned sequence:
>   - N133HSE-EA1 (Innolux)
>   - N116BGE (Innolux)
>   - N156BGE-L21 (Innolux)
>   - B101EAN0 (Auo)
>   - B101AW03 (Auo)
>   - LTN101NT05 (Samsung)
>   - CLAA101WA01A (Chunghwa)
>
> Signed-off-by: Enric Balletbo i Serra 
> Acked-by: Daniel Thompson 
> Acked-by: Jingoo Han 
> ---
> Changes since v4:
>  - Rebase on top of mainline.
>  - Add the acks from Daniel Thompson and Jingoo Han.
> Changes since v3:
>  - List the part numbers for the panel checked (Daniel Thompson)
> Changes since v2:
>  - Add this as a separate patch (Thierry Reding)
> Changes since v1:
>  - None
>
>  drivers/video/backlight/pwm_bl.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/video/backlight/pwm_bl.c 
> b/drivers/video/backlight/pwm_bl.c
> index 1c2289d..698ec68 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -54,10 +54,11 @@ static void pwm_backlight_power_on(struct pwm_bl_data 
> *pb, int brightness)
> if (err < 0)
> dev_err(pb->dev, "failed to enable power supply\n");
>
> +   pwm_enable(pb->pwm);
> +
> if (pb->enable_gpio)
> gpiod_set_value_cansleep(pb->enable_gpio, 1);
>
> -   pwm_enable(pb->pwm);
> pb->enabled = true;
>  }
>
> @@ -66,12 +67,12 @@ static void pwm_backlight_power_off(struct pwm_bl_data 
> *pb)
> if (!pb->enabled)
> return;
>
> -   pwm_config(pb->pwm, 0, pb->period);
> -   pwm_disable(pb->pwm);
> -
> if (pb->enable_gpio)
> gpiod_set_value_cansleep(pb->enable_gpio, 0);
>
> +   pwm_config(pb->pwm, 0, pb->period);
> +   pwm_disable(pb->pwm);
> +
> regulator_disable(pb->power_supply);
> pb->enabled = false;
>  }
> --
> 2.9.3
>

A gentle ping, It's been nearly two months since I sent this patchset,
there is anything else that prevents these patches to land or
incorporate in linux-next?

Thanks,
 Enric


Re: [RFC] Per file OOM badness

2018-01-30 Thread Daniel Vetter
On Wed, Jan 24, 2018 at 01:11:09PM +0100, Christian König wrote:
> Am 24.01.2018 um 12:50 schrieb Michal Hocko:
> > On Wed 24-01-18 12:23:10, Michel Dänzer wrote:
> > > On 2018-01-24 12:01 PM, Michal Hocko wrote:
> > > > On Wed 24-01-18 11:27:15, Michel Dänzer wrote:
> > [...]
> > > > > 2. If the OOM killer kills a process which is sharing BOs with another
> > > > > process, this should result in the other process dropping its 
> > > > > references
> > > > > to the BOs as well, at which point the memory is released.
> > > > OK. How exactly are those BOs mapped to the userspace?
> > > I'm not sure what you're asking. Userspace mostly uses a GEM handle to
> > > refer to a BO. There can also be userspace CPU mappings of the BO's
> > > memory, but userspace doesn't need CPU mappings for all BOs and only
> > > creates them as needed.
> > OK, I guess you have to bear with me some more. This whole stack is a
> > complete uknonwn. I am mostly after finding a boundary where you can
> > charge the allocated memory to the process so that the oom killer can
> > consider it. Is there anything like that? Except for the proposed file
> > handle hack?
> 
> Not that I knew of.
> 
> As I said before we need some kind of callback that a process now starts to
> use a file descriptor, but without anything from that file descriptor mapped
> into the address space.

For more context: With DRI3 and wayland the compositor opens the DRM fd
and then passes it to the client, which then starts allocating stuff. That
makes book-keeping rather annoying.

I guess a good first order approximation would be if we simply charge any
newly allocated buffers to the process that created them, but that means
hanging onto lots of mm_struct pointers since we want to make sure we then
release those pages to the right mm again (since the process that drops
the last ref might be a totally different one, depending upon how the
buffers or DRM fd have been shared).

Would it be ok to hang onto potentially arbitrary mmget references
essentially forever? If that's ok I think we can do your process based
account (minus a few minor inaccuracies for shared stuff perhaps, but no
one cares about that).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [PATCH v3 0/4] KVM: Expose speculation control feature to guests

2018-01-30 Thread KarimAllah Ahmed

On 01/30/2018 10:00 AM, David Woodhouse wrote:



On Tue, 2018-01-30 at 01:10 +0100, KarimAllah Ahmed wrote:

Add direct access to speculation control MSRs for KVM guests. This allows the
guest to protect itself against Spectre V2 using IBRS+IBPB instead of a
retpoline+IBPB based approach.

It also exposes the ARCH_CAPABILITIES MSR which is going to be used by future
Intel processors to indicate RDCL_NO and IBRS_ALL.


Thanks. I think you've already fixed the SPEC_CTRL patch in the git
tree so that it adds F(IBRS) to kvm_cpuid_8000_0008_ebx_x86_features,
right?

Yup, this is already fixed in the tree.



The SVM part of Ashok's IBPB patch is still exposing the PRED_CMD MSR
to guests based on boot_cpu_has(IBPB), not based on the *guest*
capabilities. Looking back at Paolo's patch set from January 9th, it
was done differently there but I think it had the same behaviour?

The rest of Paolo's patch set I think has been covered, except 6/8:
  lkml.kernel.org/r/20180109120311.27565-7-pbonz...@redhat.com

That exposes SPEC_CTRL for SVM too (since AMD now apparently has it).
If adding that ends up with duplicate MSR handling for get/set, perhaps
that wants shifting up into kvm_[sg]et_msr_common()? Although I don't
see offhand where you'd put the ->spec_ctrl field in that case. It
doesn't want to live in the generic (even to non-x86) struct kvm_vcpu.
So maybe a little bit of duplication is the best answer.

Other than those details, I think we're mostly getting close. Do we
want to add STIBP on top? There is some complexity there which meant I
was happier getting these first bits ready first, before piling that on
too.

I believe Ashok sent you a change which made us do IBPB on *every*
vmexit; I don't think we need that. It's currently done in vcpu_load()
which means we'll definitely have done it between running one vCPU and
the next, and when vCPUs are pinned we basically never need to do it.

We know that VMM (e.g. qemu) userspace could be vulnerable to attacks
from guest ring 3, because there is no flush between the vmexit and the
host kernel "returning" to the userspace thread. Doing a full IBPB on
*every* vmexit would protect from that, but it's overkill. If that's
the reason, let's come up with something better.


Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B


Re: [PATCH] drm: Check for lessee in DROP_MASTER ioctl

2018-01-30 Thread Daniel Vetter
On Thu, Jan 18, 2018 at 05:51:59PM -0800, Keith Packard wrote:
> Don't let a lessee control what the current DRM master is set to;
> that's the job of the "real" master. Otherwise, the lessee would
> disable all access to master operations for the owner and all lessees
> under it.
> 
> This matches the same check made in the SET_MASTER ioctl.
> 
> Signed-off-by: Keith Packard 

Similar check for setmaster already exists, so looks all good. Do we have
an igt for all this? Iirc there was one floating around, but no idea
what's the status. Might also be good to resubmit them so i915 CI can run
the tests (now that the code has landed).

On the patch itself, minus lack of testcases:

Reviewed-by: Daniel Vetter 

> ---
>  drivers/gpu/drm/drm_auth.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index aad468d170a7..d9c0f7573905 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -230,6 +230,12 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void 
> *data,
>   if (!dev->master)
>   goto out_unlock;
>  
> + if (file_priv->master->lessor != NULL) {
> + DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", 
> file_priv->master->lessee_id);
> + ret = -EINVAL;
> + goto out_unlock;
> + }
> +
>   ret = 0;
>   drm_drop_master(dev, file_priv);
>  out_unlock:
> -- 
> 2.15.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [PATCH V2] print kdump kernel loaded status in stack dump

2018-01-30 Thread Petr Mladek
On Tue 2018-01-30 17:07:29, Dave Young wrote:
> On 01/30/18 at 05:50pm, Sergey Senozhatsky wrote:
> > On (01/27/18 12:11), Dave Young wrote:
> > > It is useful to print kdump kernel loaded status in dump_stack() 
> > > especially when panic happens so that we can differenciate 
> > > kdump kernel early hang and a normal panic in a bug report.
> > > 
> > > Signed-off-by: Dave Young 
> > 
> > Looks OK to me.
> > 
> > Reviewed-by: Sergey Senozhatsky 

Same here:

Reviewed-by: Petr Mladek 

> > I agree with Steven, would be better to move the whole thing
> > to lib/dump_stack.c
> 
> If nobody has plan I can put it in my todo list, probably do it next
> week.

Sounds good.

JFYI, I would target these changes for 4.17. There was some discussion
about where and how to show the new information. IMHO, it would deserve
some gurgling in linux-next.

Best Regards,
Petr


Re: [PATCH] sound/tlv320dac33: Add device tree support

2018-01-30 Thread Ladislav Michl
On Tue, Jan 30, 2018 at 10:11:02AM +0100, Filip Matijević wrote:
> Hi,
> 
> On 01/30/2018 09:53 AM, Pavel Machek wrote:
> > On Tue 2018-01-30 09:34:46, Ladislav Michl wrote:
> >> On Tue, Jan 30, 2018 at 12:33:01AM +0100, Pavel Machek wrote:
> >>> On Tue 2018-01-30 00:20:31, Ladislav Michl wrote:
>  On Tue, Jan 30, 2018 at 12:05:39AM +0100, Pavel Machek wrote:
> >
> > This adds device tree support to tlv320dac33.c.
> >
> > Signed-off-by: Pavel Machek 
> >
> > diff --git a/Documentation/devicetree/bindings/sound/tlv320dac33.txt 
> > b/Documentation/devicetree/bindings/sound/tlv320dac33.txt
> > new file mode 100644
> > index 000..6cbd311
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/tlv320dac33.txt
> > @@ -0,0 +1,32 @@
> > +Texas Instruments - tlv320dac33 Codec module
> > +
> > +The tlv320dac33 serial control bus communicates through I2C protocols.
> > +
> > +Required properties:
> > +
> > +- compatible - "ti,tlv320dac33"
> > +- reg - I2C slave address
> > +
> > +Optional properties:
> > +
> > +- power-gpios - gpio pin to power the device, active high
> 
>  While driver used gpio in platform data, isn't it more likely
>  regulator which powers device?
> >>>
> >>> power-gpios = <&gpio2 28 0>; /* gpio_60 */
> >>>
> >>> Looks like GPIO to me -- example is from Nokia N9. So this appears to
> >>> be correct.
> >>
> >> Device datasheet doesn't list any pin which looks like "power-gpio"
> >> http://www.ti.com/lit/ds/symlink/tlv320dac32.pdf
> >> Unfortunately I do not know much about N9, but was able to find Nokia 5610
> >> scheme to get clue how could be tlv320dac33 hardwired (see page 2):
> >> http://mastermobile.spb.ru/service/nokia_5610_rm-242_service_schematics.pdf
> >> Here AVDD is powered by LP3985 voltage regulator which is enabled using
> >> VEN pin which might be connected to gpio. Or there could be completely
> >> different voltage regulator with different controls. And since Linux
> >> already has voltage regulator class, lets not limit ourselves to gpio
> >> pins.
> > 
> > Well, notice I'm converting existing driver to device tree. And that
> > one already has GPIO dependency. It is possible that more work needs
> > to be done there, but that should not be a reason to delay this. Feel
> > free to help.

Adding DT properties that need to be maintained for compatibility reasons
is a bad idea and very good reason to delay merging unfinished stuff.
And meanwhile it turned out it is not power-gpio :)

> According to N9 schematics
> http://www.s-manuals.com/manuals/phone/nokia/nokia_n9_rm-696_service_schematics_v1.pdf
> it's in fact GPIO pin that is connected to reset line (labeled
> CODEC_RST). So calling it "power" might be misleading, but the driver
> code is quite clear as it labels that GPIO as "tlv320dac33 reset"

Thanks a lot! So now it is clear that gpio is connected to codec's nRESET pin,
therefore "reset-gpios" property seems reasonable here.

ladis


Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 14:35:12, Michael Ellerman wrote:
> Michal Hocko  writes:
> 
> > On Mon 29-01-18 11:02:09, Anshuman Khandual wrote:
> >> On 01/29/2018 08:17 AM, Anshuman Khandual wrote:
> >> > On 01/26/2018 07:34 PM, Michal Hocko wrote:
> >> >> On Fri 26-01-18 18:04:27, Anshuman Khandual wrote:
> >> >> [...]
> >> >>> I tried to instrument mmap_region() for a single instance of 'sed'
> >> >>> binary and traced all it's VMA creation. But there is no trace when
> >> >>> that 'anon' VMA got created which suddenly shows up during subsequent
> >> >>> elf_map() call eventually failing it. Please note that the following
> >> >>> VMA was never created through call into map_region() in the process
> >> >>> which is strange.
> ...
> >> 
> >> Okay, this colliding VMA seems to be getting loaded from load_elf_binary()
> >> function as well.
> >> 
> >> [9.422410] vma c01fceedbc40 start 1003 end 
> >> 1004
> >> next c01fceedbe80 prev c01fceedb700 mm c01fceea8200
> >> prot 8104 anon_vma   (null) vm_ops   (null)
> >> pgoff 1003 file   (null) private_data   (null)
> >> flags: 0x100073(read|write|mayread|maywrite|mayexec|account)
> >> [9.422576] CPU: 46 PID: 7457 Comm: sed Not tainted 4.14.0-dirty #158
> >> [9.422610] Call Trace:
> >> [9.422623] [c01fdc4f79b0] [c0b17ac0] dump_stack+0xb0/0xf0 
> >> (unreliable)
> >> [9.422670] [c01fdc4f79f0] [c02dafb8] 
> >> do_brk_flags+0x2d8/0x440
> >> [9.422708] [c01fdc4f7ac0] [c02db3d0] 
> >> vm_brk_flags+0x80/0x130
> >> [9.422747] [c01fdc4f7b20] [c03d23a4] set_brk+0x80/0xdc
> >> [9.422785] [c01fdc4f7b60] [c03d1f24] 
> >> load_elf_binary+0x1304/0x158c
> >> [9.422830] [c01fdc4f7c80] [c035d3e0] 
> >> search_binary_handler+0xd0/0x270
> >> [9.422881] [c01fdc4f7d10] [c035f338] 
> >> do_execveat_common.isra.31+0x658/0x890
> >> [9.422926] [c01fdc4f7df0] [c035f980] SyS_execve+0x40/0x50
> >> [9.423588] [c01fdc4f7e30] [c000b220] system_call+0x58/0x6c
> >> 
> >> which is getting hit after adding some more debug.
> >
> > Voila! So your binary simply overrides brk by elf segments. That sounds
> > like the exactly the thing that the patch is supposed to protect from.
> > Why this is the case I dunno. It is just clear that either brk or
> > elf base are not put to the proper place. Something to get fixed. You
> > are probably just lucky that brk allocations do not spil over to elf
> > mappings.
> 
> It is something to get fixed, but we can't retrospectively fix the
> existing binaries sitting on peoples' systems.

Yeah. Can we identify those somehow? Are they something people can
easily come across?

> Possibly powerpc arch code is doing something with the mmap layout or
> something else that is confusing the ELF loader, in which case we should
> fix that.

Yes this definitely should be fixed. How can elf loader completely
overlap brk mapping?

> But if not then the only solution is for the ELF loader to be more
> tolerant of this situation.
> 
> So for 4.16 this patch either needs to be dropped, or reworked such that
> powerpc can opt out of it.

Yeah, let's hold on merging this until we understand what the heck is
going on here. If this turnes to be unfixable I will think of a way for
ppc to opt out.

Anshuman, could you try to run
sed 's@^@@' /proc/self/smaps
on a system with MAP_FIXED_NOREPLACE reverted?
-- 
Michal Hocko
SUSE Labs


Re: [PATCH] srcu: fix misprint in srcu_funnel_exp_start

2018-01-30 Thread Paul E. McKenney
On Mon, Jan 29, 2018 at 09:23:09PM +0300, Ildar Ismagilov wrote:
> Signed-off-by: Ildar Ismagilov 

The original does look backwards, now that you mention it, thank you
for sending it.

Did you see any performance differences from this patch?

Thanx, Paul

> ---
>  kernel/rcu/srcutree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> index 6d5880089ff6..1798d1aa60fa 100644
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -599,7 +599,7 @@ static void srcu_funnel_exp_start(struct srcu_struct *sp, 
> struct srcu_node *snp,
>   raw_spin_unlock_irqrestore_rcu_node(snp, flags);
>   }
>   raw_spin_lock_irqsave_rcu_node(sp, flags);
> - if (!ULONG_CMP_LT(sp->srcu_gp_seq_needed_exp, s))
> + if (ULONG_CMP_LT(sp->srcu_gp_seq_needed_exp, s))
>   sp->srcu_gp_seq_needed_exp = s;
>   raw_spin_unlock_irqrestore_rcu_node(sp, flags);
>  }
> -- 
> 2.11.0
> 



Re: [PATCH] hrtimer: Reset hrtimer cpu base proper on CPU hotplug

2018-01-30 Thread Paul E. McKenney
On Mon, Jan 29, 2018 at 01:57:38AM -0800, Paul E. McKenney wrote:
> On Mon, Jan 29, 2018 at 09:20:48AM +0100, Sebastian Sewior wrote:
> > On 2018-01-26 14:09:17 [-0800], Paul E. McKenney wrote:
> > > find this one.  ;-)  But it did pass rcutorture testing for a great many
> > > years, didn't it?  :-/
> > 
> > It started to trigger better (or at all) on our test box with
> > modprobe kvm_intel preemption_timer=n
> > 
> > on the host kernel so maybe a completely unrelated change helped to
> > trigger this.
> 
> Good point!
> 
> And testing continues, currently at 108 hours of TREE01 without any
> waylayed timers, so looking good!  ;-)
> 
> Just kicked off another 70 hours worth.

And those completed without incident for a total of 178 hours.  I believe
we can call this one fixed.  Thank you all!!!

One question...  Is the patch shown below needed, or is this just yet
another case of me being confused?  (The lack of it is not triggering,
but...)

Thanx, Paul



commit accb0edb85526a05b934eac49658d05ea0216fc4
Author: Paul E. McKenney 
Date:   Thu Dec 7 13:18:44 2017 -0800

timers: Ensure that timer_base ->clk accounts for time offline

The timer_base ->must_forward_clk is set to indicate that the next timer
operation on that timer_base must check for passage of time.  One instance
of time passage is when the timer wheel goes idle, and another is when
the corresponding CPU is offline.  Note that it is not appropriate to set
->is_idle because that could result in IPIing an offline CPU.  Therefore,
this commit instead sets ->must_forward_clk at CPU-offline time.

Signed-off-by: Paul E. McKenney 

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index ffebcf878fba..94cce780c574 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1875,6 +1875,7 @@ int timers_dead_cpu(unsigned int cpu)
 
BUG_ON(old_base->running_timer);
 
+   old_base->must_forward_clk = true;
for (i = 0; i < WHEEL_SIZE; i++)
migrate_timer_list(new_base, old_base->vectors + i);
 



Re: [RFC] Per file OOM badness

2018-01-30 Thread Michel Dänzer
On 2018-01-30 10:31 AM, Daniel Vetter wrote:
> On Wed, Jan 24, 2018 at 01:11:09PM +0100, Christian König wrote:
>> Am 24.01.2018 um 12:50 schrieb Michal Hocko:
>>> On Wed 24-01-18 12:23:10, Michel Dänzer wrote:
 On 2018-01-24 12:01 PM, Michal Hocko wrote:
> On Wed 24-01-18 11:27:15, Michel Dänzer wrote:
>>> [...]
>> 2. If the OOM killer kills a process which is sharing BOs with another
>> process, this should result in the other process dropping its references
>> to the BOs as well, at which point the memory is released.
> OK. How exactly are those BOs mapped to the userspace?
 I'm not sure what you're asking. Userspace mostly uses a GEM handle to
 refer to a BO. There can also be userspace CPU mappings of the BO's
 memory, but userspace doesn't need CPU mappings for all BOs and only
 creates them as needed.
>>> OK, I guess you have to bear with me some more. This whole stack is a
>>> complete uknonwn. I am mostly after finding a boundary where you can
>>> charge the allocated memory to the process so that the oom killer can
>>> consider it. Is there anything like that? Except for the proposed file
>>> handle hack?
>>
>> Not that I knew of.
>>
>> As I said before we need some kind of callback that a process now starts to
>> use a file descriptor, but without anything from that file descriptor mapped
>> into the address space.
> 
> For more context: With DRI3 and wayland the compositor opens the DRM fd
> and then passes it to the client, which then starts allocating stuff. That
> makes book-keeping rather annoying.

Actually, what you're describing is only true for the buffers shared by
an X server with an X11 compositor. For the actual applications, the
buffers are created on the client side and then shared with the X server
/ Wayland compositor.

Anyway, it doesn't really matter. In all cases, the buffers are actually
used by all parties that are sharing them, so charging the memory to all
of them is perfectly appropriate.


> I guess a good first order approximation would be if we simply charge any
> newly allocated buffers to the process that created them, but that means
> hanging onto lots of mm_struct pointers since we want to make sure we then
> release those pages to the right mm again (since the process that drops
> the last ref might be a totally different one, depending upon how the
> buffers or DRM fd have been shared).
> 
> Would it be ok to hang onto potentially arbitrary mmget references
> essentially forever? If that's ok I think we can do your process based
> account (minus a few minor inaccuracies for shared stuff perhaps, but no
> one cares about that).

Honestly, I think you and Christian are overthinking this. Let's try
charging the memory to every process which shares a buffer, and go from
there.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


Re: [PATCH] drm/edid: use false for boolean value

2018-01-30 Thread Daniel Vetter
On Tue, Jan 23, 2018 at 10:46:07AM -0600, Gustavo A. R. Silva wrote:
> Assign true or false to boolean variables instead of an integer value.
> 
> This issue was detected with the help of Coccinelle.
> 
> Signed-off-by: Gustavo A. R. Silva 

Thanks for your patch.

> ---
>  drivers/gpu/drm/drm_edid.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index ddd5379..45a80d7 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2767,7 +2767,7 @@ do_detailed_mode(struct detailed_timing *timing, void 
> *c)
>  
>   drm_mode_probed_add(closure->connector, newmode);
>   closure->modes++;
> - closure->preferred = 0;
> + closure->preferred = false;

There's also

.preferred = 1,

in add_detailed_modes. Please fix that one up too for consistency, then
I'll merge your patch.

Cheers, Daniel

>   }
>  }
>  
> -- 
> 2.7.4
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [PATCH 1/2] arm64: dts: sdm845: Add minimal dts/dtsi files for sdm845 SoC and MTP

2018-01-30 Thread Stephen Boyd
On 01/29, Rajendra Nayak wrote:
> 
> 
> On 01/27/2018 03:45 AM, Stephen Boyd wrote:
> > On 01/25, Rajendra Nayak wrote:
> >>  create mode 100644 arch/arm64/boot/dts/qcom/sdm845-mtp.dts
> >>  create mode 100644 arch/arm64/boot/dts/qcom/sdm845-mtp.dtsi
> > 
> > Do we really need two files? Maybe collapse the two?
> 
> will do. Not sure why, but this is how all other qualcomm
> boards are structured with an almost empty .dts file.

I think it's because we have v1, v2, v3, etc. when we're sorting
out the versions of silicon, but then those are all dropped when
everything is done. Upstream we probably never care.

> >> +
> >> +  core2 {
> >> +  cpu = <&CPU6>;
> >> +  };
> >> +
> >> +  core3 {
> >> +  cpu = <&CPU7>;
> >> +  };
> >> +  };
> >> +  };
> > 
> > From what I recall, this layout causes the kernel to spew
> > warnings? I mean to say this is the power/performance view, but
> > not the architectural view.
> 
> hmm, I haven't seen any warnings with this when I boot up on my sdm845
> MTP. Will recheck.

Ok! I will recheck as well.

> 
> > 
> >> +  };
> >> +
> >> +  timer {
> >> +  compatible = "arm,armv8-timer";
> >> +  interrupts =  >> IRQ_TYPE_LEVEL_LOW)>,
> > 
> > Are we supposed to use the GIC_CPU_MASK_SIMPLE macros still?
> 
> Not sure, is there another way?

Me either. See this thread from Marc[1]. I guess just drop them?

[1] http://lkml.iu.edu/hypermail/linux/kernel/1702.0/03522.html
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


Re: [PATCH v7 07/11] media: i2c: ov772x: Support frame interval handling

2018-01-30 Thread jacopo mondi
Hi Laurent,

On Mon, Jan 29, 2018 at 01:01:01PM +0200, Laurent Pinchart wrote:
> Hi Jacopo,
>
> Thank you for the patch.
>
> On Friday, 26 January 2018 15:55:26 EET Jacopo Mondi wrote:
> > Add support to ov772x driver for frame intervals handling and enumeration.
> > Tested with 10MHz and 24MHz input clock at VGA and QVGA resolutions for
> > 10, 15 and 30 frame per second rates.
> >
> > Signed-off-by: Jacopo Mondi 
> > ---
> > drivers/media/i2c/ov772x.c | 315 +-
> > 1 file changed, 310 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
> > index 912b1b9..6d46748 100644
> > --- a/drivers/media/i2c/ov772x.c
> > +++ b/drivers/media/i2c/ov772x.c
> > @@ -250,6 +250,7 @@
> >  #define AEC_1p2 0x10   /*  01: 1/2  window */
> >  #define AEC_1p4 0x20   /*  10: 1/4  window */
> >  #define AEC_2p3 0x30   /*  11: Low 2/3 window */
> > +#define COM4_RESERVED   0x01   /* Reserved value */
>
> I'd write "Reserved bits", "Reserved value" makes it sound like it's the value
> of the full register.
>

Ack

> >  /* COM5 */
> >  #define AFR_ON_OFF  0x80   /* Auto frame rate control ON/OFF 
> > selection
> */
> > @@ -267,6 +268,19 @@
> > /* AEC max step control */
> >  #define AEC_NO_LIMIT0x01   /*   0 : AEC incease step has limit */
> > /*   1 : No limit to AEC increase step */
> > +/* CLKRC */
> > +   /* Input clock divider register */
> > +#define CLKRC_RESERVED  0x80   /* Reserved value */
> > +#define CLKRC_BYPASS0x40   /* Bypass input clock divider */
> > +#define CLKRC_DIV2  0x01   /* Divide input clock by 2 */
> > +#define CLKRC_DIV3  0x02   /* Divide input clock by 3 */
> > +#define CLKRC_DIV4  0x03   /* Divide input clock by 4 */
> > +#define CLKRC_DIV5  0x04   /* Divide input clock by 5 */
> > +#define CLKRC_DIV6  0x05   /* Divide input clock by 6 */
> > +#define CLKRC_DIV8  0x07   /* Divide input clock by 8 */
> > +#define CLKRC_DIV10 0x09   /* Divide input clock by 10 */
> > +#define CLKRC_DIV16 0x0f   /* Divide input clock by 16 */
> > +#define CLKRC_DIV20 0x13   /* Divide input clock by 20 */
>
> How about just
>
> #define CLKRC_DIV(n)  ((n) - 1)
>

Ack again,

> >  /* COM7 */
> > /* SCCB Register Reset */
> > @@ -373,6 +387,12 @@
> >  #define VERSION(pid, ver) ((pid<<8)|(ver&0xFF))
> >
> >  /*
> > + * Input clock frequencies
> > + */
> > +enum { OV772X_FIN_10MHz, OV772X_FIN_24MHz, OV772X_FIN_48MHz, OV772X_FIN_N,
> > };
> > +static unsigned int ov772x_fin_vals[] = { 1000, 2400, 4800
> > };
> > +
> > +/*
> >   * struct
> >   */
> >
> > @@ -391,6 +411,16 @@ struct ov772x_win_size {
> > struct v4l2_rect  rect;
> >  };
> >
> > +struct ov772x_pclk_config {
> > +   u8 com4;
> > +   u8 clkrc;
> > +};
> > +
> > +struct ov772x_frame_rate {
> > +   unsigned int fps;
> > +   const struct ov772x_pclk_config pclk[OV772X_FIN_N];
> > +};
> > +
> >  struct ov772x_priv {
> > struct v4l2_subdevsubdev;
> > struct v4l2_ctrl_handler  hdl;
> > @@ -404,6 +434,7 @@ struct ov772x_priv {
> > unsigned shortflag_hflip:1;
> > /* band_filter = COM8[5] ? 256 - BDBASE : 0 */
> > unsigned shortband_filter;
> > +   unsigned int  fps;
> >  };
> >
> >  /*
> > @@ -508,6 +539,154 @@ static const struct ov772x_win_size ov772x_win_sizes[]
> > = { };
> >
> >  /*
> > + * frame rate settings lists
> > + */
> > +unsigned int ov772x_frame_intervals[] = {10, 15, 30, 60};
> > +#define OV772X_N_FRAME_INTERVALS ARRAY_SIZE(ov772x_frame_intervals)
> > +
> > +static const struct ov772x_frame_rate vga_frame_rates[] = {
> > +   {   /* PCLK = 7,5 MHz */
> > +   .fps= 10,
> > +   .pclk = {
> > +   [OV772X_FIN_10MHz] = {
> > +   .com4   = PLL_6x | COM4_RESERVED,
> > +   .clkrc  = CLKRC_DIV8 | CLKRC_RESERVED,
> > +   },
> > +   [OV772X_FIN_24MHz] = {
> > +   .com4   = PLL_BYPASS | COM4_RESERVED,
> > +   .clkrc  = CLKRC_DIV3 | CLKRC_RESERVED,
> > +   },
> > +   [OV772X_FIN_48MHz] = {
> > +   .com4   = PLL_BYPASS | COM4_RESERVED,
> > +   .clkrc  = CLKRC_DIV6 | CLKRC_RESERVED,
> > +   },
> > +   },
> > +   },
> > +   {   /* PCLK = 12 MHz */
> > +   .fps= 15,
> > +   .pclk = {
> > +   [OV772X_FIN_10MHz]  = {
> > +   .com4   = PLL_4x | COM4_RESERVED,
> > +   .clkrc  = CLKRC_DIV3 | CLKRC_RESERVED,
> > +   },
> > +

Re: [PATCH v2] kdb: use ktime_get_mono_fast_ns() instead of ktime_get_ts()

2018-01-30 Thread Daniel Thompson
On Mon, Jan 29, 2018 at 10:22:51AM +0800, Baolin Wang wrote:
> The kdb code will print the monotonic time by ktime_get_ts(), but
> the ktime_get_ts() will be protected by a sequence lock, that will
> introduce one deadlock risk if the lock was already held in the
> context from which we entered the debugger.
> 
> Thus we can use the ktime_get_mono_fast_ns() to get the monotonic
> time, which is NMI safe access to clock monotonic. Moreover we can
> remove the 'struct timespec', which is not y2038 safe.
> 
> Signed-off-by: Baolin Wang 

Reviewed-by: Daniel Thompson 


> ---
> Changes since v1:
>  - Use ktime_get_mono_fast_ns() instead of ktime_get_seconds().
> ---
>  kernel/debug/kdb/kdb_main.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index 69e70f4..bf1d0e0 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -2486,10 +2486,10 @@ static int kdb_kill(int argc, const char **argv)
>   */
>  static void kdb_sysinfo(struct sysinfo *val)
>  {
> - struct timespec uptime;
> - ktime_get_ts(&uptime);
> + u64 uptime = ktime_get_mono_fast_ns();
> +
>   memset(val, 0, sizeof(*val));
> - val->uptime = uptime.tv_sec;
> + val->uptime = div_u64(uptime, NSEC_PER_SEC);
>   val->loads[0] = avenrun[0];
>   val->loads[1] = avenrun[1];
>   val->loads[2] = avenrun[2];
> -- 
> 1.7.9.5
> 


Re: [netfilter-core] kernel panic: Out of memory and no killable processes... (2)

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 09:11:27, Florian Westphal wrote:
> Michal Hocko  wrote:
> > On Mon 29-01-18 23:35:22, Florian Westphal wrote:
> > > Kirill A. Shutemov  wrote:
> > [...]
> > > > I hate what I'm saying, but I guess we need some tunable here.
> > > > Not sure what exactly.
> > > 
> > > Would memcg help?
> > 
> > That really depends. I would have to check whether vmalloc path obeys
> > __GFP_ACCOUNT (I suspect it does except for page tables allocations but
> > that shouldn't be a big deal). But then the other potential problem is
> > the life time of the xt_table_info (or other potentially large) data
> > structures. Are they bound to any process life time.
> 
> No.
> 
> > Because if they are
> > not then the OOM killer will not help. The OOM panic earlier in this
> > thread suggests it doesn't because the test case managed to eat all the
> > available memory and killed all the eligible tasks which didn't help.
> 
> Yes, which is why we do not want any OOM killer invocation in first
> place...

The problem is that as soon as you eat that memory and ask for more
until you fail with ENOMEM then the OOM is simply unavoidable.
-- 
Michal Hocko
SUSE Labs


Re: Memory hotplug not increasing the total RAM

2018-01-30 Thread Bharata B Rao
On Tue, Jan 30, 2018 at 10:28:15AM +0100, Michal Hocko wrote:
> On Tue 30-01-18 10:16:00, Michal Hocko wrote:
> > On Tue 30-01-18 14:00:06, Bharata B Rao wrote:
> > > Hi,
> > > 
> > > With the latest upstream, I see that memory hotplug is not working
> > > as expected. The hotplugged memory isn't seen to increase the total
> > > RAM pages. This has been observed with both x86 and Power guests.
> > > 
> > > 1. Memory hotplug code intially marks pages as PageReserved via
> > > __add_section().
> > > 2. Later the struct page gets cleared in __init_single_page().
> > > 3. Next online_pages_range() increments totalram_pages only when
> > >PageReserved is set.
> > 
> > You are right. I have completely forgot about this late struct page
> > initialization during onlining. memory hotplug really doesn't want
> > zeroying. Let me think about a fix.
> 
> Could you test with the following please? Not an act of beauty but
> we are initializing memmap in sparse_add_one_section for memory
> hotplug. I hate how this is different from the initialization case
> but there is quite a long route to unify those two... So a quick
> fix should be as follows.

Tested on Power guest, fixes the issue. I can now see the total memory
size increasing after hotplug.

Regards,
Bharata.



Re: [PATCH 8/8] platform: vivid-cec: fix potential integer overflow in vivid_cec_pin_adap_events

2018-01-30 Thread Hans Verkuil
On 01/30/2018 09:51 AM, Gustavo A. R. Silva wrote:
> Hi Hans,
> 
> Quoting Hans Verkuil :
> 
>> Hi Gustavo,
>>
>> On 01/30/2018 01:33 AM, Gustavo A. R. Silva wrote:
>>> Cast len to const u64 in order to avoid a potential integer
>>> overflow. This variable is being used in a context that expects
>>> an expression of type const u64.
>>>
>>> Addresses-Coverity-ID: 1454996 ("Unintentional integer overflow")
>>> Signed-off-by: Gustavo A. R. Silva 
>>> ---
>>>  drivers/media/platform/vivid/vivid-cec.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/media/platform/vivid/vivid-cec.c  
>>> b/drivers/media/platform/vivid/vivid-cec.c
>>> index b55d278..30240ab 100644
>>> --- a/drivers/media/platform/vivid/vivid-cec.c
>>> +++ b/drivers/media/platform/vivid/vivid-cec.c
>>> @@ -83,7 +83,7 @@ static void vivid_cec_pin_adap_events(struct  
>>> cec_adapter *adap, ktime_t ts,
>>> if (adap == NULL)
>>> return;
>>> ts = ktime_sub_us(ts, (CEC_TIM_START_BIT_TOTAL +
>>> -  len * 10 * CEC_TIM_DATA_BIT_TOTAL));
>>> +  (const u64)len * 10 * CEC_TIM_DATA_BIT_TOTAL));
>>
>> This makes no sense. Certainly the const part is pointless. And given that
>> len is always <= 16 there definitely is no overflow.
>>
> 
> Yeah, I understand your point and I know there is no chance of an  
> overflow in this particular case.
> 
>> I don't really want this cast in the code.
>>
>> Sorry,
>>
> 
> I'm working through all the Linux kernel Coverity reports, and I  
> thought of sending a patch for this because IMHO it doesn't hurt to  
> give the compiler complete information about the arithmetic in which  
> an expression is intended to be evaluated.
> 
> I agree that the _const_ part is a bit odd. What do you think about  
> the cast to u64 alone?

What happens if you do: ((u64)CEC_TIM_START_BIT_TOTAL +

I think that forces everything else in the expression to be evaluated
as u64.

It definitely needs a comment that this fixes a bogus Coverity report.

Regards,

Hans

> 
> I appreciate your feedback.
> 
> Thanks
> --
> Gustavo
> 
> 
> 
> 
> 



Re: [PATCH 20/24] objtool: Another static block fail

2018-01-30 Thread Peter Zijlstra
On Mon, Jan 29, 2018 at 04:52:53PM -0600, Josh Poimboeuf wrote:
> On Tue, Jan 23, 2018 at 04:25:59PM +0100, Peter Zijlstra wrote:
> > I've observed GCC generate:
> > 
> >   sym:
> >  NOP/JMP 1f (static_branch)
> >  JMP 2f
> >   1: /* crud */
> >  JMP 3f
> >   2: /* other crud */
> > 
> >   3: RETQ
> > 
> > 
> > This means we need to follow unconditional jumps; be conservative and
> > only follow if its a unique jump.
> > 
> > (I've not yet figured out which CONFIG option is responsible for this,
> >  a normal defconfig build does not generate crap like this)
> > 
> > Signed-off-by: Peter Zijlstra (Intel) 
> 
> Any chance we can just add a compiler barrier to the assertion macro and
> avoid all this grow_static_blocks() mess?  It seems a bit... fragile.

It is all rather unfortunate yes.. :/ I've tried to keep the grow stuff
as conservative as possible while still covering all the weirdness I
found. And while it was great fun, I do agree it would be much better to
not have to do this.


You're thinking of something like this?

 static __always_inline void arch_static_assert(void)
 {
asm volatile ("1:\n\t"
  ".pushsection .discard.jump_assert \n\t"
  _ASM_ALIGN  "\n\t"
  _ASM_PTR "1b \n\t"
- ".popsection \n\t");
+ ".popsection \n\t" ::: "memory");
 }

That doesn't seem to matter much; see here:

static void
ttwu_stat(struct task_struct *p, int cpu, int wake_flags)
{
struct rq *rq;

if (!schedstat_enabled())
return;

rq = this_rq();


$ objdump -dr build/kernel/sched/core.o

1910 :
1910:   e8 00 00 00 00  callq  1915 
1911: R_X86_64_PC32 __fentry__-0x4
1915:   41 57   push   %r15
1917:   41 56   push   %r14
1919:   41 55   push   %r13
191b:   41 54   push   %r12
191d:   55  push   %rbp
191e:   53  push   %rbx
191f:   0f 1f 44 00 00  nopl   0x0(%rax,%rax,1)
1924:   eb 25   jmp194b 
1926:   41 89 d5mov%edx,%r13d
1929:   41 89 f4mov%esi,%r12d
192c:   48 89 fbmov%rdi,%rbx
192f:   49 c7 c6 00 00 00 00mov$0x0,%r14
1932: R_X86_64_32S  runqueues


$ objdump -j __jump_table -sr build/kernel/sched.o

0048 R_X86_64_64   .text+0x191f
0050 R_X86_64_64   .text+0x1926
0058 R_X86_64_64   sched_schedstats


$ objdump -j .discard.jump_assert -dr build/kernel/sched.o

 R_X86_64_64   .text+0x192f


It still lifts random crud over that first initial statement (the rq
load).




Re: [netfilter-core] kernel panic: Out of memory and no killable processes... (2)

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 10:02:34, Dmitry Vyukov wrote:
> On Tue, Jan 30, 2018 at 9:28 AM, Kirill A. Shutemov
>  wrote:
> > On Tue, Jan 30, 2018 at 09:11:27AM +0100, Florian Westphal wrote:
> >> Michal Hocko  wrote:
> >> > On Mon 29-01-18 23:35:22, Florian Westphal wrote:
> >> > > Kirill A. Shutemov  wrote:
> >> > [...]
> >> > > > I hate what I'm saying, but I guess we need some tunable here.
> >> > > > Not sure what exactly.
> >> > >
> >> > > Would memcg help?
> >> >
> >> > That really depends. I would have to check whether vmalloc path obeys
> >> > __GFP_ACCOUNT (I suspect it does except for page tables allocations but
> >> > that shouldn't be a big deal). But then the other potential problem is
> >> > the life time of the xt_table_info (or other potentially large) data
> >> > structures. Are they bound to any process life time.
> >>
> >> No.
> >
> > Well, IIUC they bound to net namespace life time, so killing all
> > proccesses in the namespace would help to get memory back. :)
> 
> ... unless the namespace is mounted into file system.
> 
> Let's start with NOWARN as that's what kernel generally uses for
> allocations with user-controllable size. ENOMEM is roughly as
> informative as the WARNING message in this case.

You want __GFP_NORETRY but that is not _fully_ supported by kvmalloc
right now. More specifically kvmalloc doesn't guanratee that the request
will not trigger the OOM killer (like regular __GFP_NORETRY). This is
because of internal vmalloc restrictions. If you are however OK to
simply bail out in most cases then __GFP_NORETRY should work reasonably
fine.

> I think we also need to consider setting up memory cgroup for
> syzkaller test processes (we do RLIMIT_AS, but that's weak).

Well, this is not about syzkaller, it merely pointed out a potential
DoS... And that has to be addressed somehow.

-- 
Michal Hocko
SUSE Labs


Re: [PATCH 4/4] objtool: Don't print '.tmp_' prefix for .o files

2018-01-30 Thread Peter Zijlstra
On Mon, Jan 29, 2018 at 10:00:42PM -0600, Josh Poimboeuf wrote:
> With the following commit:
> 
>   2a0098d70640 ("objtool: Fix seg fault with gold linker")
> 
> ... objtool warnings started showing the modversions '.tmp_' prefix in
> the .o file name, like:
> 
>   arch/x86/mm/.tmp_mem_encrypt_boot.o: warning: objtool: 
> sme_encrypt_execute()+0x48: indirect call found in RETPOLINE build
> 
> The prefix is confusing.  Remove it from the printed 'objname' variable.

This patch actually tripped me up today. Turns out I have both:

 build/kernel/sched/core.o
 build/kernel/sched/.tmp_core.o

and ended up staring at the wrong file and going WTF because the offsets
didn't match.

I much prefer the actual real filename printed. Yes the .tmp_ crud is
weird, but at least its the real file.


[PATCH v8 04/11] ARM: dts: r7s72100: Add Capture Engine Unit (CEU)

2018-01-30 Thread Jacopo Mondi
Add Capture Engine Unit (CEU) node to device tree.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Geert Uytterhoeven 
Reviewed-by: Laurent Pinchart 
Acked-by: Hans Verkuil 
---
 arch/arm/boot/dts/r7s72100.dtsi | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
index ab9645a..5fe62f9 100644
--- a/arch/arm/boot/dts/r7s72100.dtsi
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -135,9 +135,9 @@
#clock-cells = <1>;
compatible = "renesas,r7s72100-mstp-clocks", 
"renesas,cpg-mstp-clocks";
reg = <0xfcfe042c 4>;
-   clocks = <&p0_clk>;
-   clock-indices = ;
-   clock-output-names = "rtc";
+   clocks = <&b_clk>, <&p0_clk>;
+   clock-indices = ;
+   clock-output-names = "ceu", "rtc";
};
 
mstp7_clks: mstp7_clks@fcfe0430 {
@@ -667,4 +667,13 @@
power-domains = <&cpg_clocks>;
status = "disabled";
};
+
+   ceu: ceu@e821 {
+   reg = <0xe821 0x3000>;
+   compatible = "renesas,r7s72100-ceu";
+   interrupts = ;
+   clocks = <&mstp6_clks R7S72100_CLK_CEU>;
+   power-domains = <&cpg_clocks>;
+   status = "disabled";
+   };
 };
-- 
2.7.4



[PATCH v8 00/11] Renesas Capture Engine Unit (CEU) V4L2 driver

2018-01-30 Thread Jacopo Mondi
Hello,
   this 8th round has two minor modifications compared to v7:

- Fixed Geert's comments on RZ/A1-H/L/M in bindings documentation
- Calculate the PLL divisor/multiplier to generate the proper pixel clock
  for ov772x in place of using static tables.

Series based on top of Hans':
[PATCHv2 0/9] media: replace g/s_parm by g/s_frame_interval
and makes use of newly introduced v4l2_g/s_parm_cap() functions from v4l2-common
in CEU's g/s_parm() callbacks.

A branch for testing is available at:
git://jmondi.org/linux ceu/media-tree-parm/base
with few patches for Migo-R and GR-Peach applied on top of Hans' media-tree/parm
branch.

Copying from v7 cover letter:

The 2 new patches in the series:
[11/11] has been added to silence a v4l2-compliance error, and modifies
ov7670 driver to set all fields of 'struct v4l2_mbus_format' during set_format
operation, including ycbcr_enc, quantization and xfer_func. As the patch commit
reports, this suppresses the following v4l2-compliance error:
fail: v4l2-test-formats.cpp(335): ycbcr_enc >= 0xff
v8: Did the same for ov772x

[7/11] has been required by Hans to add frame interval handling to ov772x
driver. As this is quite a big change I kept it in a separate patch to ease
review, it can eventually be squashed on [6/11] if accepted.
v8: Calculate PLL divider/multiplier in place of using static tables.

If for TW9910 video decoder the same is required (frame interval handling) I'm
in favour of moving that driver to staging as it was proposed for ov772x before
this series.

v4l2-compliance now reports a 0 error count:
Total: 43, Succeeded: 43, Failed: 0, Warnings: 0

Hans, you asked me to run v4l2-compliance with the -f option, I cannot do
that on my tiny GR-Peach as with its limited available system memory it cannot
allocate the number of requested buffers for that test. I can try to tweak that
if necessary. I won't stress here why I cannot do that on Migo-R, long story
short, I need a special compiler with DSP support to run anything but the little
initramfs I have received for SH7722. I've been able to tweak yavta to work and
test capture and frame rate handling with it, but v4l2-compliance is much more
complex and I don't think I'll be able run it on that platform.

Below, v4l2-compliance output:

---
v4l2-compliance SHA   : 20b6624f4bb84353e690d897688fd7ac12d6a881

Driver Info:
Driver name   : renesas-ceu
Card type : Renesas CEU e821.ceu
Bus info  : platform:renesas-ceu-e821.c
Driver version: 4.15.0
Capabilities  : 0x84201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps   : 0x04201000
Video Capture Multiplanar
Streaming
Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 12 Private Controls: 0

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
fail: v4l2-test-formats.cpp(1162): ret && node->has_frmintervals
test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK

[PATCH v8 02/11] include: media: Add Renesas CEU driver interface

2018-01-30 Thread Jacopo Mondi
Add renesas-ceu header file.

Do not remove the existing sh_mobile_ceu.h one as long as the original
driver does not go away.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Laurent Pinchart 
Acked-by: Hans Verkuil 
---
 include/media/drv-intf/renesas-ceu.h | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 include/media/drv-intf/renesas-ceu.h

diff --git a/include/media/drv-intf/renesas-ceu.h 
b/include/media/drv-intf/renesas-ceu.h
new file mode 100644
index 000..52841d1
--- /dev/null
+++ b/include/media/drv-intf/renesas-ceu.h
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * renesas-ceu.h - Renesas CEU driver interface
+ *
+ * Copyright 2017-2018 Jacopo Mondi 
+ */
+
+#ifndef __MEDIA_DRV_INTF_RENESAS_CEU_H__
+#define __MEDIA_DRV_INTF_RENESAS_CEU_H__
+
+#define CEU_MAX_SUBDEVS2
+
+struct ceu_async_subdev {
+   unsigned long flags;
+   unsigned char bus_width;
+   unsigned char bus_shift;
+   unsigned int i2c_adapter_id;
+   unsigned int i2c_address;
+};
+
+struct ceu_platform_data {
+   unsigned int num_subdevs;
+   struct ceu_async_subdev subdevs[CEU_MAX_SUBDEVS];
+};
+
+#endif /* ___MEDIA_DRV_INTF_RENESAS_CEU_H__ */
-- 
2.7.4



[PATCH v8 05/11] media: i2c: Copy ov772x soc_camera sensor driver

2018-01-30 Thread Jacopo Mondi
Copy the soc_camera based driver in v4l2 sensor driver directory.
This commit just copies the original file without modifying it.
No modification to KConfig and Makefile as soc_camera framework
dependencies need to be removed first in next commit.

Signed-off-by: Jacopo Mondi 
Acked-by: Laurent Pinchart 
Acked-by: Hans Verkuil 
---
 drivers/media/i2c/ov772x.c | 1124 
 1 file changed, 1124 insertions(+)
 create mode 100644 drivers/media/i2c/ov772x.c

diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
new file mode 100644
index 000..8063835
--- /dev/null
+++ b/drivers/media/i2c/ov772x.c
@@ -0,0 +1,1124 @@
+/*
+ * ov772x Camera Driver
+ *
+ * Copyright (C) 2008 Renesas Solutions Corp.
+ * Kuninori Morimoto 
+ *
+ * Based on ov7670 and soc_camera_platform driver,
+ *
+ * Copyright 2006-7 Jonathan Corbet 
+ * Copyright (C) 2008 Magnus Damm
+ * Copyright (C) 2008, Guennadi Liakhovetski 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * register offset
+ */
+#define GAIN0x00 /* AGC - Gain control gain setting */
+#define BLUE0x01 /* AWB - Blue channel gain setting */
+#define RED 0x02 /* AWB - Red   channel gain setting */
+#define GREEN   0x03 /* AWB - Green channel gain setting */
+#define COM10x04 /* Common control 1 */
+#define BAVG0x05 /* U/B Average Level */
+#define GAVG0x06 /* Y/Gb Average Level */
+#define RAVG0x07 /* V/R Average Level */
+#define AECH0x08 /* Exposure Value - AEC MSBs */
+#define COM20x09 /* Common control 2 */
+#define PID 0x0A /* Product ID Number MSB */
+#define VER 0x0B /* Product ID Number LSB */
+#define COM30x0C /* Common control 3 */
+#define COM40x0D /* Common control 4 */
+#define COM50x0E /* Common control 5 */
+#define COM60x0F /* Common control 6 */
+#define AEC 0x10 /* Exposure Value */
+#define CLKRC   0x11 /* Internal clock */
+#define COM70x12 /* Common control 7 */
+#define COM80x13 /* Common control 8 */
+#define COM90x14 /* Common control 9 */
+#define COM10   0x15 /* Common control 10 */
+#define REG16   0x16 /* Register 16 */
+#define HSTART  0x17 /* Horizontal sensor size */
+#define HSIZE   0x18 /* Horizontal frame (HREF column) end high 8-bit */
+#define VSTART  0x19 /* Vertical frame (row) start high 8-bit */
+#define VSIZE   0x1A /* Vertical sensor size */
+#define PSHFT   0x1B /* Data format - pixel delay select */
+#define MIDH0x1C /* Manufacturer ID byte - high */
+#define MIDL0x1D /* Manufacturer ID byte - low  */
+#define LAEC0x1F /* Fine AEC value */
+#define COM11   0x20 /* Common control 11 */
+#define BDBASE  0x22 /* Banding filter Minimum AEC value */
+#define DBSTEP  0x23 /* Banding filter Maximum Setp */
+#define AEW 0x24 /* AGC/AEC - Stable operating region (upper limit) */
+#define AEB 0x25 /* AGC/AEC - Stable operating region (lower limit) */
+#define VPT 0x26 /* AGC/AEC Fast mode operating region */
+#define REG28   0x28 /* Register 28 */
+#define HOUTSIZE0x29 /* Horizontal data output size MSBs */
+#define EXHCH   0x2A /* Dummy pixel insert MSB */
+#define EXHCL   0x2B /* Dummy pixel insert LSB */
+#define VOUTSIZE0x2C /* Vertical data output size MSBs */
+#define ADVFL   0x2D /* LSB of insert dummy lines in Vertical direction */
+#define ADVFH   0x2E /* MSG of insert dummy lines in Vertical direction */
+#define YAVE0x2F /* Y/G Channel Average value */
+#define LUMHTH  0x30 /* Histogram AEC/AGC Luminance high level threshold */
+#define LUMLTH  0x31 /* Histogram AEC/AGC Luminance low  level threshold */
+#define HREF0x32 /* Image start and size control */
+#define DM_LNL  0x33 /* Dummy line low  8 bits */
+#define DM_LNH  0x34 /* Dummy line high 8 bits */
+#define ADOFF_B 0x35 /* AD offset compensation value for B  channel */
+#define ADOFF_R 0x36 /* AD offset compensation value for R  channel */
+#define ADOFF_GB0x37 /* AD offset compensation value for Gb channel */
+#define ADOFF_GR0x38 /* AD offset compensation value for Gr channel */
+#define OFF_B   0x39 /* Analog process B  channel offset value */
+#define OFF_R   0x3A /* Analog process R  channel offset value */
+#define OFF_GB  0x3B /* Analog process Gb channel offset value */
+#define OFF_GR  0x3C /* Analog process Gr channel offset value */
+#define COM12   0x3D /* Common control 12 */
+#define COM13   0x3E /* Common control 13 */
+#define COM14   0x3F /* Common 

[PATCH v8 07/11] media: i2c: ov772x: Support frame interval handling

2018-01-30 Thread Jacopo Mondi
Add support to ov772x driver for frame intervals handling and enumeration.
Tested with 10MHz and 24MHz input clock at VGA and QVGA resolutions for
10, 15 and 30 frame per second rates.

Signed-off-by: Jacopo Mondi 
---
 drivers/media/i2c/ov772x.c | 210 +
 1 file changed, 193 insertions(+), 17 deletions(-)

diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index 23106d7..28de254 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -250,6 +250,7 @@
 #define AEC_1p2 0x10   /*  01: 1/2  window */
 #define AEC_1p4 0x20   /*  10: 1/4  window */
 #define AEC_2p3 0x30   /*  11: Low 2/3 window */
+#define COM4_RESERVED   0x01   /* Reserved bit */
 
 /* COM5 */
 #define AFR_ON_OFF  0x80   /* Auto frame rate control ON/OFF selection */
@@ -267,6 +268,10 @@
/* AEC max step control */
 #define AEC_NO_LIMIT0x01   /*   0 : AEC incease step has limit */
/*   1 : No limit to AEC increase step */
+/* CLKRC */
+   /* Input clock divider register */
+#define CLKRC_RESERVED  0x80   /* Reserved bit */
+#define CLKRC_DIV(n)((n) - 1)
 
 /* COM7 */
/* SCCB Register Reset */
@@ -373,6 +378,19 @@
 #define VERSION(pid, ver) ((pid<<8)|(ver&0xFF))
 
 /*
+ * Frame size (including blanking lines)
+ */
+#define VGA_FRAME_SIZE (510 * 748)
+#define QVGA_FRAME_SIZE(278 * 576)
+
+/*
+ * Input clock frequencies
+ */
+static const u8 ov772x_com4_vals[] = { PLL_BYPASS, PLL_4x, PLL_6x, PLL_8x };
+static const unsigned int ov772x_pll_mult[] = { 1, 4, 6, 8 };
+#define OV772X_PLL_N_MULT ARRAY_SIZE(ov772x_pll_mult)
+
+/*
  * struct
  */
 
@@ -388,6 +406,7 @@ struct ov772x_color_format {
 struct ov772x_win_size {
char *name;
unsigned char com7_bit;
+   unsigned int  sizeimage;
struct v4l2_rect  rect;
 };
 
@@ -404,6 +423,7 @@ struct ov772x_priv {
unsigned shortflag_hflip:1;
/* band_filter = COM8[5] ? 256 - BDBASE : 0 */
unsigned shortband_filter;
+   unsigned int  fps;
 };
 
 /*
@@ -487,27 +507,35 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
 
 static const struct ov772x_win_size ov772x_win_sizes[] = {
{
-   .name = "VGA",
-   .com7_bit = SLCT_VGA,
+   .name   = "VGA",
+   .com7_bit   = SLCT_VGA,
+   .sizeimage  = 381480,
.rect = {
-   .left = 140,
-   .top = 14,
-   .width = VGA_WIDTH,
-   .height = VGA_HEIGHT,
+   .left   = 140,
+   .top= 14,
+   .width  = VGA_WIDTH,
+   .height = VGA_HEIGHT,
},
}, {
-   .name = "QVGA",
-   .com7_bit = SLCT_QVGA,
+   .name   = "QVGA",
+   .com7_bit   = SLCT_QVGA,
+   .sizeimage  = 160128,
.rect = {
-   .left = 252,
-   .top = 6,
-   .width = QVGA_WIDTH,
-   .height = QVGA_HEIGHT,
+   .left   = 252,
+   .top= 6,
+   .width  = QVGA_WIDTH,
+   .height = QVGA_HEIGHT,
},
},
 };
 
 /*
+ * frame rate settings lists
+ */
+unsigned int ov772x_frame_intervals[] = { 5, 10, 15, 20, 30, 60 };
+#define OV772X_N_FRAME_INTERVALS ARRAY_SIZE(ov772x_frame_intervals)
+
+/*
  * general function
  */
 
@@ -574,6 +602,124 @@ static int ov772x_s_stream(struct v4l2_subdev *sd, int 
enable)
return 0;
 }
 
+static int ov772x_set_frame_rate(struct ov772x_priv *priv,
+struct v4l2_fract *tpf,
+const struct ov772x_color_format *cfmt,
+const struct ov772x_win_size *win)
+{
+   struct i2c_client *client = v4l2_get_subdevdata(&priv->subdev);
+   unsigned int fps = tpf->denominator / tpf->numerator;
+   unsigned int fin = clk_get_rate(priv->clk);
+   unsigned int rate_prev;
+   unsigned int fsize;
+   unsigned int pclk;
+   unsigned int rate;
+   unsigned int idx;
+   unsigned int i;
+   u8 clkrc = 0;
+   u8 com4 = 0;
+   int ret;
+
+   /* Approximate to the closest supported frame interval. */
+   rate_prev = ~0L;
+   for (i = 0, idx = 0; i < OV772X_N_FRAME_INTERVALS; i++) {
+   rate = abs(fps - ov772x_frame_intervals[i]);
+   if (rate < rate_prev) {
+   idx = i;
+   rate_prev = rate;
+   }
+   }
+ 

[PATCH v8 09/11] media: i2c: tw9910: Remove soc_camera dependencies

2018-01-30 Thread Jacopo Mondi
Remove soc_camera framework dependencies from tw9910 sensor driver.
- Handle clock and gpios
- Register async subdevice
- Remove soc_camera specific g/s_mbus_config operations
- Add kernel doc to driver interface header file
- Adjust build system

This commit does not remove the original soc_camera based driver as long
as other platforms depends on soc_camera-based CEU driver.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Laurent Pinchart 
Acked-by: Hans Verkuil 
---
 drivers/media/i2c/Kconfig  |   9 +++
 drivers/media/i2c/Makefile |   1 +
 drivers/media/i2c/tw9910.c | 162 -
 include/media/i2c/tw9910.h |   9 +++
 4 files changed, 120 insertions(+), 61 deletions(-)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index e71e968..0460613 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -423,6 +423,15 @@ config VIDEO_TW9906
  To compile this driver as a module, choose M here: the
  module will be called tw9906.
 
+config VIDEO_TW9910
+   tristate "Techwell TW9910 video decoder"
+   depends on VIDEO_V4L2 && I2C
+   ---help---
+ Support for Techwell TW9910 NTSC/PAL/SECAM video decoder.
+
+ To compile this driver as a module, choose M here: the
+ module will be called tw9910.
+
 config VIDEO_VPX3220
tristate "vpx3220a, vpx3216b & vpx3214c video decoders"
depends on VIDEO_V4L2 && I2C
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index b0489a1..23c3ac6 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -48,6 +48,7 @@ obj-$(CONFIG_VIDEO_TVP7002) += tvp7002.o
 obj-$(CONFIG_VIDEO_TW2804) += tw2804.o
 obj-$(CONFIG_VIDEO_TW9903) += tw9903.o
 obj-$(CONFIG_VIDEO_TW9906) += tw9906.o
+obj-$(CONFIG_VIDEO_TW9910) += tw9910.o
 obj-$(CONFIG_VIDEO_CS3308) += cs3308.o
 obj-$(CONFIG_VIDEO_CS5345) += cs5345.o
 obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
index bdb5e0a..96792df 100644
--- a/drivers/media/i2c/tw9910.c
+++ b/drivers/media/i2c/tw9910.c
@@ -1,6 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * tw9910 Video Driver
  *
+ * Copyright (C) 2017 Jacopo Mondi 
+ *
  * Copyright (C) 2008 Renesas Solutions Corp.
  * Kuninori Morimoto 
  *
@@ -10,12 +13,10 @@
  * Copyright 2006-7 Jonathan Corbet 
  * Copyright (C) 2008 Magnus Damm
  * Copyright (C) 2008, Guennadi Liakhovetski 
- *
- * 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.
  */
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -25,9 +26,7 @@
 #include 
 #include 
 
-#include 
 #include 
-#include 
 #include 
 
 #define GET_ID(val)  ((val & 0xF8) >> 3)
@@ -228,8 +227,10 @@ struct tw9910_scale_ctrl {
 
 struct tw9910_priv {
struct v4l2_subdev  subdev;
-   struct v4l2_clk *clk;
+   struct clk  *clk;
struct tw9910_video_info*info;
+   struct gpio_desc*pdn_gpio;
+   struct gpio_desc*rstb_gpio;
const struct tw9910_scale_ctrl  *scale;
v4l2_std_id norm;
u32 revision;
@@ -582,13 +583,66 @@ static int tw9910_s_register(struct v4l2_subdev *sd,
 }
 #endif
 
+static int tw9910_power_on(struct tw9910_priv *priv)
+{
+   struct i2c_client *client = v4l2_get_subdevdata(&priv->subdev);
+   int ret;
+
+   if (priv->clk) {
+   ret = clk_prepare_enable(priv->clk);
+   if (ret)
+   return ret;
+   }
+
+   if (priv->pdn_gpio) {
+   gpiod_set_value(priv->pdn_gpio, 0);
+   usleep_range(500, 1000);
+   }
+
+   /*
+* FIXME: The reset signal is connected to a shared GPIO on some
+* platforms (namely the SuperH Migo-R). Until a framework becomes
+* available to handle this cleanly, request the GPIO temporarily
+* to avoid conflicts.
+*/
+   priv->rstb_gpio = gpiod_get_optional(&client->dev, "rstb",
+GPIOD_OUT_LOW);
+   if (IS_ERR(priv->rstb_gpio)) {
+   dev_info(&client->dev, "Unable to get GPIO \"rstb\"");
+   return PTR_ERR(priv->rstb_gpio);
+   }
+
+   if (priv->rstb_gpio) {
+   gpiod_set_value(priv->rstb_gpio, 1);
+   usleep_range(500, 1000);
+   gpiod_set_value(priv->rstb_gpio, 0);
+   usleep_range(500, 1000);
+
+   gpiod_put(priv->rstb_gpio);
+   }
+
+   return 0;
+}
+
+static int tw9910_power_off(struct tw9910_priv *priv)
+{
+   clk_disable_unprepare(priv->clk);
+
+   if (priv->pdn_gpio) {
+   gpiod_set_value(priv->pdn_gpio, 1);
+   usleep_range(500, 1000);
+   }
+
+   re

Re: Re: [PATCH 1/2] dmaengine: dmatest: change symbolic permissions to octal values

2018-01-30 Thread Vinod Koul
On Mon, Jan 29, 2018 at 06:26:40AM +, Yang, Shunyong wrote:
> Hi, Vinod
> 
> On Mon, 2018-01-29 at 10:18 +0530, Vinod Koul wrote:
> > On Mon, Jan 22, 2018 at 06:44:40PM +0800, Yang Shunyong wrote:
> > > 
> > > Current coding style prefers octal permissions values. This patch
> > > changes symbolic permissions to octal values.
> > Is this preference documented anywhere?
> > 
> 
> When using symbolic permissions like "S_IRUGO | S_IWUSR". The
> checkpatch.pl will output some warnings to suggest to use octal values.
> I quote following lines from checkpatch.pl,
> 
> # check for uses of S_ that could be octal for readability
> ...
> if (WARN("SYMBOLIC_PERMS",
>  "Symbolic permissions '$oval' are not
> preferred. Consider using octal permissions '$octal'.\n" . $herecurr)
> &&

It is a warning and a preference. And I don't prefer changing code for no
benefit. Sorry but I am not considering this change

-- 
~Vinod


Re: [PATCH] sound/tlv320dac33: Add device tree support

2018-01-30 Thread Pavel Machek
On Tue 2018-01-30 10:38:38, Ladislav Michl wrote:
> On Tue, Jan 30, 2018 at 10:11:02AM +0100, Filip Matijević wrote:
> > Hi,
> > 

> > > Well, notice I'm converting existing driver to device tree. And that
> > > one already has GPIO dependency. It is possible that more work needs
> > > to be done there, but that should not be a reason to delay this. Feel
> > > free to help.
> 
> Adding DT properties that need to be maintained for compatibility reasons
> is a bad idea and very good reason to delay merging unfinished stuff.
> And meanwhile it turned out it is not power-gpio :)

I believe reset-gpios and power-gpios are commonly used like
this... and that's what the old code does.

You are not helping.

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


[PATCH v8 10/11] arch: sh: migor: Use new renesas-ceu camera driver

2018-01-30 Thread Jacopo Mondi
Migo-R platform uses sh_mobile_ceu camera driver, which is now being
replaced by a proper V4L2 camera driver named 'renesas-ceu'.

Move Migo-R platform to use the v4l2 renesas-ceu camera driver
interface and get rid of soc_camera defined components used to register
sensor drivers and of platform specific enable/disable routines.

Register clock source and GPIOs for sensor drivers, so they can use
clock and gpio APIs.

Also, memory for CEU video buffers is now reserved with membocks APIs,
and need to be declared as dma_coherent during machine initialization to
remove that architecture specific part from CEU driver.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Laurent Pinchart 
Acked-by: Hans Verkuil 
---
 arch/sh/boards/mach-migor/setup.c  | 225 +++--
 arch/sh/kernel/cpu/sh4a/clock-sh7722.c |   2 +-
 2 files changed, 101 insertions(+), 126 deletions(-)

diff --git a/arch/sh/boards/mach-migor/setup.c 
b/arch/sh/boards/mach-migor/setup.c
index 0bcbe58..271dfc2 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -1,17 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Renesas System Solutions Asia Pte. Ltd - Migo-R
  *
  * Copyright (C) 2008 Magnus Damm
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
  */
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -23,10 +22,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -45,6 +45,9 @@
  * 0x1800   8GB8   NAND Flash (K9K8G08U0A)
  */
 
+#define CEU_BUFFER_MEMORY_SIZE (4 << 20)
+static phys_addr_t ceu_dma_membase;
+
 static struct smc91x_platdata smc91x_info = {
.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
 };
@@ -301,65 +304,24 @@ static struct platform_device migor_lcdc_device = {
},
 };
 
-static struct clk *camera_clk;
-static DEFINE_MUTEX(camera_lock);
-
-static void camera_power_on(int is_tw)
-{
-   mutex_lock(&camera_lock);
-
-   /* Use 10 MHz VIO_CKO instead of 24 MHz to work
-* around signal quality issues on Panel Board V2.1.
-*/
-   camera_clk = clk_get(NULL, "video_clk");
-   clk_set_rate(camera_clk, 1000);
-   clk_enable(camera_clk); /* start VIO_CKO */
-
-   /* use VIO_RST to take camera out of reset */
-   mdelay(10);
-   if (is_tw) {
-   gpio_set_value(GPIO_PTT2, 0);
-   gpio_set_value(GPIO_PTT0, 0);
-   } else {
-   gpio_set_value(GPIO_PTT0, 1);
-   }
-   gpio_set_value(GPIO_PTT3, 0);
-   mdelay(10);
-   gpio_set_value(GPIO_PTT3, 1);
-   mdelay(10); /* wait to let chip come out of reset */
-}
-
-static void camera_power_off(void)
-{
-   clk_disable(camera_clk); /* stop VIO_CKO */
-   clk_put(camera_clk);
-
-   gpio_set_value(GPIO_PTT3, 0);
-   mutex_unlock(&camera_lock);
-}
-
-static int ov7725_power(struct device *dev, int mode)
-{
-   if (mode)
-   camera_power_on(0);
-   else
-   camera_power_off();
-
-   return 0;
-}
-
-static int tw9910_power(struct device *dev, int mode)
-{
-   if (mode)
-   camera_power_on(1);
-   else
-   camera_power_off();
-
-   return 0;
-}
-
-static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
-   .flags = SH_CEU_FLAG_USE_8BIT_BUS,
+static struct ceu_platform_data ceu_pdata = {
+   .num_subdevs= 2,
+   .subdevs = {
+   { /* [0] = ov772x */
+   .flags  = 0,
+   .bus_width  = 8,
+   .bus_shift  = 0,
+   .i2c_adapter_id = 0,
+   .i2c_address= 0x21,
+   },
+   { /* [1] = tw9910 */
+   .flags  = 0,
+   .bus_width  = 8,
+   .bus_shift  = 0,
+   .i2c_adapter_id = 0,
+   .i2c_address= 0x45,
+   },
+   },
 };
 
 static struct resource migor_ceu_resources[] = {
@@ -373,18 +335,32 @@ static struct resource migor_ceu_resources[] = {
.start  = evt2irq(0x880),
.flags  = IORESOURCE_IRQ,
},
-   [2] = {
-   /* place holder for contiguous memory */
-   },
 };
 
 static struct platform_device migor_ceu_device = {
-   .name   = "sh_mobile_ceu",
-   .id = 0, /* "ceu0" clock */
+   .name   = "renesas-ceu",
+   .id = 0, /* ceu.0 */
.num_resources  = ARRAY_SIZE(migor_ceu_resources),
.resource   = migor_ceu_resources,
.dev= {
-   .platform_data  = &sh_mobile_ceu_info,
+   .plat

[PATCH v8 11/11] media: i2c: ov7670: Fully set mbus frame fmt

2018-01-30 Thread Jacopo Mondi
The sensor driver sets mbus format colorspace information and sizes,
but not ycbcr encoding, quantization and xfer function. When supplied
with an badly initialized mbus frame format structure, those fields
need to be set explicitly not to leave them uninitialized. This is
tested by v4l2-compliance, which supplies a mbus format description
structure and checks for all fields to be properly set.

Without this commit, v4l2-compliance fails when testing formats with:
fail: v4l2-test-formats.cpp(335): ycbcr_enc >= 0xff

Signed-off-by: Jacopo Mondi 
---
 drivers/media/i2c/ov7670.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index 25b26d4..61c472e 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -996,6 +996,10 @@ static int ov7670_try_fmt_internal(struct v4l2_subdev *sd,
fmt->height = wsize->height;
fmt->colorspace = ov7670_formats[index].colorspace;
 
+   fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
+   fmt->quantization = V4L2_QUANTIZATION_DEFAULT;
+   fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT;
+
info->format = *fmt;
 
return 0;
-- 
2.7.4



[PATCH v8 08/11] media: i2c: Copy tw9910 soc_camera sensor driver

2018-01-30 Thread Jacopo Mondi
Copy the soc_camera based driver in v4l2 sensor driver directory.
This commit just copies the original file without modifying it.
No modification to KConfig and Makefile as soc_camera framework
dependencies need to be removed first in next commit.

Signed-off-by: Jacopo Mondi 
Acked-by: Laurent Pinchart 
Acked-by: Hans Verkuil 
---
 drivers/media/i2c/tw9910.c | 999 +
 1 file changed, 999 insertions(+)
 create mode 100644 drivers/media/i2c/tw9910.c

diff --git a/drivers/media/i2c/tw9910.c b/drivers/media/i2c/tw9910.c
new file mode 100644
index 000..bdb5e0a
--- /dev/null
+++ b/drivers/media/i2c/tw9910.c
@@ -0,0 +1,999 @@
+/*
+ * tw9910 Video Driver
+ *
+ * Copyright (C) 2008 Renesas Solutions Corp.
+ * Kuninori Morimoto 
+ *
+ * Based on ov772x driver,
+ *
+ * Copyright (C) 2008 Kuninori Morimoto 
+ * Copyright 2006-7 Jonathan Corbet 
+ * Copyright (C) 2008 Magnus Damm
+ * Copyright (C) 2008, Guennadi Liakhovetski 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#define GET_ID(val)  ((val & 0xF8) >> 3)
+#define GET_REV(val) (val & 0x07)
+
+/*
+ * register offset
+ */
+#define ID 0x00 /* Product ID Code Register */
+#define STATUS10x01 /* Chip Status Register I */
+#define INFORM 0x02 /* Input Format */
+#define OPFORM 0x03 /* Output Format Control Register */
+#define DLYCTR 0x04 /* Hysteresis and HSYNC Delay Control */
+#define OUTCTR10x05 /* Output Control I */
+#define ACNTL1 0x06 /* Analog Control Register 1 */
+#define CROP_HI0x07 /* Cropping Register, High */
+#define VDELAY_LO  0x08 /* Vertical Delay Register, Low */
+#define VACTIVE_LO 0x09 /* Vertical Active Register, Low */
+#define HDELAY_LO  0x0A /* Horizontal Delay Register, Low */
+#define HACTIVE_LO 0x0B /* Horizontal Active Register, Low */
+#define CNTRL1 0x0C /* Control Register I */
+#define VSCALE_LO  0x0D /* Vertical Scaling Register, Low */
+#define SCALE_HI   0x0E /* Scaling Register, High */
+#define HSCALE_LO  0x0F /* Horizontal Scaling Register, Low */
+#define BRIGHT 0x10 /* BRIGHTNESS Control Register */
+#define CONTRAST   0x11 /* CONTRAST Control Register */
+#define SHARPNESS  0x12 /* SHARPNESS Control Register I */
+#define SAT_U  0x13 /* Chroma (U) Gain Register */
+#define SAT_V  0x14 /* Chroma (V) Gain Register */
+#define HUE0x15 /* Hue Control Register */
+#define CORING10x17
+#define CORING20x18 /* Coring and IF compensation */
+#define VBICNTL0x19 /* VBI Control Register */
+#define ACNTL2 0x1A /* Analog Control 2 */
+#define OUTCTR20x1B /* Output Control 2 */
+#define SDT0x1C /* Standard Selection */
+#define SDTR   0x1D /* Standard Recognition */
+#define TEST   0x1F /* Test Control Register */
+#define CLMPG  0x20 /* Clamping Gain */
+#define IAGC   0x21 /* Individual AGC Gain */
+#define AGCGAIN0x22 /* AGC Gain */
+#define PEAKWT 0x23 /* White Peak Threshold */
+#define CLMPL  0x24 /* Clamp level */
+#define SYNCT  0x25 /* Sync Amplitude */
+#define MISSCNT0x26 /* Sync Miss Count Register */
+#define PCLAMP 0x27 /* Clamp Position Register */
+#define VCNTL1 0x28 /* Vertical Control I */
+#define VCNTL2 0x29 /* Vertical Control II */
+#define CKILL  0x2A /* Color Killer Level Control */
+#define COMB   0x2B /* Comb Filter Control */
+#define LDLY   0x2C /* Luma Delay and H Filter Control */
+#define MISC1  0x2D /* Miscellaneous Control I */
+#define LOOP   0x2E /* LOOP Control Register */
+#define MISC2  0x2F /* Miscellaneous Control II */
+#define MVSN   0x30 /* Macrovision Detection */
+#define STATUS20x31 /* Chip STATUS II */
+#define HFREF  0x32 /* H monitor */
+#define CLMD   0x33 /* CLAMP MODE */
+#define IDCNTL 0x34 /* ID Detection Control */
+#define CLCNTL10x35 /* Clamp Control I */
+#define ANAPLLCTL  0x4C
+#define VBIMIN 0x4D
+#define HSLOWCTL   0x4E
+#define WSS3   0x4F
+#define FILLDATA   0x50
+#define SDID   0x51
+#define DID0x52
+#define WSS1   0x53
+#define WSS2   0x54
+#define VVBI   0x55
+#define LCTL6  0x56
+#define LCTL7  0x57
+#define LCTL8  0x58
+#define LCTL9  0x59
+#define LCTL10 0x5A
+#define LCTL11 0x5B
+#define LCTL12 0x5C
+#define LCTL13 0x5D
+#define LC

Re: [PATCH v6 07/36] nds32: Exception handling

2018-01-30 Thread Vincent Chen
2018-01-24 19:10 GMT+08:00 Arnd Bergmann :
> On Wed, Jan 24, 2018 at 12:09 PM, Arnd Bergmann  wrote:
>> On Wed, Jan 24, 2018 at 11:53 AM, Vincent Chen  wrote:
>>> 2018-01-18 18:14 GMT+08:00 Arnd Bergmann :
>
>> Ok. I still wonder about the kernel part of this though: is it a good idea
>> for user space to configure whether the kernel does unaligned
>> accesses? I would think that the kernel should just be fixed in such
>> a case.
>
> To clarify: I'm asking only about unaligned accesses from kernel code itself,
> which is generally considered a bug when
> CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is disabled.
>
>   Arnd

Thanks for your comments.

For performance, we decide always disable
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS even if hardware supports
unaligned accessing. Therefore, I will remove kernel unaligned accessing from
nds32/mm/alignment.c. In other words, alignment.c only addresses unaligned
accessing for user space.

Vincent


Re: [PATCH v6 2/2] media: V3s: Add support for Allwinner CSI.

2018-01-30 Thread Thierry Reding
On Tue, Jan 30, 2018 at 10:59:16AM +0100, Thierry Reding wrote:
> On Tue, Jan 30, 2018 at 10:24:48AM +0100, Arnd Bergmann wrote:
> > On Tue, Jan 30, 2018 at 8:54 AM, Maxime Ripard
> >  wrote:
> > > On Mon, Jan 29, 2018 at 03:34:02PM +0100, Arnd Bergmann wrote:
> > >> On Mon, Jan 29, 2018 at 10:25 AM, Linus Walleij
> > >>  wrote:
> > >> > On Mon, Jan 29, 2018 at 9:25 AM, Maxime Ripard
> > >> >  wrote:
> > >> >> On Sat, Jan 27, 2018 at 05:14:26PM +0100, Linus Walleij wrote:
> > 
> > >>
> > >> At one point we had discussed adding a 'dma-masters' property that
> > >> lists all the buses on which a device can be a dma master, and
> > >> the respective properties of those masters (iommu, coherency,
> > >> offset, ...).
> > >>
> > >> IIRC at the time we decided that we could live without that complexity,
> > >> but perhaps we cannot.
> > >
> > > Are you talking about this ?
> > > https://elixir.free-electrons.com/linux/latest/source/Documentation/devicetree/bindings/dma/dma.txt#L41
> > >
> > > It doesn't seem to be related to that issue to me. And in our
> > > particular cases, all the devices are DMA masters, the RAM is just
> > > mapped to another address.
> > 
> > No, that's not the one I was thinking of. The idea at the time was much
> > more generic, and not limited to dma engines. I don't recall the details,
> > but I think that Thierry was either involved or made the proposal at the
> > time.
> 
> Yeah, I vaguely remember discussing something like this before. A quick
> search through my inbox yielded these two threads, mostly related to
> IOMMU but I think there were some mentions about dma-ranges and so on as
> well. I'll have to dig deeper into those threads to refresh my memories,
> but I won't get around to it until later today.
> 
> If someone wants to read up on this in the meantime, here are the links:
> 
>   https://lkml.org/lkml/2014/4/27/346
>   
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/257200.html
> 
> From a quick glance the issue of dma-ranges was something that we hand-
> waved at the time.
> 
> Thierry

Also found this, which seems to be relevant as well:


http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/252715.html

Adding Dave.

Thierry


signature.asc
Description: PGP signature


Re: [PATCH] drm/edid: use false for boolean value

2018-01-30 Thread Gustavo A. R. Silva

Hi Daniel,

Quoting Daniel Vetter :


On Tue, Jan 23, 2018 at 10:46:07AM -0600, Gustavo A. R. Silva wrote:

Assign true or false to boolean variables instead of an integer value.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva 


Thanks for your patch.


---
 drivers/gpu/drm/drm_edid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index ddd5379..45a80d7 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2767,7 +2767,7 @@ do_detailed_mode(struct detailed_timing  
*timing, void *c)


drm_mode_probed_add(closure->connector, newmode);
closure->modes++;
-   closure->preferred = 0;
+   closure->preferred = false;


There's also

.preferred = 1,

in add_detailed_modes. Please fix that one up too for consistency, then
I'll merge your patch.



Sure. I'll send a new patch shortly.

I also need to update the Coccinelle script to catch those cases.

Thanks for the feedback.
--
Gustavo






Re: [PATCH v6 2/2] media: V3s: Add support for Allwinner CSI.

2018-01-30 Thread Thierry Reding
On Tue, Jan 30, 2018 at 10:24:48AM +0100, Arnd Bergmann wrote:
> On Tue, Jan 30, 2018 at 8:54 AM, Maxime Ripard
>  wrote:
> > On Mon, Jan 29, 2018 at 03:34:02PM +0100, Arnd Bergmann wrote:
> >> On Mon, Jan 29, 2018 at 10:25 AM, Linus Walleij
> >>  wrote:
> >> > On Mon, Jan 29, 2018 at 9:25 AM, Maxime Ripard
> >> >  wrote:
> >> >> On Sat, Jan 27, 2018 at 05:14:26PM +0100, Linus Walleij wrote:
> 
> >>
> >> At one point we had discussed adding a 'dma-masters' property that
> >> lists all the buses on which a device can be a dma master, and
> >> the respective properties of those masters (iommu, coherency,
> >> offset, ...).
> >>
> >> IIRC at the time we decided that we could live without that complexity,
> >> but perhaps we cannot.
> >
> > Are you talking about this ?
> > https://elixir.free-electrons.com/linux/latest/source/Documentation/devicetree/bindings/dma/dma.txt#L41
> >
> > It doesn't seem to be related to that issue to me. And in our
> > particular cases, all the devices are DMA masters, the RAM is just
> > mapped to another address.
> 
> No, that's not the one I was thinking of. The idea at the time was much
> more generic, and not limited to dma engines. I don't recall the details,
> but I think that Thierry was either involved or made the proposal at the
> time.

Yeah, I vaguely remember discussing something like this before. A quick
search through my inbox yielded these two threads, mostly related to
IOMMU but I think there were some mentions about dma-ranges and so on as
well. I'll have to dig deeper into those threads to refresh my memories,
but I won't get around to it until later today.

If someone wants to read up on this in the meantime, here are the links:

https://lkml.org/lkml/2014/4/27/346

http://lists.infradead.org/pipermail/linux-arm-kernel/2014-May/257200.html

From a quick glance the issue of dma-ranges was something that we hand-
waved at the time.

Thierry


signature.asc
Description: PGP signature


[PATCH v8 06/11] media: i2c: ov772x: Remove soc_camera dependencies

2018-01-30 Thread Jacopo Mondi
Remove soc_camera framework dependencies from ov772x sensor driver.
- Handle clock and gpios
- Register async subdevice
- Remove soc_camera specific g/s_mbus_config operations
- Change image format colorspace from JPEG to SRGB as the two use the
  same colorspace information but JPEG makes assumptions on color
  components quantization that do not apply to the sensor
- Remove sizes crop from get_selection as driver can't scale
- Add kernel doc to driver interface header file
- Adjust build system

This commit does not remove the original soc_camera based driver as long
as other platforms depends on soc_camera-based CEU driver.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Laurent Pinchart 
---
 drivers/media/i2c/Kconfig  |  11 +++
 drivers/media/i2c/Makefile |   1 +
 drivers/media/i2c/ov772x.c | 172 ++---
 include/media/i2c/ov772x.h |   6 +-
 4 files changed, 133 insertions(+), 57 deletions(-)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 9f18cd2..e71e968 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -645,6 +645,17 @@ config VIDEO_OV5670
  To compile this driver as a module, choose M here: the
  module will be called ov5670.
 
+config VIDEO_OV772X
+   tristate "OmniVision OV772x sensor support"
+   depends on I2C && VIDEO_V4L2
+   depends on MEDIA_CAMERA_SUPPORT
+   ---help---
+ This is a Video4Linux2 sensor-level driver for the OmniVision
+ OV772x camera.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ov772x.
+
 config VIDEO_OV7640
tristate "OmniVision OV7640 sensor support"
depends on I2C && VIDEO_V4L2
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index c0f94cd..b0489a1 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -68,6 +68,7 @@ obj-$(CONFIG_VIDEO_OV5670) += ov5670.o
 obj-$(CONFIG_VIDEO_OV6650) += ov6650.o
 obj-$(CONFIG_VIDEO_OV7640) += ov7640.o
 obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
+obj-$(CONFIG_VIDEO_OV772X) += ov772x.o
 obj-$(CONFIG_VIDEO_OV7740) += ov7740.o
 obj-$(CONFIG_VIDEO_OV9650) += ov9650.o
 obj-$(CONFIG_VIDEO_OV13858) += ov13858.o
diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index 8063835..23106d7 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -1,6 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * ov772x Camera Driver
  *
+ * Copyright (C) 2017 Jacopo Mondi 
+ *
  * Copyright (C) 2008 Renesas Solutions Corp.
  * Kuninori Morimoto 
  *
@@ -9,27 +12,25 @@
  * Copyright 2006-7 Jonathan Corbet 
  * Copyright (C) 2008 Magnus Damm
  * Copyright (C) 2008, Guennadi Liakhovetski 
- *
- * 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.
  */
 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
-#include 
-#include 
+
 #include 
-#include 
+#include 
 #include 
+#include 
 
 /*
  * register offset
@@ -393,8 +394,10 @@ struct ov772x_win_size {
 struct ov772x_priv {
struct v4l2_subdevsubdev;
struct v4l2_ctrl_handler  hdl;
-   struct v4l2_clk  *clk;
+   struct clk   *clk;
struct ov772x_camera_info*info;
+   struct gpio_desc *pwdn_gpio;
+   struct gpio_desc *rstb_gpio;
const struct ov772x_color_format *cfmt;
const struct ov772x_win_size *win;
unsigned shortflag_vflip:1;
@@ -409,7 +412,7 @@ struct ov772x_priv {
 static const struct ov772x_color_format ov772x_cfmts[] = {
{
.code   = MEDIA_BUS_FMT_YUYV8_2X8,
-   .colorspace = V4L2_COLORSPACE_JPEG,
+   .colorspace = V4L2_COLORSPACE_SRGB,
.dsp3   = 0x0,
.dsp4   = DSP_OFMT_YUV,
.com3   = SWAP_YUV,
@@ -417,7 +420,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
},
{
.code   = MEDIA_BUS_FMT_YVYU8_2X8,
-   .colorspace = V4L2_COLORSPACE_JPEG,
+   .colorspace = V4L2_COLORSPACE_SRGB,
.dsp3   = UV_ON,
.dsp4   = DSP_OFMT_YUV,
.com3   = SWAP_YUV,
@@ -425,7 +428,7 @@ static const struct ov772x_color_format ov772x_cfmts[] = {
},
{
.code   = MEDIA_BUS_FMT_UYVY8_2X8,
-   .colorspace = V4L2_COLORSPACE_JPEG,
+   .colorspace = V4L2_COLORSPACE_SRGB,
.dsp3   = 0x0,
.dsp4   = DSP_OFMT_YUV,
.com3   = 0x0,
@@ -550,7 +553,7 @@ st

[PATCH v8 03/11] media: platform: Add Renesas CEU driver

2018-01-30 Thread Jacopo Mondi
Add driver for Renesas Capture Engine Unit (CEU).

The CEU interface supports capturing 'data' (YUV422) and 'images'
(NV[12|21|16|61]).

This driver aims to replace the soc_camera-based sh_mobile_ceu one.

Tested with ov7670 camera sensor, providing YUYV_2X8 data on Renesas RZ
platform GR-Peach.

Tested with ov7725 camera sensor on SH4 platform Migo-R.

Signed-off-by: Jacopo Mondi 
Reviewed-by: Laurent Pinchart 
---
 drivers/media/platform/Kconfig   |9 +
 drivers/media/platform/Makefile  |1 +
 drivers/media/platform/renesas-ceu.c | 1661 ++
 3 files changed, 1671 insertions(+)
 create mode 100644 drivers/media/platform/renesas-ceu.c

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 614fbef..f9cc058 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -144,6 +144,15 @@ config VIDEO_STM32_DCMI
  To compile this driver as a module, choose M here: the module
  will be called stm32-dcmi.
 
+config VIDEO_RENESAS_CEU
+   tristate "Renesas Capture Engine Unit (CEU) driver"
+   depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
+   depends on ARCH_SHMOBILE || ARCH_R7S72100 || COMPILE_TEST
+   select VIDEOBUF2_DMA_CONTIG
+   select V4L2_FWNODE
+   ---help---
+ This is a v4l2 driver for the Renesas CEU Interface
+
 source "drivers/media/platform/soc_camera/Kconfig"
 source "drivers/media/platform/exynos4-is/Kconfig"
 source "drivers/media/platform/am437x/Kconfig"
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index 7f30804..85e1121 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)+= sh_vou.o
 obj-$(CONFIG_SOC_CAMERA)   += soc_camera/
 
 obj-$(CONFIG_VIDEO_RCAR_DRIF)  += rcar_drif.o
+obj-$(CONFIG_VIDEO_RENESAS_CEU)+= renesas-ceu.o
 obj-$(CONFIG_VIDEO_RENESAS_FCP)+= rcar-fcp.o
 obj-$(CONFIG_VIDEO_RENESAS_FDP1)   += rcar_fdp1.o
 obj-$(CONFIG_VIDEO_RENESAS_JPU)+= rcar_jpu.o
diff --git a/drivers/media/platform/renesas-ceu.c 
b/drivers/media/platform/renesas-ceu.c
new file mode 100644
index 000..d0ac500
--- /dev/null
+++ b/drivers/media/platform/renesas-ceu.c
@@ -0,0 +1,1661 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * V4L2 Driver for Renesas Capture Engine Unit (CEU) interface
+ * Copyright (C) 2017-2018 Jacopo Mondi 
+ *
+ * Based on soc-camera driver "soc_camera/sh_mobile_ceu_camera.c"
+ * Copyright (C) 2008 Magnus Damm
+ *
+ * Based on V4L2 Driver for PXA camera host - "pxa_camera.c",
+ * Copyright (C) 2006, Sascha Hauer, Pengutronix
+ * Copyright (C) 2008, Guennadi Liakhovetski 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define DRIVER_NAME"renesas-ceu"
+
+/* CEU registers offsets and masks. */
+#define CEU_CAPSR  0x00 /* Capture start register  */
+#define CEU_CAPCR  0x04 /* Capture control register*/
+#define CEU_CAMCR  0x08 /* Capture interface control register  */
+#define CEU_CAMOR  0x10 /* Capture interface offset register   */
+#define CEU_CAPWR  0x14 /* Capture interface width register*/
+#define CEU_CAIFR  0x18 /* Capture interface input format register */
+#define CEU_CRCNTR 0x28 /* CEU register control register   */
+#define CEU_CRCMPR 0x2c /* CEU register forcible control register  */
+#define CEU_CFLCR  0x30 /* Capture filter control register */
+#define CEU_CFSZR  0x34 /* Capture filter size clip register   */
+#define CEU_CDWDR  0x38 /* Capture destination width register  */
+#define CEU_CDAYR  0x3c /* Capture data address Y register */
+#define CEU_CDACR  0x40 /* Capture data address C register */
+#define CEU_CFWCR  0x5c /* Firewall operation control register */
+#define CEU_CDOCR  0x64 /* Capture data output control register*/
+#define CEU_CEIER  0x70 /* Capture event interrupt enable register */
+#define CEU_CETCR  0x74 /* Capture event flag clear register   */
+#define CEU_CSTSR  0x7c /* Capture status register */
+#define CEU_CSRTR  0x80 /* Capture software reset register */
+
+/* Data synchronous fetch mode. */
+#define CEU_CAMCR_JPEG BIT(4)
+
+/* Input components ordering: CEU_CAMCR.DTARY field. */
+#define CEU_CAMCR_DTARY_8_UYVY (0x00 << 8)
+#define CEU_CAMCR_DTARY_8_VYUY (0x01 << 8)
+#define CEU_CAMCR_DTARY_8_YUYV (0x02 << 8)
+#define CEU_CAMCR_DTARY_8_YVYU (0x03 << 8)
+/* TODO: input components orderi

[PATCH v8 01/11] dt-bindings: media: Add Renesas CEU bindings

2018-01-30 Thread Jacopo Mondi
Add bindings documentation for Renesas Capture Engine Unit (CEU).

Signed-off-by: Jacopo Mondi 
Reviewed-by: Rob Herring 
Reviewed-by: Laurent Pinchart 
Acked-by: Hans Verkuil 
---
 .../devicetree/bindings/media/renesas,ceu.txt  | 81 ++
 1 file changed, 81 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/renesas,ceu.txt

diff --git a/Documentation/devicetree/bindings/media/renesas,ceu.txt 
b/Documentation/devicetree/bindings/media/renesas,ceu.txt
new file mode 100644
index 000..3fc66df
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/renesas,ceu.txt
@@ -0,0 +1,81 @@
+Renesas Capture Engine Unit (CEU)
+--
+
+The Capture Engine Unit is the image capture interface found in the Renesas
+SH Mobile and RZ SoCs.
+
+The interface supports a single parallel input with data bus width of 8 or 16
+bits.
+
+Required properties:
+- compatible: Shall be "renesas,r7s72100-ceu" for CEU units found in RZ/A1H
+  and RZ/A1M SoCs.
+- reg: Registers address base and size.
+- interrupts: The interrupt specifier.
+
+The CEU supports a single parallel input and should contain a single 'port'
+subnode with a single 'endpoint'. Connection to input devices are modeled
+according to the video interfaces OF bindings specified in:
+Documentation/devicetree/bindings/media/video-interfaces.txt
+
+Optional endpoint properties applicable to parallel input bus described in
+the above mentioned "video-interfaces.txt" file are supported.
+
+- hsync-active: Active state of the HSYNC signal, 0/1 for LOW/HIGH 
respectively.
+  If property is not present, default is active high.
+- vsync-active: Active state of the VSYNC signal, 0/1 for LOW/HIGH 
respectively.
+  If property is not present, default is active high.
+
+Example:
+
+The example describes the connection between the Capture Engine Unit and an
+OV7670 image sensor connected to i2c1 interface.
+
+ceu: ceu@e821 {
+   reg = <0xe821 0x209c>;
+   compatible = "renesas,r7s72100-ceu";
+   interrupts = ;
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&vio_pins>;
+
+   status = "okay";
+
+   port {
+   ceu_in: endpoint {
+   remote-endpoint = <&ov7670_out>;
+
+   hsync-active = <1>;
+   vsync-active = <0>;
+   };
+   };
+};
+
+i2c1: i2c@fcfee400 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&i2c1_pins>;
+
+   status = "okay";
+
+   clock-frequency = <10>;
+
+   ov7670: camera@21 {
+   compatible = "ovti,ov7670";
+   reg = <0x21>;
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&vio_pins>;
+
+   reset-gpios = <&port3 11 GPIO_ACTIVE_LOW>;
+   powerdown-gpios = <&port3 12 GPIO_ACTIVE_HIGH>;
+
+   port {
+   ov7670_out: endpoint {
+   remote-endpoint = <&ceu_in>;
+
+   hsync-active = <1>;
+   vsync-active = <0>;
+   };
+   };
+   };
+};
-- 
2.7.4



Re: [PATCH 4.4 00/74] 4.4.114-stable review

2018-01-30 Thread Naresh Kamboju
On 29 January 2018 at 18:26, Greg Kroah-Hartman
 wrote:
> This is the start of the stable review cycle for the 4.4.114 release.
> There are 74 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Wed Jan 31 12:38:21 UTC 2018.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.114-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.4.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h
>

Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.

Summary


kernel: 4.4.114-rc1
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: d9fcd0a3af9c5d6c1cc6cf729546f1ae0a527628
git describe: v4.4.113-76-gd9fcd0a3af9c
Test details: 
https://staging-qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.113-76-gd9fcd0a3af9c


No regressions (compared to build v4.4.113-75-gaa55f991278a)

Boards, architectures and test suites:
-

x15 - arm
* boot - pass: 20,
* kselftest - pass: 32, skip: 28
* libhugetlbfs - pass: 87, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 20, skip: 2
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 13, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1036, skip: 67
* ltp-timers-tests - pass: 12,

x86_64
* boot - pass: 20,
* kselftest - pass: 45, skip: 31
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 61, skip: 1
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 9, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1015, skip: 117
* ltp-timers-tests - pass: 12,

Hikey test results summary
Summary


kernel: 4.4.114-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git tag: 4.4.114-rc1-hikey-20180129-121
git commit: 01517f424e9be016a5471a19e8c4ffa4bbbe9933
git describe: 4.4.114-rc1-hikey-20180129-121
Test details: 
https://staging-qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.114-rc1-hikey-20180129-121


No regressions (compared to build 4.4.114-rc1-hikey-20180129-120)

Boards, architectures and test suites:
-

hi6220-hikey - arm64
* boot - pass: 20,
* kselftest - pass: 30, skip: 31
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 28, skip: 36
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 21, skip: 1
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 980, skip: 124
* ltp-timers-tests - pass: 12,

Documentation - https://collaborate.linaro.org/display/LKFT/Email+Reports
Tested-by: Naresh Kamboju 


Re: [PATCH 2/4] rtc: isl1208: Add device tree binding documentation

2018-01-30 Thread Alexandre Belloni
Hi,

On 23/01/2018 at 13:17:59 +0100, Michael Grzeschik wrote:
> From: Denis Osterland 
> 
> Wrote documentation for ISL1208, ISL1218 device tree
> binding with short examples.
> 

This binding is already in
Documentation/devicetree/bindings/trivial-devices.txt, no need to
duplicate.

> Signed-off-by: Denis Osterland 
> Signed-off-by: Michael Grzeschik 
> ---
>  .../devicetree/bindings/rtc/intersil,isl1208.txt   | 35 
> ++
>  1 file changed, 35 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/rtc/intersil,isl1208.txt
> 
> diff --git a/Documentation/devicetree/bindings/rtc/intersil,isl1208.txt 
> b/Documentation/devicetree/bindings/rtc/intersil,isl1208.txt
> new file mode 100644
> index 0..a54e99feae1ca
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/intersil,isl1208.txt
> @@ -0,0 +1,35 @@
> +Intersil ISL1208, ISL1218 I2C RTC/Alarm chip
> +
> +ISL1208 is a trivial I2C device (it has simple device tree bindings,
> +consisting of a compatible field, an address and possibly an interrupt
> +line).
> +
> +Required properties supported by the device:
> +
> + - "compatible": must be one of
> + "isil,isl1208"
> + "isil,isl1218"
> + - "reg": I2C bus address of the device
> +
> +Optional properties:
> +
> + - "interrupt-parent", "interrupts", "interrupts-extended":
> +   for passing the interrupt line of the SoC connected to #IRQ pin
> +   of the RTC chip.
> +
> +
> +Example isl1208 node without #IRQ pin connected:
> +
> + isl1208: isl1208@68 {
> + compatible = "isil,isl1208";
> + reg = <0x68>;
> + };
> +
> +Example isl1208 node with #IRQ pin connected to SoC gpio1 pin 12:
> +
> + isl1208: isl1208@68 {
> + compatible = "isil,isl1208";
> + reg = <0x68>;
> + interrupt-parent = <&gpio1>;
> + interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
> + };
> -- 
> 2.11.0
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


Re: [PATCH 4.14 00/71] 4.14.16-stable review

2018-01-30 Thread Naresh Kamboju
On 29 January 2018 at 18:26, Greg Kroah-Hartman
 wrote:
> This is the start of the stable review cycle for the 4.14.16 release.
> There are 71 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Wed Jan 31 12:37:59 UTC 2018.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.16-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.14.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h
>

Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.

Summary


kernel: 4.14.16-rc1
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: d5ba39515c18189ffc6b6273a0de22ebb8581233
git describe: v4.14.15-73-gd5ba39515c18
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe/build/v4.14.15-73-gd5ba39515c18


No regressions (compared to build v4.14.15-72-g19110e135e1e)

Boards, architectures and test suites:
-

hi6220-hikey - arm64
* boot - pass: 20,
* kselftest - pass: 46, skip: 16
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 21, skip: 1
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 983, skip: 121
* ltp-timers-tests - pass: 12,

juno-r2 - arm64
* boot - pass: 20,
* kselftest - pass: 46, skip: 16
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 987, skip: 121
* ltp-timers-tests - pass: 12,

x15 - arm
* boot - pass: 20,
* kselftest - pass: 43, skip: 18
* libhugetlbfs - pass: 87, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 20, skip: 2
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 13, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1037, skip: 66
* ltp-timers-tests - pass: 12,

x86_64
* boot - pass: 20,
* kselftest - pass: 56, fail: 1, skip: 18
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 61, skip: 1
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 9, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1016, skip: 116
* ltp-timers-tests - pass: 12,

Documentation - https://collaborate.linaro.org/display/LKFT/Email+Reports
Tested-by: Naresh Kamboju 


Re: [PATCH 4.9 00/66] 4.9.79-stable review

2018-01-30 Thread Naresh Kamboju
On 29 January 2018 at 18:26, Greg Kroah-Hartman
 wrote:
> This is the start of the stable review cycle for the 4.9.79 release.
> There are 66 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Wed Jan 31 12:38:12 UTC 2018.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.79-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.9.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h
>

Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.

Summary


kernel: 4.9.79-rc1
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.9.y
git commit: 0d0e61f289f38f6c09f044b35c1823c6ce573fe4
git describe: v4.9.78-68-g0d0e61f289f3
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.9-oe/build/v4.9.78-68-g0d0e61f289f3


No regressions (compared to build v4.9.78-67-g4265b9ca3e45)

Boards, architectures and test suites:
-

hi6220-hikey - arm64
* boot - pass: 20,
* kselftest - pass: 40, skip: 23
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 21, skip: 1
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 983, skip: 121
* ltp-timers-tests - pass: 12,

juno-r2 - arm64
* boot - pass: 20,
* kselftest - pass: 41, skip: 22
* libhugetlbfs - pass: 90, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 14,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 987, skip: 121
* ltp-timers-tests - pass: 12,

x15 - arm
* boot - pass: 20,
* kselftest - pass: 38, skip: 24
* libhugetlbfs - pass: 87, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 20, skip: 2
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 13, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1037, skip: 66
* ltp-timers-tests - pass: 12,

x86_64
* boot - pass: 20,
* kselftest - pass: 51, skip: 26
* libhugetlbfs - pass: 88, skip: 1
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 61, skip: 1
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 9, skip: 1
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1016, skip: 116
* ltp-timers-tests - pass: 12,

Documentation - https://collaborate.linaro.org/display/LKFT/Email+Reports
Tested-by: Naresh Kamboju 


  1   2   3   4   5   6   7   8   9   10   >