Re: [RFC PATCH 1/7 v1]powerpc: Free up four PTE bits to accommodate memory keys

2017-06-11 Thread Aneesh Kumar K.V
Ram Pai  writes:

> Rearrange  PTE   bits to  free  up  bits 3, 4, 5  and  6  for
> memory keys. Bit 3, 4, 5, 6 and 57  shall  be used for memory
> keys.
>
> The patch does the following change to the 64K PTE format
>
> H_PAGE_BUSY moves from bit 3 to bit 7
> H_PAGE_F_SECOND which occupied bit 4 moves to the second part
>   of the pte.
> H_PAGE_F_GIX which  occupied bit 5, 6 and 7 also moves to the
>   second part of the pte.
>
> The second part of the PTE will hold
>a (H_PAGE_F_SECOND|H_PAGE_F_GIX)  for  64K page backed pte,
>and sixteen (H_PAGE_F_SECOND|H_PAGE_F_GIX)  for 4k  backed
>   pte.
>
> the four  bits((H_PAGE_F_SECOND|H_PAGE_F_GIX) that represent a slot
> is initialized to 0xF indicating a invalid slot. if a hashpage does
> get  allocated  to  the  0xF  slot, it is released and not used. In
> other words, even  though  0xF  is  a valid slot we discard it  and
> consider it as invalid slot(HPTE_SOFT_INVALID). This  gives  us  an
> opportunity to  not  depend on a bit in the primary PTE in order to
> determine the validity of a slot.

Do we need to do this for 64K hptes ? H_PAGE_HASHPTE indicates whether a
slot is valid or not. For 4K hptes, we do need this right ? ie, only
when H_PAGE_COMBO is set we need to consider 0xf as an invalid slot


>
> When  we  release  a  0xF slot we also release a legitimate primary
> slot  and  unmap  that  entry. This  is  to  ensure  that we do get
> a legimate non-0xF slot the next time we retry for a slot.

Can you explain this more ? what is a primary slot here ?

>
> Though treating 0xF slot as invalid reduces the number of available
> slots and make have a effect on the performance, the probabilty
> of hitting a 0xF is extermely low.
>
> Compared  to the current scheme, the above described scheme reduces
> the number of false hash table updates  significantly  and  has the
> added  advantage  of  releasing  four  valuable  PTE bits for other
> purpose.
>
> This idea was jointly developed by Paul Mackerras, Aneesh, Michael
> Ellermen and myself.
>
> 4K PTE format remain unchanged currently.
>
> Signed-off-by: Ram Pai 
> ---
>  arch/powerpc/include/asm/book3s/64/hash-4k.h  | 12 +
>  arch/powerpc/include/asm/book3s/64/hash-64k.h | 38 ++
>  arch/powerpc/include/asm/book3s/64/hash.h |  8 ++-
>  arch/powerpc/include/asm/book3s/64/mmu-hash.h |  5 ++
>  arch/powerpc/mm/dump_linuxpagetables.c|  3 +-
>  arch/powerpc/mm/hash64_4k.c   | 12 ++---
>  arch/powerpc/mm/hash64_64k.c  | 73 
> +--
>  arch/powerpc/mm/hash_utils_64.c   | 38 +-
>  arch/powerpc/mm/hugetlbpage-hash64.c  | 16 +++---
>  9 files changed, 107 insertions(+), 98 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h 
> b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> index b4b5e6b..223d318 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> @@ -16,6 +16,18 @@
>  #define H_PUD_TABLE_SIZE (sizeof(pud_t) << H_PUD_INDEX_SIZE)
>  #define H_PGD_TABLE_SIZE (sizeof(pgd_t) << H_PGD_INDEX_SIZE)
>
> +
> +/*
> + * Only supported by 4k linux page size

that comment is confusing, you can drop that, it is part of hash-4k.h
which means these defines are local to 4k linux page size config.

> + */
> +#define H_PAGE_F_SECOND_RPAGE_RSV2 /* HPTE is in 2ndary HPTEG */
> +#define H_PAGE_F_GIX   (_RPAGE_RSV3 | _RPAGE_RSV4 | _RPAGE_RPN44)
> +#define H_PAGE_F_GIX_SHIFT 56
> +
> +#define H_PAGE_BUSY  _RPAGE_RSV1 /* software: PTE & hash are busy */
> +#define H_PAGE_HASHPTE   _RPAGE_RPN43/* PTE has associated HPTE */
> +
> +
>  /* PTE flags to conserve for HPTE identification */
>  #define _PAGE_HPTEFLAGS (H_PAGE_BUSY | H_PAGE_HASHPTE | \
>H_PAGE_F_SECOND | H_PAGE_F_GIX)
> diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h 
> b/arch/powerpc/include/asm/book3s/64/hash-64k.h
> index 9732837..87ee22d 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash-64k.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h
> @@ -10,23 +10,21 @@
>   * 64k aligned address free up few of the lower bits of RPN for us
>   * We steal that here. For more deatils look at pte_pfn/pfn_pte()
>   */
> -#define H_PAGE_COMBO _RPAGE_RPN0 /* this is a combo 4k page */
> -#define H_PAGE_4K_PFN_RPAGE_RPN1 /* PFN is for a single 4k page */
> +#define H_PAGE_COMBO   _RPAGE_RPN0 /* this is a combo 4k page */
> +#define H_PAGE_4K_PFN  _RPAGE_RPN1 /* PFN is for a single 4k page */
> +
> +#define H_PAGE_BUSY  _RPAGE_RPN44 /* software: PTE & hash are busy */
> +#define H_PAGE_HASHPTE   _RPAGE_RPN43/* PTE has associated HPTE */
> +
>  /*
>   * We need to differentiate between explicit huge page and THP huge
>   * page, since THP huge page also need to track real subpage details
>   */
>  #define H_PAGE_THP_HUGE  H_PAGE_4K_PFN
>
> -/*
> - * Used to track subpage 

Re: [PATCH v3 3/3] net/cxgb4: Use new PCI_DEV_FLAGS_NO_RELAXED_ORDERING flag

2017-06-11 Thread Ding Tianhong


On 2017/6/8 7:24, Alexander Duyck wrote:
> On Wed, Jun 7, 2017 at 2:16 AM, Ding Tianhong  wrote:
>> From: Casey Leedom 
>>
>> cxgb4 Ethernet driver now queries Root Complex Port to determine if it can
>> send TLPs to it with the Relaxed Ordering Attribute set.
>>
>> Signed-off-by: Casey Leedom 
>> Signed-off-by: Ding Tianhong 
> 
> So I am pretty sure this patch doesn't work with patch 2. We need to
> update it so that it doesn't check the root complex but instead checks
> itself to see if it is allowed to use relaxed ordering.
> 

Right, we should check the End Point PCIe device configuration space, not RC.

> What we need here is the ability to detect if relaxed ordering is
> disabled, and if so take the steps needed to enable peer to peer
> relaxed ordering without enabling relaxed ordering to the root
> complex. Do I have that right Casey?
> 

I am not very clear to this driver about how to enable peer to peer
relaxed ordering without enabling relaxed ordering to the RC, need
some help from Casey, so I will still focus on this patch and only
fix the peer to RC relaxed ordering problem, I hope Casey could send
another patch to fix it later.

Thanks
Ding

>> ---
>>  drivers/net/ethernet/chelsio/cxgb4/cxgb4.h  |  1 +
>>  drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 17 +
>>  drivers/net/ethernet/chelsio/cxgb4/sge.c|  5 +++--
>>  3 files changed, 21 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h 
>> b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
>> index e88c180..478f25a 100644
>> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
>> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
>> @@ -521,6 +521,7 @@ enum { /* adapter flags 
>> */
>> USING_SOFT_PARAMS  = (1 << 6),
>> MASTER_PF  = (1 << 7),
>> FW_OFLD_CONN   = (1 << 9),
>> +   ROOT_NO_RELAXED_ORDERING = (1 << 10),
>>  };
>>
>>  enum {
>> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c 
>> b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
>> index 38a5c67..fbfe341 100644
>> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
>> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
>> @@ -4628,6 +4628,7 @@ static int init_one(struct pci_dev *pdev, const struct 
>> pci_device_id *ent)
>>  #ifdef CONFIG_PCI_IOV
>> u32 v, port_vec;
>>  #endif
>> +   struct pci_dev *root;
>>
>> printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION);
>>
>> @@ -4726,6 +4727,22 @@ static int init_one(struct pci_dev *pdev, const 
>> struct pci_device_id *ent)
>> adapter->msg_enable = DFLT_MSG_ENABLE;
>> memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map));
>>
>> +   /* If possible, we use PCIe Relaxed Ordering Attribute to deliver
>> +* Ingress Packet Data to Free List Buffers in order to allow for
>> +* chipset performance optimizations between the Root Complex and
>> +* Memory Controllers.  (Messages to the associated Ingress Queue
>> +* notifying new Packet Placement in the Free Lists Buffers will be
>> +* send without the Relaxed Ordering Attribute thus guaranteing that
>> +* all preceding PCIe Transaction Layer Packets will be processed
>> +* first.)  But some Root Complexes have various issues with Upstream
>> +* Transaction Layer Packets with the Relaxed Ordering Attribute set.
>> +* So we check our Root Complex to see if it's flaged with advice
>> +* against using Relaxed Ordering.
>> +*/
>> +   root = pci_find_pcie_root_port(adapter->pdev);
>> +   if (pcie_get_relaxed_ordering(root))
>> +   adapter->flags |= ROOT_NO_RELAXED_ORDERING;
>> +
>> spin_lock_init(&adapter->stats_lock);
>> spin_lock_init(&adapter->tid_release_lock);
>> spin_lock_init(&adapter->win0_lock);
>> diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c 
>> b/drivers/net/ethernet/chelsio/cxgb4/sge.c
>> index f05f0d4..ac229a3 100644
>> --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
>> +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
>> @@ -2571,6 +2571,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct 
>> sge_rspq *iq, bool fwevtq,
>> struct fw_iq_cmd c;
>> struct sge *s = &adap->sge;
>> struct port_info *pi = netdev_priv(dev);
>> +   int relaxed = !(adap->flags & ROOT_NO_RELAXED_ORDERING);
>>
>> /* Size needs to be multiple of 16, including status entry. */
>> iq->size = roundup(iq->size, 16);
>> @@ -2624,8 +2625,8 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct 
>> sge_rspq *iq, bool fwevtq,
>>
>> flsz = fl->size / 8 + s->stat_len / sizeof(struct tx_desc);
>> c.iqns_to_fl0congen |= htonl(FW_IQ_CMD_FL0PACKEN_F |
>> -FW_IQ_CMD_FL0FETCHRO_F |
>> -FW_IQ_CMD_FL0DATARO_F |
>> +   

Re: [PATCH 04/14] mm, memory_hotplug: get rid of is_zone_device_section

2017-06-11 Thread Michal Hocko
On Sat 10-06-17 22:58:21, Wei Yang wrote:
> On Sat, Jun 10, 2017 at 5:56 PM, Wei Yang  wrote:
[...]
> > Hmm... one question about the memory_block behavior.
> >
> > In case one memory_block contains more than one memory section.
> > If one section is "device zone", the whole memory_block is not visible
> > in sysfs. Or until the whole memory_block is full, the sysfs is visible.
> >
> 
> Ok, I made a mistake here. The memory_block device is visible in this
> case, while the sysfs link between memory_block and node is not visible
> for the whole memory_block device.

yes the behavior is quite messy

> 
> BTW, current register_mem_sect_under_node() will create the sysfs
> link between memory_block and node for each pfn, while actually
> we only need one link between them. If I am correct.
> 
> If you think it is fine, I would like to change this one to create the link
> on section base.

My longer term plan was to unify all the code to be either memory block
or memory section oriented. The first sounds more logical from the user
visible granularity point of view but there might be some corner cases
which would require to use section based approach. I didn't have time to
study that. If you want to play with that, feel free of course.
-- 
Michal Hocko
SUSE Labs


Re: [PATCH] mm, memory_hotplug: support movable_node for hotplugable nodes

2017-06-11 Thread Michal Hocko
On Mon 12-06-17 12:28:32, Wei Yang wrote:
> On Thu, Jun 08, 2017 at 02:23:18PM +0200, Michal Hocko wrote:
> >From: Michal Hocko 
> >
> >movable_node kernel parameter allows to make hotplugable NUMA
> >nodes to put all the hotplugable memory into movable zone which
> >allows more or less reliable memory hotremove.  At least this
> >is the case for the NUMA nodes present during the boot (see
> >find_zone_movable_pfns_for_nodes).
> >
> 
> When movable_node is enabled, we would have overlapped zones, right?

It won't based on this patch. See movable_pfn_range

> To be specific, only ZONE_MOVABLE could have memory ranges belongs to other
> zones.
> 
> This looks a little different in the whole ZONE design.
> 
> >This is not the case for the memory hotplug, though.
> >
> > echo online > /sys/devices/system/memory/memoryXYZ/status
> >
> >will default to a kernel zone (usually ZONE_NORMAL) unless the
> >particular memblock is already in the movable zone range which is not
> ^^^
> 
> Here is memblock or a memory_block?

yes

> 
> >the case normally when onlining the memory from the udev rule context
> >for a freshly hotadded NUMA node. The only option currently is to have a
> 
> So the semantic you want to change here is to make the memory_block in
> ZONE_MOVABLE when movable_node is enabled.

Yes, by default when there the specific range is not associated with any
other zone.

> Besides this, movable_node is enabled, what other requirements? Like, this
> memory_block should next to current ZONE_MOVABLE ? or something else?

no other requirements. 

> >special udev rule to echo online_movable to all memblocks belonging to
> >such a node which is rather clumsy. Not the mention this is inconsistent
>  ^^^
> 
> Hmm... "Not to mentions" looks more understandable.

yes this is a typo

> BTW, I am not a native speaker. If this usage is correct, just ignore this
> comment.
> 
> >as well because what ended up in the movable zone during the boot will
> >end up in a kernel zone after hotremove & hotadd without special care.
> >
> >It would be nice to reuse memblock_is_hotpluggable but the runtime
> >hotplug doesn't have that information available because the boot and
> >hotplug paths are not shared and it would be really non trivial to
> >make them use the same code path because the runtime hotplug doesn't
> >play with the memblock allocator at all.
> >
> >Teach move_pfn_range that MMOP_ONLINE_KEEP can use the movable zone if
> >movable_node is enabled and the range doesn't overlap with the existing
> >normal zone. This should provide a reasonable default onlining strategy.
> >
> >Strictly speaking the semantic is not identical with the boot time
> >initialization because find_zone_movable_pfns_for_nodes covers only the
> >hotplugable range as described by the BIOS/FW. From my experience this
> >is usually a full node though (except for Node0 which is special and
> >never goes away completely). If this turns out to be a problem in the
> >real life we can tweak the code to store hotplug flag into memblocks
> >but let's keep this simple now.
> >
> 
> Let me try to understand your purpose of this change.
> 
> If a memblock has MEMBLOCK_HOTPLU set, it would be in ZONE_MOVABLE during
> bootup. While a hotplugged memory_block would be in ZONE_NORMAL without
> special care.
> 
> So you want to make sure when movable_node is enabled, the hotplugged
> memory_block would be in ZONE_MOVABLE. Is this correct?

yes

> One more thing is do we have MEMBLOCK_HOTPLU for a hotplugged memory_block?

No, we do not, as the changelog mentions. This flag is set in the
memblock allocator (do not confuse that with the memory_block hotplug
works with - yeah quite confusing) and that is a boot only thing. We do
not use it during runtime memory hotplug.
-- 
Michal Hocko
SUSE Labs


Re: WARNING in dev_watchdog

2017-06-11 Thread Greg KH
On Mon, Jun 12, 2017 at 02:37:22PM +0800, Dison River wrote:
> Hi:
> I've got the following error report while fuzzing the kernel with
> syzkaller on linux-4.11.0-rc3.
> 
> log:
> WARNING: CPU: 2 PID: 0 at net/sched/sch_generic.c:316
> dev_watchdog+0x648/0x770 net/sched/sch_generic.c:315
> NETDEV WATCHDOG: eth0 (e1000): transmit queue 0 timed out
> Kernel panic - not syncing: panic_on_warn set ...
> 
> CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.11.0-rc3 #2
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
> Ubuntu-1.8.2-1ubuntu1 04/01/2014
> Call Trace:
>  
>  __dump_stack lib/dump_stack.c:16 [inline]
>  dump_stack+0x95/0xe8 lib/dump_stack.c:52
>  panic+0x1ae/0x386 kernel/panic.c:180
>  __warn+0x1c4/0x1e0 kernel/panic.c:541
>  warn_slowpath_fmt+0xac/0xd0 kernel/panic.c:564
>  dev_watchdog+0x648/0x770 net/sched/sch_generic.c:315
>  call_timer_fn+0x15b/0x5e0 kernel/time/timer.c:1268
>  expire_timers kernel/time/timer.c:1307 [inline]
>  __run_timers kernel/time/timer.c:1601 [inline]
>  run_timer_softirq+0x5c7/0x1140 kernel/time/timer.c:1614
>  __do_softirq+0x217/0x8b7 kernel/softirq.c:284
>  invoke_softirq kernel/softirq.c:364 [inline]
>  irq_exit+0x198/0x1d0 kernel/softirq.c:405
>  exiting_irq arch/x86/include/asm/apic.h:657 [inline]
>  smp_apic_timer_interrupt+0x76/0xa0 arch/x86/kernel/apic/apic.c:962
>  apic_timer_interrupt+0x90/0xa0 arch/x86/entry/entry_64.S:707
> RIP: 0010:native_safe_halt arch/x86/include/asm/irqflags.h:53 [inline]
> RIP: 0010:arch_safe_halt arch/x86/include/asm/irqflags.h:95 [inline]
> RIP: 0010:default_idle+0x1f/0x2d0 arch/x86/kernel/process.c:275
> RSP: 0018:88006dee7e78 EFLAGS: 0246 ORIG_RAX: ff10
> RAX: 0007 RBX: 88006de9db40 RCX: 
> RDX:  RSI: 0001 RDI: 88006de9e314
> RBP: 88006dee7e98 R08: 0040 R09: 
> R10:  R11:  R12: 83efc9b8
> R13: 88006de9db40 R14: 0002 R15: 88006de9db40
>  
>  arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:266
>  default_idle_call+0x36/0x50 kernel/sched/idle.c:97
>  cpuidle_idle_call kernel/sched/idle.c:155 [inline]
>  do_idle+0x20b/0x2d0 kernel/sched/idle.c:244
>  cpu_startup_entry+0x18/0x20 kernel/sched/idle.c:346
>  start_secondary+0x245/0x2d0 arch/x86/kernel/smpboot.c:275
>  start_cpu+0x14/0x14 arch/x86/kernel/head_64.S:306
> Dumping ftrace buffer:
>(ftrace buffer empty)
> Kernel Offset: disabled
> Rebooting in 86400 seconds..
> 
> 
> report :
> 
> 
> syzkaller login: [   37.041894] [ cut here ]
> [   37.042430] WARNING: CPU: 2 PID: 0 at net/sched/sch_generic.c:316
> dev_watchdog+0x648/0x770
> [   37.042978] NETDEV WATCHDOG: eth0 (e1000): transmit queue 0 timed out
> [   37.043405] Kernel panic - not syncing: panic_on_warn set ...
> [   37.043405]
> [   37.043888] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.11.0-rc3 #2
> [   37.044297] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
> BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
> [   37.044909] Call Trace:
> [   37.045080]  
> [   37.045226]  dump_stack+0x95/0xe8
> [   37.045453]  ? dev_watchdog+0x648/0x770
> [   37.045712]  panic+0x1ae/0x386
> [   37.045924]  ? percpu_up_read_preempt_enable.constprop.53+0xae/0xae
> [   37.046342]  ? dev_watchdog+0x648/0x770
> [   37.046605]  ? vprintk_default+0x28/0x30
> [   37.046873]  ? dev_watchdog+0x648/0x770
> [   37.047114]  __warn+0x1c4/0x1e0
> [   37.047820]  warn_slowpath_fmt+0xac/0xd0
> [   37.048467]  ? __warn+0x1e0/0x1e0
> [   37.048698]  ? dev_watchdog+0x125/0x770
> [   37.048963]  dev_watchdog+0x648/0x770
> [   37.049218]  call_timer_fn+0x15b/0x5e0
> [   37.049475]  ? call_timer_fn+0xcc/0x5e0
> [   37.049739]  ? qdisc_rcu_free+0x110/0x110
> [   37.050014]  ? process_timeout+0x20/0x20
> [   37.050285]  ? trace_hardirqs_on_caller+0x19e/0x580
> [   37.053699]  ? qdisc_rcu_free+0x110/0x110
> [   37.054931]  ? qdisc_rcu_free+0x110/0x110
> [   37.055296]  run_timer_softirq+0x5c7/0x1140
> [   37.055949]  ? msleep_interruptible+0x170/0x170
> [   37.056671]  ? lapic_timer_shutdown+0x3d/0x50
> [   37.057268]  ? clockevents_switch_state+0xe3/0x320
> [   37.057837]  __do_softirq+0x217/0x8b7
> [   37.058097]  irq_exit+0x198/0x1d0
> [   37.058326]  smp_apic_timer_interrupt+0x76/0xa0
> [   37.058634]  apic_timer_interrupt+0x90/0xa0
> [   37.058921] RIP: 0010:default_idle+0x1f/0x2d0
> [   37.059217] RSP: 0018:88006dee7e78 EFLAGS: 0246 ORIG_RAX:
> ff10
> [   37.059702] RAX: 0007 RBX: 88006de9db40 RCX: 
> 
> [   37.060179] RDX:  RSI: 0001 RDI: 
> 88006de9e314
> [   37.065968] RBP: 88006dee7e98 R08: 0040 R09: 
> 
> [   37.066451] R10:  R11:  R12: 
> 83efc9b8
> [   37.073921] R13: 88006de9db40 R14: 0002 R15: 
> 88006de9db40
> [   37.074405]  
> [   37.074767]  ? default_idle+0x1d/0x2

[PATCH v2] KVM: ARM64: fix phy counter access failure in guest.

2017-06-11 Thread Hu Huajun
When reading the cntpct_el0 in guest with VHE (Virtual Host Extension)
enabled in host, the "Unsupported guest sys_reg access" error reported.
The reason is cnthctl_el2.EL1PCTEN is not enabled, which is expected
to be done in kvm_timer_init_vhe(). The problem is kvm_timer_init_vhe
is called by cpu_init_hyp_mode, and which is called when VHE is disabled.
This patch remove the incorrect call to kvm_timer_init_vhe() from
cpu_init_hyp_mode(), and calls kvm_timer_init_vhe() to enable
cnthctl_el2.EL1PCTEN in cpu_hyp_reinit().

Changes from v1:
* According to Christoffer Dall's comment, remove the incocrrect call
to kvm_timer_init_vhe() in cpu_init_hyp_mode().

Signed-off-by: Hu Huajun 
---
 virt/kvm/arm/arm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
index 3417e18..a430125 100644
--- a/virt/kvm/arm/arm.c
+++ b/virt/kvm/arm/arm.c
@@ -1115,9 +1115,6 @@ static void cpu_init_hyp_mode(void *dummy)
__cpu_init_hyp_mode(pgd_ptr, hyp_stack_ptr, vector_ptr);
__cpu_init_stage2();
 
-   if (is_kernel_in_hyp_mode())
-   kvm_timer_init_vhe();
-
kvm_arm_init_debug();
 }
 
@@ -1137,6 +1134,7 @@ static void cpu_hyp_reinit(void)
 * event was cancelled before the CPU was reset.
 */
__cpu_init_stage2();
+   kvm_timer_init_vhe();
} else {
cpu_init_hyp_mode(NULL);
}
-- 
2.10.1



Re: [PATCH] mm, memory_hotplug: support movable_node for hotplugable nodes

2017-06-11 Thread Michal Hocko
On Sun 11-06-17 09:45:35, Wei Yang wrote:
> On Thu, Jun 08, 2017 at 02:23:18PM +0200, Michal Hocko wrote:
> >From: Michal Hocko 
> >
> >movable_node kernel parameter allows to make hotplugable NUMA
> >nodes to put all the hotplugable memory into movable zone which
> >allows more or less reliable memory hotremove.  At least this
> >is the case for the NUMA nodes present during the boot (see
> >find_zone_movable_pfns_for_nodes).
> >
> >This is not the case for the memory hotplug, though.
> >
> > echo online > /sys/devices/system/memory/memoryXYZ/status
> >
> >will default to a kernel zone (usually ZONE_NORMAL) unless the
> >particular memblock is already in the movable zone range which is not
> >the case normally when onlining the memory from the udev rule context
> >for a freshly hotadded NUMA node. The only option currently is to have a
> >special udev rule to echo online_movable to all memblocks belonging to
> >such a node which is rather clumsy. Not the mention this is inconsistent
> >as well because what ended up in the movable zone during the boot will
> >end up in a kernel zone after hotremove & hotadd without special care.
> >
> 
> A kernel zone here means? Which is the counterpart in zone_type? or a
> combination of several zone_type?

Any zone but < ZONE_HIGHMEM. The specific zone depends on the placement.
But it is ZONE_NORMAL in most situations.


-- 
Michal Hocko
SUSE Labs


WARNING in dev_watchdog

2017-06-11 Thread Dison River
Hi:
I've got the following error report while fuzzing the kernel with
syzkaller on linux-4.11.0-rc3.

log:
WARNING: CPU: 2 PID: 0 at net/sched/sch_generic.c:316
dev_watchdog+0x648/0x770 net/sched/sch_generic.c:315
NETDEV WATCHDOG: eth0 (e1000): transmit queue 0 timed out
Kernel panic - not syncing: panic_on_warn set ...

CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.11.0-rc3 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
Ubuntu-1.8.2-1ubuntu1 04/01/2014
Call Trace:
 
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x95/0xe8 lib/dump_stack.c:52
 panic+0x1ae/0x386 kernel/panic.c:180
 __warn+0x1c4/0x1e0 kernel/panic.c:541
 warn_slowpath_fmt+0xac/0xd0 kernel/panic.c:564
 dev_watchdog+0x648/0x770 net/sched/sch_generic.c:315
 call_timer_fn+0x15b/0x5e0 kernel/time/timer.c:1268
 expire_timers kernel/time/timer.c:1307 [inline]
 __run_timers kernel/time/timer.c:1601 [inline]
 run_timer_softirq+0x5c7/0x1140 kernel/time/timer.c:1614
 __do_softirq+0x217/0x8b7 kernel/softirq.c:284
 invoke_softirq kernel/softirq.c:364 [inline]
 irq_exit+0x198/0x1d0 kernel/softirq.c:405
 exiting_irq arch/x86/include/asm/apic.h:657 [inline]
 smp_apic_timer_interrupt+0x76/0xa0 arch/x86/kernel/apic/apic.c:962
 apic_timer_interrupt+0x90/0xa0 arch/x86/entry/entry_64.S:707
RIP: 0010:native_safe_halt arch/x86/include/asm/irqflags.h:53 [inline]
RIP: 0010:arch_safe_halt arch/x86/include/asm/irqflags.h:95 [inline]
RIP: 0010:default_idle+0x1f/0x2d0 arch/x86/kernel/process.c:275
RSP: 0018:88006dee7e78 EFLAGS: 0246 ORIG_RAX: ff10
RAX: 0007 RBX: 88006de9db40 RCX: 
RDX:  RSI: 0001 RDI: 88006de9e314
RBP: 88006dee7e98 R08: 0040 R09: 
R10:  R11:  R12: 83efc9b8
R13: 88006de9db40 R14: 0002 R15: 88006de9db40
 
 arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:266
 default_idle_call+0x36/0x50 kernel/sched/idle.c:97
 cpuidle_idle_call kernel/sched/idle.c:155 [inline]
 do_idle+0x20b/0x2d0 kernel/sched/idle.c:244
 cpu_startup_entry+0x18/0x20 kernel/sched/idle.c:346
 start_secondary+0x245/0x2d0 arch/x86/kernel/smpboot.c:275
 start_cpu+0x14/0x14 arch/x86/kernel/head_64.S:306
Dumping ftrace buffer:
   (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..


report :


syzkaller login: [   37.041894] [ cut here ]
[   37.042430] WARNING: CPU: 2 PID: 0 at net/sched/sch_generic.c:316
dev_watchdog+0x648/0x770
[   37.042978] NETDEV WATCHDOG: eth0 (e1000): transmit queue 0 timed out
[   37.043405] Kernel panic - not syncing: panic_on_warn set ...
[   37.043405]
[   37.043888] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.11.0-rc3 #2
[   37.044297] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
[   37.044909] Call Trace:
[   37.045080]  
[   37.045226]  dump_stack+0x95/0xe8
[   37.045453]  ? dev_watchdog+0x648/0x770
[   37.045712]  panic+0x1ae/0x386
[   37.045924]  ? percpu_up_read_preempt_enable.constprop.53+0xae/0xae
[   37.046342]  ? dev_watchdog+0x648/0x770
[   37.046605]  ? vprintk_default+0x28/0x30
[   37.046873]  ? dev_watchdog+0x648/0x770
[   37.047114]  __warn+0x1c4/0x1e0
[   37.047820]  warn_slowpath_fmt+0xac/0xd0
[   37.048467]  ? __warn+0x1e0/0x1e0
[   37.048698]  ? dev_watchdog+0x125/0x770
[   37.048963]  dev_watchdog+0x648/0x770
[   37.049218]  call_timer_fn+0x15b/0x5e0
[   37.049475]  ? call_timer_fn+0xcc/0x5e0
[   37.049739]  ? qdisc_rcu_free+0x110/0x110
[   37.050014]  ? process_timeout+0x20/0x20
[   37.050285]  ? trace_hardirqs_on_caller+0x19e/0x580
[   37.053699]  ? qdisc_rcu_free+0x110/0x110
[   37.054931]  ? qdisc_rcu_free+0x110/0x110
[   37.055296]  run_timer_softirq+0x5c7/0x1140
[   37.055949]  ? msleep_interruptible+0x170/0x170
[   37.056671]  ? lapic_timer_shutdown+0x3d/0x50
[   37.057268]  ? clockevents_switch_state+0xe3/0x320
[   37.057837]  __do_softirq+0x217/0x8b7
[   37.058097]  irq_exit+0x198/0x1d0
[   37.058326]  smp_apic_timer_interrupt+0x76/0xa0
[   37.058634]  apic_timer_interrupt+0x90/0xa0
[   37.058921] RIP: 0010:default_idle+0x1f/0x2d0
[   37.059217] RSP: 0018:88006dee7e78 EFLAGS: 0246 ORIG_RAX:
ff10
[   37.059702] RAX: 0007 RBX: 88006de9db40 RCX: 
[   37.060179] RDX:  RSI: 0001 RDI: 88006de9e314
[   37.065968] RBP: 88006dee7e98 R08: 0040 R09: 
[   37.066451] R10:  R11:  R12: 83efc9b8
[   37.073921] R13: 88006de9db40 R14: 0002 R15: 88006de9db40
[   37.074405]  
[   37.074767]  ? default_idle+0x1d/0x2d0
[   37.075026]  arch_cpu_idle+0xa/0x10
[   37.075266]  default_idle_call+0x36/0x50
[   37.075534]  do_idle+0x20b/0x2d0
[   37.075815]  cpu_startup_entry+0x18/0x20
[   37.076084]  start_secondary+0x245/0x2d0
[   37.076352]  start_cpu+0x14/0x14
[   37.077025] Dumping ftrace buffer:
[ 

Re: [PATCH] mm, memory_hotplug: support movable_node for hotplugable nodes

2017-06-11 Thread Michal Hocko
On Sat 10-06-17 22:33:56, Wei Yang wrote:
> On Thu, Jun 08, 2017 at 02:23:18PM +0200, Michal Hocko wrote:
> >From: Michal Hocko 
> >
> >movable_node kernel parameter allows to make hotplugable NUMA
> >nodes to put all the hotplugable memory into movable zone which
> >allows more or less reliable memory hotremove.  At least this
> >is the case for the NUMA nodes present during the boot (see
> >find_zone_movable_pfns_for_nodes).
> >
> >This is not the case for the memory hotplug, though.
> >
> > echo online > /sys/devices/system/memory/memoryXYZ/status
>^^^
> 
> Hmm, one typo I think
> 
> s/status/state/

right! Thanks for spotting that. I guess Andrew can update the changelog
or should I resubmit?


-- 
Michal Hocko
SUSE Labs


[PATCH] watchdog: zx2967: constify zx2967_wdt_ops.

2017-06-11 Thread Arvind Yadav
File size before:
   textdata bss dec hex filename
988 288   01276 4fc drivers/watchdog/zx2967_wdt.o

File size After adding 'const':
   textdata bss dec hex filename
   1084 192   01276 4fc drivers/watchdog/zx2967_wdt.o

Signed-off-by: Arvind Yadav 
---
 drivers/watchdog/zx2967_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/zx2967_wdt.c b/drivers/watchdog/zx2967_wdt.c
index e290d5a..17774de 100644
--- a/drivers/watchdog/zx2967_wdt.c
+++ b/drivers/watchdog/zx2967_wdt.c
@@ -154,7 +154,7 @@ static int zx2967_wdt_keepalive(struct watchdog_device *wdd)
.identity = "zx2967 watchdog",
 };
 
-static struct watchdog_ops zx2967_wdt_ops = {
+static const struct watchdog_ops zx2967_wdt_ops = {
.owner = THIS_MODULE,
.start = zx2967_wdt_start,
.stop = zx2967_wdt_stop,
-- 
1.9.1



Re: Sleeping BUG in khugepaged for i586

2017-06-11 Thread Michal Hocko
On Sun 11-06-17 16:28:11, David Rientjes wrote:
> On Sat, 10 Jun 2017, Michal Hocko wrote:
> 
> > > > I would just pull the cond_resched out of __collapse_huge_page_copy
> > > > right after pte_unmap. But I am not really sure why this cond_resched is
> > > > really needed because the changelog of the patch which adds is is quite
> > > > terse on details.
> > > 
> > > I'm not sure what could possibly be added to the changelog.  We have 
> > > encountered need_resched warnings during the iteration.
> > 
> > Well, the part the changelog is not really clear about is whether the
> > HPAGE_PMD_NR loops itself is the source of the stall. This would be
> > quite surprising because doing 512 iterations taking up to 20+s sounds
> > way to much.
> 
> I have no idea where you come up with 20+ seconds.

OK, I misread your report as a soft lockup.

> These are not soft lockups, these are need_resched warnings.  We monitor 
> how long need_resched has been set and when a thread takes an excessive 
> amount of time to reschedule after it has been set.  A loop of 512 pages 
> with ptl contention and doing {clear,copy}_user_highpage() shows that 
> need_resched can sit without scheduling for an excessive amount of time.

How much is excessive here?
-- 
Michal Hocko
SUSE Labs


Re: [PATCH v3 1/2] DT: pinctrl: Add binding documentation for Spreadtrum pin controller

2017-06-11 Thread Baolin Wang
Hi Rob,

On 五,  6月 09, 2017 at 08:44:20上午 -0500, Rob Herring wrote:
> On Tue, Jun 06, 2017 at 09:03:13PM +0800, Baolin Wang wrote:
> > This patch adds the binding documentation for Spreadtrum SC9860 pin
> > controller device.
> 
> For the subject:  "dt-bindings: pinctrl: Add Spreadtrum SC9860 pin 
> controller"

Ok. Will fix in next version.

> 
> > 
> > Signed-off-by: Baolin Wang 
> > ---
> > Changes since v2:
> >  - No updates.
> > 
> > Changes since v1:
> >  - Remove magic numbers and get to use the standard bindings.
> >  - Fix some typos.
> > ---
> >  .../devicetree/bindings/pinctrl/sprd,pinctrl.txt   |   56 +
> >  .../bindings/pinctrl/sprd,sc9860-pinctrl.txt   |   66 
> > 
> >  2 files changed, 122 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/pinctrl/sprd,pinctrl.txt
> >  create mode 100644 
> > Documentation/devicetree/bindings/pinctrl/sprd,sc9860-pinctrl.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/pinctrl/sprd,pinctrl.txt 
> > b/Documentation/devicetree/bindings/pinctrl/sprd,pinctrl.txt
> > new file mode 100644
> > index 000..2f544cd
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/pinctrl/sprd,pinctrl.txt
> > @@ -0,0 +1,56 @@
> > +* Spreadtrum Pin Controller
> > +
> > +The Spreadtrum pin controller are organized in 3 blocks (types).
> > +
> > +The first block comprises some global control registers, and each
> > +register contains several bit fields with one bit or several bits
> > +to configure for some global common configuration, such as domain
> > +pad driving level, system control select and so on. We recognise
> > +every fields comprising one bit or several bits in one global control
> > +register as one pin, thus we should record every pin's bit offset,
> > +bit width and register offset to configure this field (pin). Since
> > +this type pins' configuration are very tricky and different for each
> > +register, we introduce "sprd,ctrl" property to set the various global
> > +control configuration.
> > +
> > +The second block comprises some common registers which have unified
> > +register definition, and each register described one pin is used
> > +to configure the pin sleep mode and function select. Now we have 4
> > +systems on SC9860 SoC: AP system, PUBCP system, TGLDSP system and
> > +AGDSP system. In some situation we have some pin-sleep related
> > +configuration need to set when one of system goes into deep sleep
> > +mode. For example, if we set the pin sleep mode as AP_SLEEP, which
> > +means when AP system goes into deep sleep mode, this pin's sleep
> > +related properties (input/output or pullup/down) will be set
> > +automatically. Thus we intoduce "sprd,sleep_mode" to set pin sleep
> > +mode.
> > +
> > +The last block comprises some misc registers which also have unified
> > +register definition, and each register described one pin is used to
> > +configure drive strength, pull up/down and so on. Especially for pull
> > +up, we introduce "sprd,pullup" property for two kind configuration:
> > +PULLUP_20K or PULLUP_4_7K, which means the pullup resistor is 20K or
> > +4.7K.
> > +
> > +Required properties for Spreadtrum pin controller:
> > +- compatible: "sprd,-pinctrl"
> > +  Please refer to each sprd,-pinctrl.txt binding doc for supported 
> > SoCs.
> > +- reg: The register address of pin controller device.
> > +- pins : An array of pin names.
> > +
> > +Optional properties:
> > +- function: Specified the function name.
> > +- drive-strength: Drive strength in mA.
> > +- input-schmitt-disable: Enable schmitt-trigger mode.
> > +- input-schmitt-enable: Disable schmitt-trigger mode.
> > +- bias-disable: Disable pin bias.
> > +- bias-pull-down: Pull down on pin.
> > +- sprd,ctrl: Control values referring to databook for global control pins.
> > +- sprd,sleep_mode: Sleep mode selection.
> > +- sprd,pullup: Pull up on pin.
> > +- sprd,input-sleep: Input enable when system goes into deep sleep mode.
> > +- sprd,output-sleep: Output enable when system goes into deep sleep mode.
> > +- sprd,pullup_sleep: Pull up enable when system goes into deep sleep mode.
> > +- sprd,pulldown_sleep: Pull down enable when system goes into deep sleep 
> > mode.
> > +
> > +Please refer to each sprd,-pinctrl.txt binding doc for supported 
> > values.
> > diff --git 
> > a/Documentation/devicetree/bindings/pinctrl/sprd,sc9860-pinctrl.txt 
> > b/Documentation/devicetree/bindings/pinctrl/sprd,sc9860-pinctrl.txt
> > new file mode 100644
> > index 000..10b77e1
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/pinctrl/sprd,sc9860-pinctrl.txt
> > @@ -0,0 +1,66 @@
> > +* Spreadtrum SC9860 Pin Controller
> > +
> > +Please refer to sprd,pinctrl.txt in this directory for common binding part
> > +and usage.
> > +
> > +Required properties:
> > +- compatible: Must be "sprd,sc9860-pinctrl".
> > +- reg: The register address of pin controller device.
> > +- pins : An array of strings, each string containi

[PATCH] watchdog: bcm47xx_wdt: constify bcm47xx_wdt_hard_ops and bcm47xx_wdt_soft_ops

2017-06-11 Thread Arvind Yadav
File size before:
   textdata bss dec hex filename
   1282 388   11671 687 drivers/watchdog/bcm47xx_wdt.o

File size After adding 'const':
   textdata bss dec hex filename
   1474 196   11671 687 drivers/watchdog/bcm47xx_wdt.o

Signed-off-by: Arvind Yadav 
---
 drivers/watchdog/bcm47xx_wdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c
index 35725e2..2365828 100644
--- a/drivers/watchdog/bcm47xx_wdt.c
+++ b/drivers/watchdog/bcm47xx_wdt.c
@@ -97,7 +97,7 @@ static int bcm47xx_wdt_restart(struct watchdog_device *wdd,
return 0;
 }
 
-static struct watchdog_ops bcm47xx_wdt_hard_ops = {
+static const struct watchdog_ops bcm47xx_wdt_hard_ops = {
.owner  = THIS_MODULE,
.start  = bcm47xx_wdt_hard_start,
.stop   = bcm47xx_wdt_hard_stop,
@@ -168,7 +168,7 @@ static int bcm47xx_wdt_soft_set_timeout(struct 
watchdog_device *wdd,
WDIOF_MAGICCLOSE,
 };
 
-static struct watchdog_ops bcm47xx_wdt_soft_ops = {
+static const struct watchdog_ops bcm47xx_wdt_soft_ops = {
.owner  = THIS_MODULE,
.start  = bcm47xx_wdt_soft_start,
.stop   = bcm47xx_wdt_soft_stop,
-- 
1.9.1



Re: [PATCH v10 09/10] powerpc/perf: Thread IMC PMU functions

2017-06-11 Thread Madhavan Srinivasan



On Sunday 11 June 2017 01:43 AM, kbuild test robot wrote:

Hi Anju,

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.12-rc4 next-20170609]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Madhavan-Srinivasan/IMC-Instrumentation-Support/20170609-183528
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
 wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
 chmod +x ~/bin/make.cross
 # save the attached .config to linux build tree
 make.cross ARCH=powerpc

Note: the 
linux-review/Madhavan-Srinivasan/IMC-Instrumentation-Support/20170609-183528 
HEAD 32ada0705ff79986e8ceca5e83dba14c0b620751 builds fine.
   It only hurts bisectibility.

All errors (new ones prefixed by >>):

In file included from include/linux/compiler.h:62:0,
 from include/uapi/linux/stddef.h:1,
 from include/linux/stddef.h:4,
 from include/uapi/linux/posix_types.h:4,
 from include/uapi/linux/types.h:13,
 from include/linux/types.h:5,
 from include/uapi/linux/perf_event.h:17,
 from include/linux/perf_event.h:17,
 from arch/powerpc/perf/imc-pmu.c:13:
arch/powerpc/perf/imc-pmu.c: In function 'cleanup_all_thread_imc_memory':

arch/powerpc/perf/imc-pmu.c:863:31: error: 'cpu' undeclared (first use in this 
function)

Have fixed this issue in the next patch. Damn my bad.
Will wait for comments and if needed can respin just with this.

Maddy


   if (per_cpu(thread_imc_mem, cpu))
   ^
include/linux/compiler-gcc.h:53:26: note: in definition of macro 
'RELOC_HIDE'
  (typeof(ptr)) (__ptr + (off)); \
  ^~~
include/linux/percpu-defs.h:223:2: note: in expansion of macro 
'SHIFT_PERCPU_PTR'
  SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)));   \
  ^~~~
include/linux/percpu-defs.h:223:26: note: in expansion of macro 
'per_cpu_offset'
  SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)));   \
  ^~
include/linux/percpu-defs.h:256:29: note: in expansion of macro 
'per_cpu_ptr'
 #define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
 ^~~
arch/powerpc/perf/imc-pmu.c:863:7: note: in expansion of macro 'per_cpu'
   if (per_cpu(thread_imc_mem, cpu))
   ^~~
arch/powerpc/perf/imc-pmu.c:863:31: note: each undeclared identifier is 
reported only once for each function it appears in
   if (per_cpu(thread_imc_mem, cpu))
   ^
include/linux/compiler-gcc.h:53:26: note: in definition of macro 
'RELOC_HIDE'
  (typeof(ptr)) (__ptr + (off)); \
  ^~~
include/linux/percpu-defs.h:223:2: note: in expansion of macro 
'SHIFT_PERCPU_PTR'
  SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)));   \
  ^~~~
include/linux/percpu-defs.h:223:26: note: in expansion of macro 
'per_cpu_offset'
  SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)));   \
  ^~
include/linux/percpu-defs.h:256:29: note: in expansion of macro 
'per_cpu_ptr'
 #define per_cpu(var, cpu) (*per_cpu_ptr(&(var), cpu))
 ^~~
arch/powerpc/perf/imc-pmu.c:863:7: note: in expansion of macro 'per_cpu'
   if (per_cpu(thread_imc_mem, cpu))
   ^~~

vim +/cpu +863 arch/powerpc/perf/imc-pmu.c

857 
858 static void cleanup_all_thread_imc_memory(void)
859 {
860 int i;
861 
862 for_each_online_cpu(i) {
  > 863  if (per_cpu(thread_imc_mem, cpu))
864 free_pages(per_cpu(thread_imc_mem, cpu), 0);
865 }
866 }

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




Re: [git pull] first batch of ufs fixes

2017-06-11 Thread Al Viro
On Sun, Jun 11, 2017 at 12:47:40PM -0700, Richard Narron wrote:
> 1) Creating an OpenBSD 6.1 (44bsd) disk and then on Linux copying a large >
> 2GB file and creating a directory, there are errors on OpenBSD
> with the fsck:
> 
> OpenBSD (44bsd):
>   #fsck sd0e
>   ** /dev/rsd0e
>   ** File system is already clean
>   ** Last Mounted on /diske
>   ** Phase 1 - Check Blocks and Sizes
>   ** Phase 2 - Check Pathnames
>   ** Phase 3 - Check Connectivity
>   ** Phase 4 - Check Reference Counts
>   ** Phase 5 - Check Cyl groups
>   FREE BLK COUNT(S) WRONG IN SUPERBLK
>   SALVAGE? [Fyn?]
>   3 files, 1272410 used, 6983197 free (13 frags, 872898 blocks, 0.0% 
> fragmentation)
> 
>   * FILE SYSTEM WAS MODIFIED *

Can't reproduce...
# fsck -f /dev/rwd1c
** /dev/rwd1c
** File system is already clean
** Last Mounted on
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
3 files, 1573258 used, 489445 free (13 frags, 61179 blocks, 0.0% fragmentation)
# uname -mrsv
OpenBSD 6.1 GENERIC#19 amd64
# file -s /dev/rwd1c 
/dev/rwd1c: Unix Fast File system [v1] (little-endian), last mounted on , last 
written at Mon Jun 12 06:03:57 2017, clean flag 1, number of blocks 2097152, 
number of data blocks 2062703, number of cylinder groups 21, block size 16384, 
fragment size 2048, minimum percentage of free blocks 5, rotational delay 0ms, 
disk rotational speed 60rps, TIME optimization

That's after
# mkdir /mnt/a; dd if=/dev/zero of=/mnt/a/foo bs=1M count=3072
on the Linux side, with
root@kvm1:~# uname -msrv
Linux 4.12.0-rc1+ #112 SMP Fri Jun 9 17:16:00 EDT 2017 x86_64
there.  -o loop mount on Linux (image living on 9p), direct -hdb ../9p/ufs on 
OpenBSD side
of things (both in KVM on the same host)...

Reproducer would be nice - ideally on the level of "device is this large, newfs 
was with
such and such options, series of operations done on the Linux side after 
mounting that
sucker".


[PATCH 1/2] spi: rockchip: add support for "cs-gpios" dts property

2017-06-11 Thread Jeffy Chen
Support using "cs-gpios" property to specify cs gpios.

Signed-off-by: Jeffy Chen 
---

 .../devicetree/bindings/spi/spi-rockchip.txt   |  2 +
 drivers/spi/spi-rockchip.c | 52 ++
 2 files changed, 54 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/spi-rockchip.txt 
b/Documentation/devicetree/bindings/spi/spi-rockchip.txt
index 83da493..02171b2 100644
--- a/Documentation/devicetree/bindings/spi/spi-rockchip.txt
+++ b/Documentation/devicetree/bindings/spi/spi-rockchip.txt
@@ -17,6 +17,7 @@ Required Properties:
region.
 - interrupts: The interrupt number to the cpu. The interrupt specifier format
   depends on the interrupt controller.
+- cs-gpios : Specifies the gpio pins to be used for chipselects.
 - clocks: Must contain an entry for each entry in clock-names.
 - clock-names: Shall be "spiclk" for the transfer-clock, and "apb_pclk" for
   the peripheral clock.
@@ -48,6 +49,7 @@ Example:
#address-cells = <1>;
#size-cells = <0>;
interrupts = ;
+   cs-gpios = <&gpio2 23 GPIO_ACTIVE_HIGH>;
clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>;
clock-names = "spiclk", "apb_pclk";
pinctrl-0 = <&spi1_pins>;
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index acf31f3..04694e1 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -201,6 +202,10 @@ struct rockchip_spi {
struct dma_slave_caps dma_caps;
 };
 
+struct rockchip_spi_data {
+   bool cs_gpio_requested;
+};
+
 static inline void spi_enable_chip(struct rockchip_spi *rs, int enable)
 {
writel_relaxed((enable ? 1 : 0), rs->regs + ROCKCHIP_SPI_SSIENR);
@@ -297,6 +302,50 @@ static void rockchip_spi_set_cs(struct spi_device *spi, 
bool enable)
pm_runtime_put_sync(rs->dev);
 }
 
+static int rockchip_spi_setup(struct spi_device *spi)
+{
+   int ret = 0;
+   unsigned long flags = (spi->mode & SPI_CS_HIGH) ?
+ GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH;
+   struct rockchip_spi_data *data = spi_get_ctldata(spi);
+
+   if (!gpio_is_valid(spi->cs_gpio))
+   return 0;
+
+   if (!data) {
+   data = kzalloc(sizeof(*data), GFP_KERNEL);
+   if (!data)
+   return -ENOMEM;
+   spi_set_ctldata(spi, data);
+   }
+
+   if (!data->cs_gpio_requested) {
+   ret = gpio_request_one(spi->cs_gpio, flags,
+  dev_name(&spi->dev));
+   if (!ret)
+   data->cs_gpio_requested = 1;
+   } else
+   ret = gpio_direction_output(spi->cs_gpio, flags);
+
+   if (ret < 0)
+   dev_err(&spi->dev, "Failed to setup cs gpio(%d): %d\n",
+   spi->cs_gpio, ret);
+
+   return ret;
+}
+
+static void rockchip_spi_cleanup(struct spi_device *spi)
+{
+   struct rockchip_spi_data *data = spi_get_ctldata(spi);
+
+   if (data) {
+   if (data->cs_gpio_requested)
+   gpio_free(spi->cs_gpio);
+   kfree(data);
+   spi_set_ctldata(spi, NULL);
+   }
+}
+
 static int rockchip_spi_prepare_message(struct spi_master *master,
struct spi_message *msg)
 {
@@ -744,11 +793,14 @@ static int rockchip_spi_probe(struct platform_device 
*pdev)
master->bits_per_word_mask = SPI_BPW_MASK(16) | SPI_BPW_MASK(8);
 
master->set_cs = rockchip_spi_set_cs;
+   master->setup = rockchip_spi_setup;
+   master->cleanup = rockchip_spi_cleanup;
master->prepare_message = rockchip_spi_prepare_message;
master->unprepare_message = rockchip_spi_unprepare_message;
master->transfer_one = rockchip_spi_transfer_one;
master->max_transfer_size = rockchip_spi_max_transfer_size;
master->handle_err = rockchip_spi_handle_err;
+   master->flags = SPI_MASTER_GPIO_SS;
 
rs->dma_tx.ch = dma_request_chan(rs->dev, "tx");
if (IS_ERR(rs->dma_tx.ch)) {
-- 
2.1.4




[PATCH 2/2] arm64: dts: rockchip: use cs-gpios for cros_ec_spi

2017-06-11 Thread Jeffy Chen
The cros_ec requires CS line to be active after last message. But the CS
would be toggled when powering off/on rockchip spi, which breaks ec xfer.
Use GPIO CS to prevent that.

Signed-off-by: Jeffy Chen 

---

 arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi 
b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
index eb50593..329a634 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
@@ -790,6 +790,8 @@ ap_i2c_audio: &i2c8 {
 &spi5 {
status = "okay";
 
+   cs-gpios = <&gpio2 23 GPIO_ACTIVE_HIGH>;
+
cros_ec: ec@0 {
compatible = "google,cros-ec-spi";
reg = <0>;
@@ -813,6 +815,10 @@ ap_i2c_audio: &i2c8 {
};
 };
 
+&spi5_cs0 {
+   rockchip,pins = <2 23 RK_FUNC_GPIO &pcfg_pull_up>;
+};
+
 &tsadc {
status = "okay";
 
-- 
2.1.4




Re: [PATCH v3 1/2] DT: pinctrl: Add binding documentation for Spreadtrum pin controller

2017-06-11 Thread Baolin Wang
Hi Linus,

On 五,  6月 09, 2017 at 01:08:28下午 +0200, Linus Walleij wrote:
> On Tue, Jun 6, 2017 at 3:03 PM, Baolin Wang  
> wrote:
> 
> > This patch adds the binding documentation for Spreadtrum SC9860 pin
> > controller device.
> >
> > Signed-off-by: Baolin Wang 
> > ---
> > Changes since v2:
> >  - No updates.
> 
> Same comments as v3, sorry for my slowness in review :(

It's okay and I understand you are so busy:)

> 
> Yours,
> Linus Walleij


Re: [PATCH v2 1/2] DT: pinctrl: Add binding documentation for Spreadtrum pin controller

2017-06-11 Thread Baolin Wang
Hi Linus,

On 五,  6月 09, 2017 at 01:00:17下午 +0200, Linus Walleij wrote:
> On Mon, Jun 5, 2017 at 2:11 PM, Baolin Wang  
> wrote:
> 
> > This patch adds the binding documentation for Spreadtrum SC9860 pin
> > controller device.
> >
> > Signed-off-by: Baolin Wang 
> 
> Good improvements since last iteration!
> 
> (...)
> 
> > +The Spreadtrum pin controller are organized in 3 blocks (types).
> > +
> > +The first block comprises some global control registers, and each
> > +register contains several bit fields with one bit or several bits
> > +to configure for some global common configuration, such as domain
> > +pad driving level, system control select and so on.
> 
> Insert your explanations about domain pads and system
> control from the other mail here.

OK.

> 
> > + We recognise
> > +every fields comprising one bit or several bits in one global control
> > +register as one pin, thus we should record every pin's bit offset,
> > +bit width and register offset to configure this field (pin). Since
> > +this type pins' configuration are very tricky and different for each
> > +register, we introduce "sprd,ctrl" property to set the various global
> > +control configuration.
> 
> Hm I still don't fully understand this property.

I try to explain these special pins definition on Spreadtrum platform.
This type pins (containing one bit or several bits) are used to configure
various global control, not only domain pad driving level, system control,
and also some other configuration:
EIC (external interrupt controller) source select, debug mode select,
camera pd signal select, camera reset signal select, ADI sync signal
require, watchdog reset select ...

There are too much various configuration that I can not list all of them,
so we can not make every special configuration as one generic configuration,
and maybe it will add more strange globle configuration in future. Then
we add one "sprd,ctrl" (maybe "sprd,control" will be better) to set these
various global control configuration, and we need use magic number for this
property.

> 
> > + In some situation we have some pin-sleep related
> > +configuration need to set when one of system goes into deep sleep
> > +mode. For example, if we set the pin sleep mode as AP_SLEEP, which
> > +means when AP system goes into deep sleep mode, this pin's sleep
> > +related properties (input/output or pullup/down) will be set
> > +automatically. Thus we intoduce "sprd,sleep_mode" to set pin sleep
> > +mode.
> 
> So what you mean is that there is a special register for the sleep
> mode, so that we do not need to write the sleep mode explicitly,
> it will instead hit the hardware automatically when the system
> switches to sleep mode on some global level?

No. Sorry for confusing. What I mean is if we set one pin's sleep mode
as AP_SLEEP, when the AP system goes into deep sleep mode, then the sleep
related configuration of this pin will be set automatically. If we set
the sleep mode as PUBCP_SLEEP, which means when the pubcp system goes into
deep sleep mode, this pin's sleep related configuration will be set.

The sleep related configuration of one pin are described (need modify as
you pointed) as below:
- sprd,input-sleep: Input enable when system goes into deep sleep mode.
- sprd,output-sleep: Output enable when system goes into deep sleep mode.
- sprd,pullup_sleep: Pull up enable when system goes into deep sleep mode.
- sprd,pulldown_sleep: Pull down enable when system goes into deep sleep mode.

So if we set one pin's sleep related configuration, we also should choose
the sleep mode (means which system).

> 
> Please detail this.
> 
> This is not a spreadtrum-specific feature. Look for example in:
> include/dt-bindings/pinctrl/nomadik.h
> 
> We have things like this:
> 
> #define SLPM_DISABLED   0
> #define SLPM_ENABLED1
> #define SLPM_INPUT_NOPULL   0
> #define SLPM_INPUT_PULLUP   1
> #define SLPM_INPUT_PULLDOWN 2
> #define SLPM_DIR_INPUT  3
> #define SLPM_OUTPUT_LOW 0
> #define SLPM_OUTPUT_HIGH1
> #define SLPM_DIR_OUTPUT 2
> #define SLPM_WAKEUP_DISABLE 0
> #define SLPM_WAKEUP_ENABLE  1
> 
> These (also custom) properties predate the generic pin config,
> and that is why it was done like this.
> 
> But moving forward, we may need to think about coming up with
> something generic for this.
> 
> I think this kind of overlaps the pin control states "default"
> and "sleep".
> 
> What we want to do is read out both "default" and "sleep" modes
> from the device tree and program *both* into the hardware
> when "default" is normally initialized.
> 
> This is better, because then the device tree looks the same
> whether we use hardware-backed switch from "default" to
> "sleep" and back or not.
> 
> I don't know how to do this practically unfortunately, it may need
> some modifications of the pin control core code so that drivers
> can get the "sleep" mode configuration out and program it.

Yes, I think these "sle

[PATCH v2 2/2] arm64: dts: uniphier: add support for LD20 Global board

2017-06-11 Thread Kunihiko Hayashi
Add initial device tree support for LD20 Global board.

Signed-off-by: Kunihiko Hayashi 
---
 arch/arm64/boot/dts/socionext/Makefile |  1 +
 .../boot/dts/socionext/uniphier-ld20-global.dts| 52 ++
 2 files changed, 53 insertions(+)
 create mode 100644 arch/arm64/boot/dts/socionext/uniphier-ld20-global.dts

diff --git a/arch/arm64/boot/dts/socionext/Makefile 
b/arch/arm64/boot/dts/socionext/Makefile
index 8d07ee3..4a13a3a 100644
--- a/arch/arm64/boot/dts/socionext/Makefile
+++ b/arch/arm64/boot/dts/socionext/Makefile
@@ -1,6 +1,7 @@
 dtb-$(CONFIG_ARCH_UNIPHIER) += \
uniphier-ld11-global.dtb \
uniphier-ld11-ref.dtb \
+   uniphier-ld20-global.dtb \
uniphier-ld20-ref.dtb
 
 always := $(dtb-y)
diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20-global.dts 
b/arch/arm64/boot/dts/socionext/uniphier-ld20-global.dts
new file mode 100644
index 000..9f620d4
--- /dev/null
+++ b/arch/arm64/boot/dts/socionext/uniphier-ld20-global.dts
@@ -0,0 +1,52 @@
+/*
+ * Device Tree Source for UniPhier LD20 Global Board
+ *
+ * Copyright (C) 2015-2017 Socionext Inc.
+ *   Author: Masahiro Yamada 
+ *   Kunihiko Hayashi 
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+/dts-v1/;
+/include/ "uniphier-ld20.dtsi"
+
+/ {
+   model = "UniPhier LD20 Global Board (REF_LD20_GP)";
+   compatible = "socionext,uniphier-ld20-global",
+"socionext,uniphier-ld20";
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   aliases {
+   serial0 = &serial0;
+   serial1 = &serial1;
+   serial2 = &serial2;
+   serial3 = &serial3;
+   i2c0 = &i2c0;
+   i2c1 = &i2c1;
+   i2c2 = &i2c2;
+   i2c3 = &i2c3;
+   i2c4 = &i2c4;
+   i2c5 = &i2c5;
+   };
+
+   memory@8000 {
+   device_type = "memory";
+   reg = <0 0x8000 0 0xc000>;
+   };
+};
+
+&serial0 {
+   status = "okay";
+};
+
+&serial1 {
+   status = "okay";
+};
+
+&i2c0 {
+   status = "okay";
+};
-- 
2.7.4



[PATCH v2 1/2] arm64: dts: uniphier: add support for LD11 Global board

2017-06-11 Thread Kunihiko Hayashi
Add initial device tree support for LD11 Global board.

Signed-off-by: Kunihiko Hayashi 
---
 arch/arm64/boot/dts/socionext/Makefile |  1 +
 .../boot/dts/socionext/uniphier-ld11-global.dts| 70 ++
 2 files changed, 71 insertions(+)
 create mode 100644 arch/arm64/boot/dts/socionext/uniphier-ld11-global.dts

diff --git a/arch/arm64/boot/dts/socionext/Makefile 
b/arch/arm64/boot/dts/socionext/Makefile
index 5538598..8d07ee3 100644
--- a/arch/arm64/boot/dts/socionext/Makefile
+++ b/arch/arm64/boot/dts/socionext/Makefile
@@ -1,4 +1,5 @@
 dtb-$(CONFIG_ARCH_UNIPHIER) += \
+   uniphier-ld11-global.dtb \
uniphier-ld11-ref.dtb \
uniphier-ld20-ref.dtb
 
diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld11-global.dts 
b/arch/arm64/boot/dts/socionext/uniphier-ld11-global.dts
new file mode 100644
index 000..1153570
--- /dev/null
+++ b/arch/arm64/boot/dts/socionext/uniphier-ld11-global.dts
@@ -0,0 +1,70 @@
+/*
+ * Device Tree Source for UniPhier LD11 Global Board
+ *
+ * Copyright (C) 2016-2017 Socionext Inc.
+ *   Author: Masahiro Yamada 
+ *   Kunihiko Hayashi 
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+/dts-v1/;
+/include/ "uniphier-ld11.dtsi"
+
+/ {
+   model = "UniPhier LD11 Global Board (REF_LD11_GP)";
+   compatible = "socionext,uniphier-ld11-global",
+"socionext,uniphier-ld11";
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   aliases {
+   serial0 = &serial0;
+   serial1 = &serial1;
+   serial2 = &serial2;
+   serial3 = &serial3;
+   i2c0 = &i2c0;
+   i2c1 = &i2c1;
+   i2c2 = &i2c2;
+   i2c3 = &i2c3;
+   i2c4 = &i2c4;
+   i2c5 = &i2c5;
+   };
+
+   memory@8000 {
+   device_type = "memory";
+   reg = <0 0x8000 0 0x4000>;
+   };
+};
+
+&serial0 {
+   status = "okay";
+};
+
+&serial1 {
+   status = "okay";
+};
+
+&i2c0 {
+   status = "okay";
+
+   eeprom@50 {
+   compatible = "st,24c64", "atmel,24c64";
+   reg = <0x50>;
+   pagesize = <32>;
+   };
+};
+
+&usb0 {
+   status = "okay";
+};
+
+&usb1 {
+   status = "okay";
+};
+
+&usb2 {
+   status = "okay";
+};
-- 
2.7.4



[PATCH v2 0/2] add support for LD20/11 Global boards

2017-06-11 Thread Kunihiko Hayashi
Initial version of device tree for LD20/11 Global boards.

---

Changes in v2:
- use SPDX-License-Identifier for the license description
- add the atmel manufacturer to the compatible string for I2C EEPROM

Kunihiko Hayashi (2):
  arm64: dts: uniphier: add support for LD11 Global board
  arm64: dts: uniphier: add support for LD20 Global board

 arch/arm64/boot/dts/socionext/Makefile |  2 +
 .../boot/dts/socionext/uniphier-ld11-global.dts| 70 ++
 .../boot/dts/socionext/uniphier-ld20-global.dts| 52 
 3 files changed, 124 insertions(+)
 create mode 100644 arch/arm64/boot/dts/socionext/uniphier-ld11-global.dts
 create mode 100644 arch/arm64/boot/dts/socionext/uniphier-ld20-global.dts

-- 
2.7.4



[PATCH] mfd: cros_ec: Add missing free_irq in cros_ec_remove

2017-06-11 Thread Jeffy Chen
Signed-off-by: Jeffy Chen 

---

 drivers/mfd/cros_ec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
index e31ac60..dc6ce90 100644
--- a/drivers/mfd/cros_ec.c
+++ b/drivers/mfd/cros_ec.c
@@ -183,6 +183,9 @@ int cros_ec_remove(struct cros_ec_device *ec_dev)
 
cros_ec_acpi_remove_gpe_handler();
 
+   if (ec_dev->irq)
+   free_irq(ec_dev->irq, ec_dev);
+
return 0;
 }
 EXPORT_SYMBOL(cros_ec_remove);
-- 
2.1.4




[PATCH v2] drm/sun4i: hdmi: Implement I2C adapter for A10s DDC bus

2017-06-11 Thread Jonathan Liu
The drm_get_edid function should be used instead of drm_do_get_edid by
exposing the DDC bus as an I2C adapter. Implement this for A10s.

Signed-off-by: Jonathan Liu 
---
Changes for v2:
 - Rebased against Maxime's sunxi-drm/for-next branch
 - Fix up error paths in sun4i_hdmi_bind so that the I2C adapter is deleted if
   any of the calls after the I2C adapter is created fails
 - Remove unnecessary includes in sun4i_hdmi_i2c.c

 drivers/gpu/drm/sun4i/Makefile |   1 +
 drivers/gpu/drm/sun4i/sun4i_hdmi.h |  11 ++-
 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 103 +++--
 drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c | 163 +
 4 files changed, 189 insertions(+), 89 deletions(-)
 create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c

diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
index e29fd3a2ba9c..43c753cafc88 100644
--- a/drivers/gpu/drm/sun4i/Makefile
+++ b/drivers/gpu/drm/sun4i/Makefile
@@ -2,6 +2,7 @@ sun4i-drm-y += sun4i_drv.o
 sun4i-drm-y += sun4i_framebuffer.o
 
 sun4i-drm-hdmi-y += sun4i_hdmi_enc.o
+sun4i-drm-hdmi-y += sun4i_hdmi_i2c.o
 sun4i-drm-hdmi-y += sun4i_hdmi_ddc_clk.o
 sun4i-drm-hdmi-y += sun4i_hdmi_tmds_clk.o
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h 
b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
index 2f2f2ff1ea63..4c01dbe89cd9 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
@@ -97,6 +97,7 @@
 #define SUN4I_HDMI_DDC_CTRL_START_CMD  BIT(30)
 #define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_MASK  BIT(8)
 #define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_READ  (0 << 8)
+#define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_WRITE (1 << 8)
 #define SUN4I_HDMI_DDC_CTRL_RESET  BIT(0)
 
 #define SUN4I_HDMI_DDC_ADDR_REG0x504
@@ -105,6 +106,10 @@
 #define SUN4I_HDMI_DDC_ADDR_OFFSET(off)(((off) & 0xff) << 8)
 #define SUN4I_HDMI_DDC_ADDR_SLAVE(addr)((addr) & 0xff)
 
+#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_REG0x50c
+#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_FIFO_REQUEST   BIT(4)
+#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_TRANSFER_COMPLETE  BIT(0)
+
 #define SUN4I_HDMI_DDC_FIFO_CTRL_REG   0x510
 #define SUN4I_HDMI_DDC_FIFO_CTRL_CLEAR BIT(31)
 
@@ -112,7 +117,8 @@
 #define SUN4I_HDMI_DDC_BYTE_COUNT_REG  0x51c
 
 #define SUN4I_HDMI_DDC_CMD_REG 0x520
-#define SUN4I_HDMI_DDC_CMD_EXPLICIT_EDDC_READ  6
+#define SUN4I_HDMI_DDC_CMD_IMPLICIT_WRITE  3
+#define SUN4I_HDMI_DDC_CMD_IMPLICIT_READ   5
 
 #define SUN4I_HDMI_DDC_CLK_REG 0x528
 #define SUN4I_HDMI_DDC_CLK_M(m)(((m) & 0x7) << 3)
@@ -146,6 +152,8 @@ struct sun4i_hdmi {
struct clk  *ddc_clk;
struct clk  *tmds_clk;
 
+   struct i2c_adapter  *i2c;
+
struct sun4i_drv*drv;
 
boolhdmi_monitor;
@@ -153,5 +161,6 @@ struct sun4i_hdmi {
 
 int sun4i_ddc_create(struct sun4i_hdmi *hdmi, struct clk *clk);
 int sun4i_tmds_create(struct sun4i_hdmi *hdmi);
+int sun4i_hdmi_i2c_create(struct sun4i_hdmi *hdmi);
 
 #endif /* _SUN4I_HDMI_H_ */
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c 
b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index d3398f6250ef..2a8c0b14eabc 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -29,8 +29,6 @@
 #include "sun4i_hdmi.h"
 #include "sun4i_tcon.h"
 
-#define DDC_SEGMENT_ADDR   0x30
-
 static inline struct sun4i_hdmi *
 drm_encoder_to_sun4i_hdmi(struct drm_encoder *encoder)
 {
@@ -184,93 +182,13 @@ static const struct drm_encoder_funcs sun4i_hdmi_funcs = {
.destroy= drm_encoder_cleanup,
 };
 
-static int sun4i_hdmi_read_sub_block(struct sun4i_hdmi *hdmi,
-unsigned int blk, unsigned int offset,
-u8 *buf, unsigned int count)
-{
-   unsigned long reg;
-   int i;
-
-   reg = readl(hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
-   reg &= ~SUN4I_HDMI_DDC_CTRL_FIFO_DIR_MASK;
-   writel(reg | SUN4I_HDMI_DDC_CTRL_FIFO_DIR_READ,
-  hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
-
-   writel(SUN4I_HDMI_DDC_ADDR_SEGMENT(offset >> 8) |
-  SUN4I_HDMI_DDC_ADDR_EDDC(DDC_SEGMENT_ADDR << 1) |
-  SUN4I_HDMI_DDC_ADDR_OFFSET(offset) |
-  SUN4I_HDMI_DDC_ADDR_SLAVE(DDC_ADDR),
-  hdmi->base + SUN4I_HDMI_DDC_ADDR_REG);
-
-   reg = readl(hdmi->base + SUN4I_HDMI_DDC_FIFO_CTRL_REG);
-   writel(reg | SUN4I_HDMI_DDC_FIFO_CTRL_CLEAR,
-  hdmi->base + SUN4I_HDMI_DDC_FIFO_CTRL_REG);
-
-   writel(count, hdmi->base + SUN4I_HDMI_DDC_BYTE_COUNT_REG);
-   writel(SUN4I_HDMI_DDC_CMD_EXPLICIT_EDDC_READ,
-  hdmi->base + SUN4I_HDMI_DDC_CMD_REG);
-
-   reg = readl(hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
-   writel(reg | SUN4I_HDMI_DDC_CTRL_START_CMD,
-  hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
-
-   if (readl_poll_time

Re: [PATCH] drm/sun4i: hdmi: Implement I2C adapter for A10s DDC bus

2017-06-11 Thread Jonathan Liu
Hi Chen-Yu,

On 12 June 2017 at 13:28, Chen-Yu Tsai  wrote:
> On Mon, Jun 12, 2017 at 10:12 AM, Jonathan Liu  wrote:
>> The drm_get_edid function should be used instead of drm_do_get_edid by
>> exposing the DDC bus as an I2C adapter. Implement this for A10s.
>
> Nice!

It is my first Linux kernel driver so there may be other things I have
overlooked. I am not sure about the behaviour of I2C writes larger
than 16 bytes but the EEPROMs I have tested only have a write buffer
of 8 bytes so writes are limited to a maximum of 8 bytes at a time
anyway.

>
>>
>> Signed-off-by: Jonathan Liu 
>> ---
>>  drivers/gpu/drm/sun4i/Makefile |   1 +
>>  drivers/gpu/drm/sun4i/sun4i_hdmi.h |  11 ++-
>>  drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c |  96 +++
>>  drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c | 166 
>> +
>>  4 files changed, 190 insertions(+), 84 deletions(-)
>>  create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c
>>
>> diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
>> index e29fd3a2ba9c..43c753cafc88 100644
>> --- a/drivers/gpu/drm/sun4i/Makefile
>> +++ b/drivers/gpu/drm/sun4i/Makefile
>> @@ -2,6 +2,7 @@ sun4i-drm-y += sun4i_drv.o
>>  sun4i-drm-y += sun4i_framebuffer.o
>>
>>  sun4i-drm-hdmi-y += sun4i_hdmi_enc.o
>> +sun4i-drm-hdmi-y += sun4i_hdmi_i2c.o
>>  sun4i-drm-hdmi-y += sun4i_hdmi_ddc_clk.o
>>  sun4i-drm-hdmi-y += sun4i_hdmi_tmds_clk.o
>>
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h 
>> b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
>> index 2589bc92be59..8e7a70f67f04 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h
>> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
>> @@ -100,6 +100,7 @@
>>  #define SUN4I_HDMI_DDC_CTRL_START_CMD  BIT(30)
>>  #define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_MASK  BIT(8)
>>  #define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_READ  (0 << 8)
>> +#define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_WRITE (1 << 8)
>>  #define SUN4I_HDMI_DDC_CTRL_RESET  BIT(0)
>>
>>  #define SUN4I_HDMI_DDC_ADDR_REG0x504
>> @@ -108,6 +109,10 @@
>>  #define SUN4I_HDMI_DDC_ADDR_OFFSET(off)(((off) & 0xff) << 8)
>>  #define SUN4I_HDMI_DDC_ADDR_SLAVE(addr)((addr) & 0xff)
>>
>> +#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_REG0x50c
>> +#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_FIFO_REQUEST   BIT(4)
>> +#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_TRANSFER_COMPLETE  BIT(0)
>> +
>>  #define SUN4I_HDMI_DDC_FIFO_CTRL_REG   0x510
>>  #define SUN4I_HDMI_DDC_FIFO_CTRL_CLEAR BIT(31)
>>
>> @@ -115,7 +120,8 @@
>>  #define SUN4I_HDMI_DDC_BYTE_COUNT_REG  0x51c
>>
>>  #define SUN4I_HDMI_DDC_CMD_REG 0x520
>> -#define SUN4I_HDMI_DDC_CMD_EXPLICIT_EDDC_READ  6
>> +#define SUN4I_HDMI_DDC_CMD_IMPLICIT_WRITE  3
>> +#define SUN4I_HDMI_DDC_CMD_IMPLICIT_READ   5
>>
>>  #define SUN4I_HDMI_DDC_CLK_REG 0x528
>>  #define SUN4I_HDMI_DDC_CLK_M(m)(((m) & 0x7) << 3)
>> @@ -181,6 +187,8 @@ struct sun4i_hdmi {
>> struct clk  *ddc_clk;
>> struct clk  *tmds_clk;
>>
>> +   struct i2c_adapter  *i2c;
>> +
>> struct sun4i_drv*drv;
>>
>> boolhdmi_monitor;
>> @@ -192,5 +200,6 @@ int sun4i_ddc_create(struct sun4i_hdmi *hdmi, struct clk 
>> *clk);
>>  int sun6i_ddc_create(struct sun4i_hdmi *hdmi, struct clk *clk);
>>  int sun4i_tmds_create(struct sun4i_hdmi *hdmi);
>>  int sun6i_tmds_create(struct sun4i_hdmi *hdmi);
>> +int sun4i_hdmi_i2c_create(struct sun4i_hdmi *hdmi);
>
> However you seem to have based it on the wrong branch/patches.
> You based them on my A31 HDMI patches, instead of what Maxime has
> in his sunxi-drm/for-next branch.
>
> I could add this to my A31 patches, though it probably won't make
> 4.13. Alternatively you could rebase them on top of Maxime's branch.

Yes, I forgot about that. I will rebase against sunxi-drm/for-next for V2.

>
>>
>>  #endif /* _SUN4I_HDMI_H_ */
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c 
>> b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
>> index e9abf93eb41c..6c9b11c4cf68 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
>> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
>> @@ -186,93 +186,13 @@ static const struct drm_encoder_funcs sun4i_hdmi_funcs 
>> = {
>> .destroy= drm_encoder_cleanup,
>>  };
>>
>> -static int sun4i_hdmi_read_sub_block(struct sun4i_hdmi *hdmi,
>> -unsigned int blk, unsigned int offset,
>> -u8 *buf, unsigned int count)
>> -{
>> -   unsigned long reg;
>> -   int i;
>> -
>> -   reg = readl(hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
>> -   reg &= ~SUN4I_HDMI_DDC_CTRL_FIFO_DIR_MASK;
>> -   writel(reg | SUN4I_HDMI_DDC_CTRL_FIFO_DIR_READ,
>> -  hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
>> -
>> -   writel(SUN4I_HDMI_DDC_ADDR_SEGMENT(offset >> 8) |
>> -  SUN4I_HDMI_DDC_ADDR_EDDC(DDC_SEGMENT_ADDR << 1)

RE: [REGRESSION] Touchpad failure after e7348396c6d5 ("Input: ALPS - fix V8+ protocol handling (73 03 28)")

2017-06-11 Thread Masaki Ota
Hi, Laura,

Could you try to check below modification?
https://bugzilla.kernel.org/show_bug.cgi?id=195215#c10

This thread person said, the issue was fixed by this change.
I guess it's a XY coordinate setting problem, though the code that before the 
patch is applied also has a problem.

Best Regards,
Masaki Ota
-Original Message-
From: Laura Abbott [mailto:labb...@redhat.com] 
Sent: Wednesday, June 07, 2017 1:59 AM
To: Paul Donohue 
Cc: 太田 真喜 Masaki Ota ; Dmitry Torokhov 
; Pali Rohar ; Nick Fletcher 
; linux-in...@vger.kernel.org; 
linux-kernel@vger.kernel.org; scott.s.l...@gmail.com
Subject: Re: [REGRESSION] Touchpad failure after e7348396c6d5 ("Input: ALPS - 
fix V8+ protocol handling (73 03 28)")

On 06/02/2017 09:03 PM, Paul Donohue wrote:
> This might be related to 
> https://bugzilla.kernel.org/show_bug.cgi?id=195215
> 
> Could you have the user try this change? 
> https://bugzilla.kernel.org/show_bug.cgi?id=195215#c12
> 

https://bugzilla.redhat.com/show_bug.cgi?id=1447327#c13

"Cursor movement seems to work, but there are intermittent two-finger scrolling 
issues on the right-hand side of the touchpad. There are no issues with cursor 
movement or two-finger scrolling on the left-hand side of the touchpad."

> On Fri, Jun 02, 2017 at 10:54:52AM -0700, Laura Abbott wrote:
>> Hi,
>>
>> Fedora got a bug report 
>> https://bugzilla.redhat.com/show_bug.cgi?id=1447327
>> of a touchpad failure on a Dell Latitude E7370. Testing showed that 
>> the bad commit was
>>
>> commit e7348396c6d51b57c95c6646c390cd078e038e19
>> Author: Masaki Ota 
>> Date:   Fri Mar 17 14:10:57 2017 -0700
>>
>> Input: ALPS - fix V8+ protocol handling (73 03 28)
>> 
>> Devices identified as E7="73 03 28" use slightly modified version of V8
>> protocol, with lower count per electrode, different offsets, and 
>> different
>> feature bits in OTP data.
>> 
>> Fixes: aeaa881f9b17 ("Input: ALPS - set DualPoint flag for 74 03 28 
>> devices")
>> Signed-off-by: Masaki Ota 
>> Acked-by: Pali Rohar 
>> Tested-by: Paul Donohue 
>> Tested-by: Nick Fletcher 
>> Cc: sta...@vger.kernel.org
>> Signed-off-by: Dmitry Torokhov 
>>
>> I suspect this particular model needs special handling as well?
>>
>> Thanks,
>> Laura
>>



Re: [LKP] [lkp-robot] [EDAC, sb_edac] e2f747b1f4: kmsg.EDAC_sbridge:Failed_to_register_device_with_error

2017-06-11 Thread Ye Xiaolong
On 06/12, Ye Xiaolong wrote:
>On 06/10, Zhuo, Qiuxu wrote:
>>> From: Borislav Petkov [mailto:b...@alien8.de] 
>>>
>>> Xiaolong,
>>>
>>> can you please run Qiuxu's patch to verify it fixes your issue?
>>
>>
>>Hi Boris,
>>I manually verified the fix patch on the Broadwell-DE server on which the 
>> bug was found by Xiaolong: 
>>the sb_edac can be loaded successfully, and it identified which size and 
>> type of DIMMs were installed
>>in each slot correctly (see attached dmesg.sb_edac.on.Broadwell-DE.log).
>>
>>Hi Xiaolong,
>>   Would you please also test the patch by your LKP method by which the issue 
>> was found last time.
>>
>
>Got it, I've queued test jobs for your fix patch, will let you know the result
>once I get the it.

Confirmed the error is gone with qiuxu's fix patch.


Tested-by: From: Ye Xiaolong 

Thanks,
Xiaolong
>
>Thanks,
>Xiaolong
>
>
>>Thanks!
>>
>>BR
>>Qiuxu 
>>
>>
>>
>
>
>___
>LKP mailing list
>l...@lists.01.org
>https://lists.01.org/mailman/listinfo/lkp


[RFC 5/7] zram: identify asynchronous IO's return value

2017-06-11 Thread Minchan Kim
For upcoming asynchronous IO like writeback, zram_rw_page should
be aware of that whether requested IO was completed or submitted
successfully, otherwise error.

For the goal, zram_bvec_rw has three return values.

-errno: returns error number
 0: IO request is done synchronously
 1: IO request is issued successfully.

Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 32 
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index d82914e..f5924ef 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -897,7 +897,7 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec 
*bvec,
 
 static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 
index)
 {
-   int ret;
+   int ret = 0;
struct zram_entry *uninitialized_var(entry);
unsigned int uninitialized_var(comp_len);
void *src, *dst, *mem;
@@ -1014,7 +1014,7 @@ static int __zram_bvec_write(struct zram *zram, struct 
bio_vec *bvec, u32 index)
zram_slot_unlock(zram, index);
atomic64_inc(&zram->stats.pages_stored);
 
-   return 0;
+   return ret;
 }
 
 static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec,
@@ -1096,6 +1096,11 @@ static void zram_bio_discard(struct zram *zram, u32 
index,
}
 }
 
+/*
+ * Returns errno if it has some problem. Otherwise return 0 or 1.
+ * Returns 0 if IO request was done synchronously
+ * Returns 1 if IO request was successfully submitted.
+ */
 static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
int offset, bool is_write)
 {
@@ -1117,7 +1122,7 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec 
*bvec, u32 index,
 
generic_end_io_acct(rw_acct, &zram->disk->part0, start_time);
 
-   if (unlikely(ret)) {
+   if (unlikely(ret < 0)) {
if (!is_write)
atomic64_inc(&zram->stats.failed_reads);
else
@@ -1210,7 +1215,7 @@ static void zram_slot_free_notify(struct block_device 
*bdev,
 static int zram_rw_page(struct block_device *bdev, sector_t sector,
   struct page *page, bool is_write)
 {
-   int offset, err = -EIO;
+   int offset, ret;
u32 index;
struct zram *zram;
struct bio_vec bv;
@@ -1219,7 +1224,7 @@ static int zram_rw_page(struct block_device *bdev, 
sector_t sector,
 
if (!valid_io_request(zram, sector, PAGE_SIZE)) {
atomic64_inc(&zram->stats.invalid_io);
-   err = -EINVAL;
+   ret = -EINVAL;
goto out;
}
 
@@ -1230,7 +1235,7 @@ static int zram_rw_page(struct block_device *bdev, 
sector_t sector,
bv.bv_len = PAGE_SIZE;
bv.bv_offset = 0;
 
-   err = zram_bvec_rw(zram, &bv, index, offset, is_write);
+   ret = zram_bvec_rw(zram, &bv, index, offset, is_write);
 out:
/*
 * If I/O fails, just return error(ie, non-zero) without
@@ -1240,9 +1245,20 @@ static int zram_rw_page(struct block_device *bdev, 
sector_t sector,
 * bio->bi_end_io does things to handle the error
 * (e.g., SetPageError, set_page_dirty and extra works).
 */
-   if (err == 0)
+   if (unlikely(ret < 0))
+   return ret;
+
+   switch (ret) {
+   case 0:
page_endio(page, is_write, 0);
-   return err;
+   break;
+   case 1:
+   ret = 0;
+   break;
+   default:
+   WARN_ON(1);
+   }
+   return ret;
 }
 
 static void zram_reset_device(struct zram *zram)
-- 
2.7.4



[RFC 4/7] zram: add free space management in backing device

2017-06-11 Thread Minchan Kim
With backing device, zram needs management of free space of
backing device.
This patch adds bitmap logic to manage free space which is
very naive. However, it would be simple enough as considering
uncompressible pages's frequenty in zram.

Signed-off-by: Minchan Kim 
---
 drivers/block/zram/Kconfig| 13 
 drivers/block/zram/zram_drv.c | 48 ++-
 drivers/block/zram/zram_drv.h |  3 +++
 3 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig
index 2f3dd1f..f2ca2b5 100644
--- a/drivers/block/zram/Kconfig
+++ b/drivers/block/zram/Kconfig
@@ -27,3 +27,16 @@ config ZRAM_DEDUP
  computation time trade-off. Please check the benefit before
  enabling this option. Experiment shows the positive effect when
  the zram is used as blockdev and is used to store build output.
+
+config ZRAM_WRITEBACK
+   bool "Write back incompressible page to backing device"
+   depends on ZRAM
+   default n
+   help
+ With incompressible page, there is no memory saving to keep it
+ in memory. Instead, write it out to backing device.
+ For this feature, admin should set up backing device via
+ /sys/block/zramX/backing_dev.
+
+ See zram.txt for more infomration.
+
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index dcb6f83..d82914e 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -298,6 +298,9 @@ static void reset_bdev(struct zram *zram)
zram->backing_dev = NULL;
zram->old_block_size = 0;
zram->bdev = NULL;
+
+   kvfree(zram->bitmap);
+   zram->bitmap = NULL;
 }
 
 static ssize_t backing_dev_show(struct device *dev,
@@ -337,7 +340,8 @@ static ssize_t backing_dev_store(struct device *dev,
struct file *backing_dev = NULL;
struct inode *inode;
struct address_space *mapping;
-   unsigned int old_block_size = 0;
+   unsigned int bitmap_sz, old_block_size = 0;
+   unsigned long nr_pages, *bitmap = NULL;
struct block_device *bdev = NULL;
int err;
size_t sz;
@@ -388,16 +392,27 @@ static ssize_t backing_dev_store(struct device *dev,
if (err < 0)
goto out;
 
+   nr_pages = i_size_read(inode) >> PAGE_SHIFT;
+   bitmap_sz = BITS_TO_LONGS(nr_pages) * sizeof(long);
+   bitmap = kvzalloc(bitmap_sz, GFP_KERNEL);
+   if (!bitmap) {
+   err = -ENOMEM;
+   goto out;
+   }
+
old_block_size = block_size(bdev);
err = set_blocksize(bdev, PAGE_SIZE);
if (err)
goto out;
 
reset_bdev(zram);
+   spin_lock_init(&zram->bitmap_lock);
 
zram->old_block_size = old_block_size;
zram->bdev = bdev;
zram->backing_dev = backing_dev;
+   zram->bitmap = bitmap;
+   zram->nr_pages = nr_pages;
up_write(&zram->init_lock);
 
pr_info("setup backing device %s\n", file_name);
@@ -407,6 +422,9 @@ static ssize_t backing_dev_store(struct device *dev,
 
return len;
 out:
+   if (bitmap)
+   kvfree(bitmap);
+
if (bdev)
blkdev_put(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL);
 
@@ -422,6 +440,34 @@ static ssize_t backing_dev_store(struct device *dev,
return err;
 }
 
+static unsigned long get_entry_bdev(struct zram *zram)
+{
+   unsigned long entry;
+
+   spin_lock(&zram->bitmap_lock);
+   /* skip 0 bit to confuse zram.handle = 0 */
+   entry = find_next_zero_bit(zram->bitmap, zram->nr_pages, 1);
+   if (entry == zram->nr_pages) {
+   spin_unlock(&zram->bitmap_lock);
+   return 0;
+   }
+
+   set_bit(entry, zram->bitmap);
+   spin_unlock(&zram->bitmap_lock);
+
+   return entry;
+}
+
+static void put_entry_bdev(struct zram *zram, unsigned long entry)
+{
+   int was_set;
+
+   spin_lock(&zram->bitmap_lock);
+   was_set = test_and_clear_bit(entry, zram->bitmap);
+   spin_unlock(&zram->bitmap_lock);
+   WARN_ON_ONCE(!was_set);
+}
+
 #else
 static bool zram_wb_enabled(struct zram *zram) { return false; }
 static void reset_bdev(struct zram *zram) {};
diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
index 5193bcb..8ae3b3f 100644
--- a/drivers/block/zram/zram_drv.h
+++ b/drivers/block/zram/zram_drv.h
@@ -140,6 +140,9 @@ struct zram {
struct file *backing_dev;
struct block_device *bdev;
unsigned int old_block_size;
+   unsigned long *bitmap;
+   unsigned long nr_pages;
+   spinlock_t bitmap_lock;
 #endif
 };
 
-- 
2.7.4



[RFC 0/7] writeback incompressible pages to storage

2017-06-11 Thread Minchan Kim
zRam is useful for memory saving with compressible pages but sometime,
workload can be changed and system has lots of incompressible pages
which is very harmful for zram.

This patch supports writeback feature of zram so admin can set up
a block device and with it, zram can save the memory via writing
out the incompressile pages once it found it's incompressible pages
(1/4 comp ratio) instead of keeping the page in memory.

[1,2] is just clean up and [3-7] is step by step feature enablement.
[3-7] is logically not bisectable(ie, logical unit separation)
although I tried to compiled out without breaking but I think it would
be better to review.

Thanks.

Minchan Kim (7):
  [1] zram: inlining zram_compress
  [2] zram: rename zram_decompress_page with __zram_bvec_read
  [3] zram: add interface to specify backing device
  [4] zram: add free space management in backing device
  [5] zram: identify asynchronous IO's return value
  [6] zram: write incompressible pages to backing device
  [7] zram: read page from backing device

 drivers/block/zram/Kconfig|  13 +
 drivers/block/zram/zram_drv.c | 549 --
 drivers/block/zram/zram_drv.h |   9 +
 3 files changed, 500 insertions(+), 71 deletions(-)

-- 
2.7.4



[RFC 1/7] zram: inlining zram_compress

2017-06-11 Thread Minchan Kim
zram_compress does several things, compress, entry alloc and check
limitation. I did for just readbility but it hurts modulization.:(
So this patch removes zram_compress functions and inline it in
__zram_bvec_write for upcoming patches.

Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 81 +--
 1 file changed, 31 insertions(+), 50 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 5440d1a..bed534e 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -692,22 +692,45 @@ static int zram_bvec_read(struct zram *zram, struct 
bio_vec *bvec,
return ret;
 }
 
-static int zram_compress(struct zram *zram, struct zcomp_strm **zstrm,
-   struct page *page, struct zram_entry **out_entry,
-   unsigned int *out_comp_len)
+static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 
index)
 {
int ret;
-   unsigned int comp_len;
-   void *src;
+   struct zram_entry *uninitialized_var(entry);
+   unsigned int uninitialized_var(comp_len);
+   void *src, *dst, *mem;
+   struct zcomp_strm *zstrm;
+   struct page *page = bvec->bv_page;
+   u32 checksum;
+   enum zram_pageflags flags = 0;
+   unsigned long uninitialized_var(element);
unsigned long alloced_pages;
-   struct zram_entry *entry = NULL;
+
+   mem = kmap_atomic(page);
+   if (page_same_filled(mem, &element)) {
+   kunmap_atomic(mem);
+   /* Free memory associated with this sector now. */
+   flags = ZRAM_SAME;
+   atomic64_inc(&zram->stats.same_pages);
+   goto out;
+   }
+   kunmap_atomic(mem);
+
+   entry = zram_dedup_find(zram, page, &checksum);
+   if (entry) {
+   comp_len = entry->len;
+   flags = ZRAM_DUP;
+   atomic64_add(comp_len, &zram->stats.dup_data_size);
+   goto out;
+   }
 
 compress_again:
+   zstrm = zcomp_stream_get(zram->comp);
src = kmap_atomic(page);
-   ret = zcomp_compress(*zstrm, src, &comp_len);
+   ret = zcomp_compress(zstrm, src, &comp_len);
kunmap_atomic(src);
 
if (unlikely(ret)) {
+   zcomp_stream_put(zram->comp);
pr_err("Compression failed! err=%d\n", ret);
if (entry)
zram_entry_free(zram, entry);
@@ -742,7 +765,6 @@ static int zram_compress(struct zram *zram, struct 
zcomp_strm **zstrm,
entry = zram_entry_alloc(zram, comp_len,
GFP_NOIO | __GFP_HIGHMEM |
__GFP_MOVABLE);
-   *zstrm = zcomp_stream_get(zram->comp);
if (entry)
goto compress_again;
return -ENOMEM;
@@ -752,52 +774,11 @@ static int zram_compress(struct zram *zram, struct 
zcomp_strm **zstrm,
update_used_max(zram, alloced_pages);
 
if (zram->limit_pages && alloced_pages > zram->limit_pages) {
+   zcomp_stream_put(zram->comp);
zram_entry_free(zram, entry);
return -ENOMEM;
}
 
-   *out_entry = entry;
-   *out_comp_len = comp_len;
-   return 0;
-}
-
-static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 
index)
-{
-   int ret;
-   struct zram_entry *uninitialized_var(entry);
-   unsigned int uninitialized_var(comp_len);
-   void *src, *dst, *mem;
-   struct zcomp_strm *zstrm;
-   struct page *page = bvec->bv_page;
-   u32 checksum;
-   enum zram_pageflags flags = 0;
-   unsigned long uninitialized_var(element);
-
-   mem = kmap_atomic(page);
-   if (page_same_filled(mem, &element)) {
-   kunmap_atomic(mem);
-   /* Free memory associated with this sector now. */
-   flags = ZRAM_SAME;
-   atomic64_inc(&zram->stats.same_pages);
-   goto out;
-   }
-   kunmap_atomic(mem);
-
-   entry = zram_dedup_find(zram, page, &checksum);
-   if (entry) {
-   comp_len = entry->len;
-   flags = ZRAM_DUP;
-   atomic64_add(comp_len, &zram->stats.dup_data_size);
-   goto out;
-   }
-
-   zstrm = zcomp_stream_get(zram->comp);
-   ret = zram_compress(zram, &zstrm, page, &entry, &comp_len);
-   if (ret) {
-   zcomp_stream_put(zram->comp);
-   return ret;
-   }
-
dst = zs_map_object(zram->mem_pool,
zram_entry_handle(zram, entry), ZS_MM_WO);
 
-- 
2.7.4



Re: [PATCH 0/6] Constant Time Memory Comparisons Are Important

2017-06-11 Thread Emmanuel Grumbach
On Mon, Jun 12, 2017 at 12:30 AM, Emil Lenngren  wrote:
> 2017-06-11 22:48 GMT+02:00 Emmanuel Grumbach :
>> On Sun, Jun 11, 2017 at 4:36 PM, Kees Cook  wrote:
>>>
>>> On Sun, Jun 11, 2017 at 1:13 AM, Kalle Valo  wrote:
>>> > "Jason A. Donenfeld"  writes:
>>> >
>>> >> Whenever you're comparing two MACs, it's important to do this using
>>> >> crypto_memneq instead of memcmp. With memcmp, you leak timing 
>>> >> information,
>>> >> which could then be used to iteratively forge a MAC.
>>> >
>>> > Do you have any pointers where I could learn more about this?
>>>
>>> While not using C specifically, this talks about the problem generally:
>>> https://www.chosenplaintext.ca/articles/beginners-guide-constant-time-cryptography.html
>>>
>>
>> Sorry for the stupid question, but the MAC address is in plaintext in
>> the air anyway or easily accessible via user space tools. I fail to
>> see what it is so secret about a MAC address in that code where that
>> same MAC address is accessible via myriads of ways.
>
> I think you're mixing up Media Access Control (MAC) addresses with
> Message Authentication Code (MAC). The second one is a cryptographic
> signature of a message.

Obviously... Sorry for the noise.


[RFC 6/7] zram: write incompressible pages to backing device

2017-06-11 Thread Minchan Kim
This patch enables write IO to transfer data to backing device.
For that, it implements write_to_bdev function which creates
new bio and chaining with parent bio to make the parent bio
asynchrnous.
For rw_page which don't have parent bio, it submit owned bio
and handle IO completion by zram_page_end_io.

Also, this patch defines new flag ZRAM_WB to mark written page
for later read IO.

Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 108 ++
 drivers/block/zram/zram_drv.h |   1 +
 2 files changed, 99 insertions(+), 10 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index f5924ef..9b0db9b 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -468,9 +468,75 @@ static void put_entry_bdev(struct zram *zram, unsigned 
long entry)
WARN_ON_ONCE(!was_set);
 }
 
+void zram_page_end_io(struct bio *bio)
+{
+   struct page *page = bio->bi_io_vec[0].bv_page;
+
+   page_endio(page, op_is_write(bio_op(bio)), bio->bi_error);
+   bio_put(bio);
+}
+
+static int write_to_bdev(struct zram *zram, struct bio_vec *bvec,
+   u32 index, struct bio *parent,
+   unsigned long *pentry)
+{
+   struct bio *bio;
+   unsigned long entry;
+
+   bio = bio_alloc(GFP_ATOMIC, 1);
+   if (!bio)
+   return -ENOMEM;
+
+   entry = get_entry_bdev(zram);
+   if (!entry) {
+   bio_put(bio);
+   return -ENOSPC;
+   }
+
+   bio->bi_iter.bi_sector = entry * (PAGE_SIZE >> 9);
+   bio->bi_bdev = zram->bdev;
+   if (!bio_add_page(bio, bvec->bv_page, bvec->bv_len,
+   bvec->bv_offset)) {
+   bio_put(bio);
+   put_entry_bdev(zram, entry);
+   return -EIO;
+   }
+
+   if (!parent) {
+   bio->bi_opf = REQ_OP_WRITE | REQ_SYNC;
+   bio->bi_end_io = zram_page_end_io;
+   } else {
+   bio->bi_opf = parent->bi_opf;
+   bio_chain(bio, parent);
+   }
+
+   submit_bio(bio);
+   *pentry = entry;
+
+   return 0;
+}
+
+static void zram_wb_clear(struct zram *zram, u32 index)
+{
+   unsigned long entry;
+
+   zram_clear_flag(zram, index, ZRAM_WB);
+   entry = zram_get_element(zram, index);
+   zram_set_element(zram, index, 0);
+   put_entry_bdev(zram, entry);
+}
+
 #else
 static bool zram_wb_enabled(struct zram *zram) { return false; }
 static void reset_bdev(struct zram *zram) {};
+static int write_to_bdev(struct zram *zram, struct bio_vec *bvec,
+   u32 index, struct bio *parent,
+   unsigned long *pentry)
+
+{
+   return -EIO;
+}
+static void zram_wb_clear(struct zram *zram, u32 index) {}
 #endif
 
 
@@ -789,7 +855,15 @@ static bool zram_meta_alloc(struct zram *zram, u64 
disksize)
  */
 static void zram_free_page(struct zram *zram, size_t index)
 {
-   struct zram_entry *entry = zram_get_entry(zram, index);
+   struct zram_entry *uninitialized_var(entry);
+
+   if (zram_wb_enabled(zram) && zram_test_flag(zram, index, ZRAM_WB)) {
+   zram_wb_clear(zram, index);
+   atomic64_dec(&zram->stats.pages_stored);
+   return;
+   }
+
+   entry = zram_get_entry(zram, index);
 
/*
 * No memory is allocated for same element filled pages.
@@ -895,7 +969,8 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec 
*bvec,
return ret;
 }
 
-static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 
index)
+static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec,
+   u32 index, struct bio *bio)
 {
int ret = 0;
struct zram_entry *uninitialized_var(entry);
@@ -907,6 +982,7 @@ static int __zram_bvec_write(struct zram *zram, struct 
bio_vec *bvec, u32 index)
enum zram_pageflags flags = 0;
unsigned long uninitialized_var(element);
unsigned long alloced_pages;
+   bool allow_wb = true;
 
mem = kmap_atomic(page);
if (page_same_filled(mem, &element)) {
@@ -940,8 +1016,20 @@ static int __zram_bvec_write(struct zram *zram, struct 
bio_vec *bvec, u32 index)
return ret;
}
 
-   if (unlikely(comp_len > max_zpage_size))
+   if (unlikely(comp_len > max_zpage_size)) {
+   if (zram_wb_enabled(zram) && allow_wb) {
+   zcomp_stream_put(zram->comp);
+   ret = write_to_bdev(zram, bvec, index, bio, &element);
+   if (!ret) {
+   flags = ZRAM_WB;
+   ret = 1;
+   goto out;
+   }
+   allow_wb = false;
+   goto compress_again;
+   

[RFC 3/7] zram: add interface to specify backing device

2017-06-11 Thread Minchan Kim
For writeback feature, user should set up backing device before
the zram working. This patch enables the interface via
/sys/block/zramX/backing_dev.

Currently, it supports block device only but it could be enhanced
for file as well.

Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 163 ++
 drivers/block/zram/zram_drv.h |   5 ++
 2 files changed, 168 insertions(+)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index a0c304b..dcb6f83 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -271,6 +271,163 @@ static ssize_t mem_used_max_store(struct device *dev,
return len;
 }
 
+#ifdef CONFIG_ZRAM_WRITEBACK
+static bool zram_wb_enabled(struct zram *zram)
+{
+   return zram->backing_dev;
+}
+
+static void reset_bdev(struct zram *zram)
+{
+   struct inode *inode;
+   struct address_space *mapping;
+   struct block_device *bdev;
+
+   if (!zram_wb_enabled(zram))
+   return;
+
+   mapping = zram->backing_dev->f_mapping;
+   inode = mapping->host;
+   bdev = I_BDEV(inode);
+
+   if (zram->old_block_size)
+   set_blocksize(bdev, zram->old_block_size);
+   blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
+   /* hope filp_close flush all of IO */
+   filp_close(zram->backing_dev, NULL);
+   zram->backing_dev = NULL;
+   zram->old_block_size = 0;
+   zram->bdev = NULL;
+}
+
+static ssize_t backing_dev_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct zram *zram = dev_to_zram(dev);
+   struct file *file = zram->backing_dev;
+   char *p;
+   ssize_t ret;
+
+   down_read(&zram->init_lock);
+   if (!zram_wb_enabled(zram)) {
+   memcpy(buf, "none\n", 5);
+   up_read(&zram->init_lock);
+   return 5;
+   }
+
+   p = file_path(file, buf, PAGE_SIZE - 1);
+   if (IS_ERR(p)) {
+   ret = PTR_ERR(p);
+   goto out;
+   }
+
+   ret = strlen(p);
+   memmove(buf, p, ret);
+   buf[ret++] = '\n';
+out:
+   up_read(&zram->init_lock);
+   return ret;
+}
+
+static ssize_t backing_dev_store(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t len)
+{
+   char *file_name;
+   struct filename *name = NULL;
+   struct file *backing_dev = NULL;
+   struct inode *inode;
+   struct address_space *mapping;
+   unsigned int old_block_size = 0;
+   struct block_device *bdev = NULL;
+   int err;
+   size_t sz;
+   struct zram *zram = dev_to_zram(dev);
+
+   file_name = kmalloc(PATH_MAX, GFP_KERNEL);
+   if (!file_name)
+   return -ENOMEM;
+
+   down_write(&zram->init_lock);
+   if (init_done(zram)) {
+   pr_info("Can't setup backing device for initialized device\n");
+   err = -EBUSY;
+   goto out;
+   }
+
+   strlcpy(file_name, buf, len);
+   /* ignore trailing newline */
+   sz = strlen(file_name);
+   if (sz > 0 && file_name[sz - 1] == '\n')
+   file_name[sz - 1] = 0x00;
+
+   name = getname_kernel(file_name);
+   if (IS_ERR(name)) {
+   err = PTR_ERR(name);
+   name = NULL;
+   goto out;
+   }
+
+   backing_dev = file_open_name(name, O_RDWR|O_LARGEFILE, 0);
+   if (IS_ERR(backing_dev)) {
+   err = PTR_ERR(backing_dev);
+   backing_dev = NULL;
+   goto out;
+   }
+
+   mapping = backing_dev->f_mapping;
+   inode = mapping->host;
+
+   /* Support only block device in this moment */
+   if (!S_ISBLK(inode->i_mode)) {
+   err = -ENOTBLK;
+   goto out;
+   }
+
+   bdev = bdgrab(I_BDEV(inode));
+   err = blkdev_get(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL, zram);
+   if (err < 0)
+   goto out;
+
+   old_block_size = block_size(bdev);
+   err = set_blocksize(bdev, PAGE_SIZE);
+   if (err)
+   goto out;
+
+   reset_bdev(zram);
+
+   zram->old_block_size = old_block_size;
+   zram->bdev = bdev;
+   zram->backing_dev = backing_dev;
+   up_write(&zram->init_lock);
+
+   pr_info("setup backing device %s\n", file_name);
+
+   putname(name);
+   kfree(file_name);
+
+   return len;
+out:
+   if (bdev)
+   blkdev_put(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL);
+
+   if (backing_dev)
+   filp_close(backing_dev, NULL);
+
+   if (name)
+   putname(name);
+   up_write(&zram->init_lock);
+
+   kfree(file_name);
+
+   return err;
+}
+
+#else
+static bool zram_wb_enabled(struct zram *zram) { return false; }
+static void reset_bdev(struct zram *zram) {};
+#endif
+
+
 /*
  * We switched to per-cpu streams and this attr is not needed anymore.
  * How

Re: [PATCH] fs: fcntl, avoid undefined behaviour

2017-06-11 Thread zhong jiang
On 2016/10/14 17:23, Jiri Slaby wrote:
> fcntl(0, F_SETOWN, 0x8000) triggers:
> UBSAN: Undefined behaviour in fs/fcntl.c:118:7
> negation of -2147483648 cannot be represented in type 'int':
> CPU: 1 PID: 18261 Comm: syz-executor Not tainted 4.8.1-0-syzkaller #1
> ...
> Call Trace:
> ...
>  [] ? f_setown+0x1d8/0x200
>  [] ? SyS_fcntl+0x999/0xf30
>  [] ? entry_SYSCALL_64_fastpath+0x23/0xc1
>
> Fix that by checking the arg parameter properly (against INT_MAX) and
> return immediatelly in case it is wrong. No error is returned, the
> same as in other cases.
>
> Signed-off-by: Jiri Slaby 
> Cc: Jeff Layton 
> Cc: "J. Bruce Fields" 
> Cc: Alexander Viro 
> Cc: linux-fsde...@vger.kernel.org
> ---
>  fs/fcntl.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/fs/fcntl.c b/fs/fcntl.c
> index 350a2c8cfd28..bfc3b040d956 100644
> --- a/fs/fcntl.c
> +++ b/fs/fcntl.c
> @@ -112,6 +112,10 @@ void f_setown(struct file *filp, unsigned long arg, int 
> force)
>   enum pid_type type;
>   struct pid *pid;
>   int who = arg;
> +
> + if (arg > INT_MAX)
> + return;
> +
>   type = PIDTYPE_PID;
>   if (who < 0
>   type = PIDTYPE_PGID;
Hi, Jiri

I hit the same issue,  but I see the upstream is still not changed.  Had any 
problem?

Thanks
zhongjiang



[RFC 7/7] zram: read page from backing device

2017-06-11 Thread Minchan Kim
This patch enables read IO from backing device. For the feature,
it implements two IO read functions to transfer data from backing
storage.

One is asynchronous IO function and other is synchronous one.

A reason I need synchrnous IO is due to partial write which need to
complete read IO before the overwriting partial data.

We can make the partial IO's case asynchronous, too but at the moment,
I don't feel adding more complexity to support such rare use cases
so want to go with simple.

Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 123 --
 1 file changed, 118 insertions(+), 5 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 9b0db9b..d9eb6df 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -476,6 +476,95 @@ void zram_page_end_io(struct bio *bio)
bio_put(bio);
 }
 
+/*
+ * Returns 0 if the submission is successful.
+ */
+static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
+   unsigned long entry, struct bio *parent)
+{
+   struct bio *bio;
+
+   bio = bio_alloc(GFP_ATOMIC, 1);
+   if (!bio)
+   return -ENOMEM;
+
+   bio->bi_iter.bi_sector = entry * (PAGE_SIZE >> 9);
+   bio->bi_bdev = zram->bdev;
+   if (!bio_add_page(bio, bvec->bv_page, bvec->bv_len, bvec->bv_offset)) {
+   bio_put(bio);
+   return -EIO;
+   }
+
+   if (!parent) {
+   bio->bi_opf = REQ_OP_READ;
+   bio->bi_end_io = zram_page_end_io;
+   } else {
+   bio->bi_opf = parent->bi_opf;
+   bio_chain(bio, parent);
+   }
+
+   submit_bio(bio);
+   return 1;
+}
+
+struct zram_work {
+   struct work_struct work;
+   struct zram *zram;
+   unsigned long entry;
+   struct bio *bio;
+};
+
+#if PAGE_SIZE != 4096
+static void zram_sync_read(struct work_struct *work)
+{
+   struct bio_vec bvec;
+   struct zram_work *zw = container_of(work, struct zram_work, work);
+   struct zram *zram = zw->zram;
+   unsigned long entry = zw->entry;
+   struct bio *bio = zw->bio;
+
+   read_from_bdev_async(zram, &bvec, entry, bio);
+}
+
+/*
+ * Block layer want one ->make_request_fn to be active at a time
+ * so if we use chained IO with parent IO in same context,
+ * it's a deadlock. To avoid, it, it uses worker thread context.
+ */
+static int read_from_bdev_sync(struct zram *zram, struct bio_vec *bvec,
+   unsigned long entry, struct bio *bio)
+{
+   struct zram_work work;
+
+   work.zram = zram;
+   work.entry = entry;
+   work.bio = bio;
+
+   INIT_WORK_ONSTACK(&work.work, zram_sync_read);
+   queue_work(system_unbound_wq, &work.work);
+   flush_work(&work.work);
+   destroy_work_on_stack(&work.work);
+
+   return 1;
+}
+#else
+static int read_from_bdev_sync(struct zram *zram, struct bio_vec *bvec,
+   unsigned long entry, struct bio *bio)
+{
+   WARN_ON(1);
+   return -EIO;
+}
+#endif
+
+static int read_from_bdev(struct zram *zram, struct bio_vec *bvec,
+   unsigned long entry, struct bio *parent, bool sync)
+{
+   if (sync)
+   return read_from_bdev_sync(zram, bvec, entry, parent);
+   else
+   return read_from_bdev_async(zram, bvec, entry, parent);
+}
+
 static int write_to_bdev(struct zram *zram, struct bio_vec *bvec,
u32 index, struct bio *parent,
unsigned long *pentry)
@@ -536,6 +625,12 @@ static int write_to_bdev(struct zram *zram, struct bio_vec 
*bvec,
 {
return -EIO;
 }
+
+static int read_from_bdev(struct zram *zram, struct bio_vec *bvec,
+   unsigned long entry, struct bio *parent, bool sync)
+{
+   return -EIO;
+}
 static void zram_wb_clear(struct zram *zram, u32 index) {}
 #endif
 
@@ -897,13 +992,31 @@ static void zram_free_page(struct zram *zram, size_t 
index)
zram_set_obj_size(zram, index, 0);
 }
 
-static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index)
+static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index,
+   struct bio *bio, bool partial_io)
 {
int ret;
struct zram_entry *entry;
unsigned int size;
void *src, *dst;
 
+   if (zram_wb_enabled(zram)) {
+   zram_slot_lock(zram, index);
+   if (zram_test_flag(zram, index, ZRAM_WB)) {
+   struct bio_vec bvec;
+
+   zram_slot_unlock(zram, index);
+
+   bvec.bv_page = page;
+   bvec.bv_len = PAGE_SIZE;
+   bvec.bv_offset = 0;
+   return read_from_bdev(zram, &bvec,
+   zram_get_element(zram, index),
+

[RFC 2/7] zram: rename zram_decompress_page with __zram_bvec_read

2017-06-11 Thread Minchan Kim
zram_decompress_page naming is not proper because it doesn't
decompress if page was dedup hit or stored with compression.
Use more abstract term and consistent with write path function
 __zram_bvec_write.

Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index bed534e..a0c304b 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -620,7 +620,7 @@ static void zram_free_page(struct zram *zram, size_t index)
zram_set_obj_size(zram, index, 0);
 }
 
-static int zram_decompress_page(struct zram *zram, struct page *page, u32 
index)
+static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index)
 {
int ret;
struct zram_entry *entry;
@@ -673,7 +673,7 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec 
*bvec,
return -ENOMEM;
}
 
-   ret = zram_decompress_page(zram, page, index);
+   ret = __zram_bvec_read(zram, page, index);
if (unlikely(ret))
goto out;
 
@@ -833,7 +833,7 @@ static int zram_bvec_write(struct zram *zram, struct 
bio_vec *bvec,
if (!page)
return -ENOMEM;
 
-   ret = zram_decompress_page(zram, page, index);
+   ret = __zram_bvec_read(zram, page, index);
if (ret)
goto out;
 
-- 
2.7.4



Re: [PATCH] mm, memory_hotplug: support movable_node for hotplugable nodes

2017-06-11 Thread Wei Yang
On Thu, Jun 08, 2017 at 02:23:18PM +0200, Michal Hocko wrote:
>From: Michal Hocko 
>
>movable_node kernel parameter allows to make hotplugable NUMA
>nodes to put all the hotplugable memory into movable zone which
>allows more or less reliable memory hotremove.  At least this
>is the case for the NUMA nodes present during the boot (see
>find_zone_movable_pfns_for_nodes).
>

When movable_node is enabled, we would have overlapped zones, right?
To be specific, only ZONE_MOVABLE could have memory ranges belongs to other
zones.

This looks a little different in the whole ZONE design.

>This is not the case for the memory hotplug, though.
>
>   echo online > /sys/devices/system/memory/memoryXYZ/status
>
>will default to a kernel zone (usually ZONE_NORMAL) unless the
>particular memblock is already in the movable zone range which is not
^^^

Here is memblock or a memory_block?

>the case normally when onlining the memory from the udev rule context
>for a freshly hotadded NUMA node. The only option currently is to have a

So the semantic you want to change here is to make the memory_block in
ZONE_MOVABLE when movable_node is enabled.

Besides this, movable_node is enabled, what other requirements? Like, this
memory_block should next to current ZONE_MOVABLE ? or something else?

>special udev rule to echo online_movable to all memblocks belonging to
>such a node which is rather clumsy. Not the mention this is inconsistent
 ^^^

Hmm... "Not to mentions" looks more understandable.

BTW, I am not a native speaker. If this usage is correct, just ignore this
comment.

>as well because what ended up in the movable zone during the boot will
>end up in a kernel zone after hotremove & hotadd without special care.
>
>It would be nice to reuse memblock_is_hotpluggable but the runtime
>hotplug doesn't have that information available because the boot and
>hotplug paths are not shared and it would be really non trivial to
>make them use the same code path because the runtime hotplug doesn't
>play with the memblock allocator at all.
>
>Teach move_pfn_range that MMOP_ONLINE_KEEP can use the movable zone if
>movable_node is enabled and the range doesn't overlap with the existing
>normal zone. This should provide a reasonable default onlining strategy.
>
>Strictly speaking the semantic is not identical with the boot time
>initialization because find_zone_movable_pfns_for_nodes covers only the
>hotplugable range as described by the BIOS/FW. From my experience this
>is usually a full node though (except for Node0 which is special and
>never goes away completely). If this turns out to be a problem in the
>real life we can tweak the code to store hotplug flag into memblocks
>but let's keep this simple now.
>

Let me try to understand your purpose of this change.

If a memblock has MEMBLOCK_HOTPLU set, it would be in ZONE_MOVABLE during
bootup. While a hotplugged memory_block would be in ZONE_NORMAL without
special care.

So you want to make sure when movable_node is enabled, the hotplugged
memory_block would be in ZONE_MOVABLE. Is this correct?

One more thing is do we have MEMBLOCK_HOTPLU for a hotplugged memory_block?

>Signed-off-by: Michal Hocko 
>---
>

-- 
Wei Yang
Help you, Help me


signature.asc
Description: PGP signature


Quick Loans

2017-06-11 Thread Financial Services Pvt Ltd
Apply for a loan at 3% reply to this Email for more Info


Re: [PATCH 1/3] mm: add vm_insert_mixed_mkwrite()

2017-06-11 Thread Ross Zwisler
On Fri, Jun 09, 2017 at 08:35:08PM -0700, Dan Williams wrote:
> On Fri, Jun 9, 2017 at 8:03 PM, Ross Zwisler
>  wrote:
> > And vm_insert_mixed_mkwrite() and vm_insert_mixed() are redundant with only
> > the insert_pfn() line differing?  This doesn't seem better...unless I'm
> > missing something?
> >
> > The way it is, vm_insert_mixed_mkwrite() also closely matches
> > insert_pfn_pmd(), which we use in the PMD case and which also takes a 
> > 'write'
> > boolean which works the same as our newly added 'mkwrite'.
> 
> Hmm, but now the pfn and pmd cases are inconsistent, if you put the
> flag name in the function then don't add an argument, or make it like
> the pmd case and add an argument to vm_insert_mixed(). I prefer the
> former.

Okay, I'll fix this for v2.  Thanks for the review.


Re: [PATCH 2/3] cpufreq: schedutil: Fix selection algorithm while reducing frequency

2017-06-11 Thread Viresh Kumar
On 10-06-17, 23:21, Joel Fernandes wrote:
> On Sat, Jun 10, 2017 at 2:11 AM, Joel Fernandes  wrote:
> > On Fri, Jun 9, 2017 at 3:15 AM, Viresh Kumar  
> > wrote:
> >> While reducing frequency if there are no frequencies available between
> >> "current" and "next" calculated frequency, then the core will never
> >> select the "next" frequency.
> >>
> >> For example, consider the possible range of frequencies as 900 MHz, 1
> >> GHz, 1.1 GHz, and 1.2 GHz. If the current frequency is 1.1 GHz and the
> >> next frequency (based on current utilization) is 1 GHz, then the
> >> schedutil governor will try to set the average of these as the next
> >> frequency (i.e. 1.05 GHz).
> >>
> >> Because we always try to find the lowest frequency greater than equal to
> >> the target frequency, cpufreq_driver_resolve_freq() will end up
> >> returning 1.1 GHz only. And we will not be able to reduce the frequency
> >> eventually. The worst hit is the policy->min frequency as that will
> >> never get selected after the frequency is increased once.
> >
> > But once utilization goes to 0, it will select the min frequency
> > (because it selects lowest frequency >= target)?
> 
> Never mind my comment about util 0, I see the problem you mention.
> However I feel that this entire series adds complexity all to handle
> the case of a false cache-miss which I think might not be that bad,
> and the tradeoff with complexity/readability of the code kind of
> negates the benefit. That's just my opinion about it fwiw.

Right and that's why I said in the cover letter that we may want to revert the
offending commit for the time being as the solutions provided here have too much
dependency on the resolve_freq() callback.

-- 
viresh


[PATCH] i2c: ismt: fix wrong device address when unmap the data buffer

2017-06-11 Thread Song liwei
From: Liwei Song 

Fix the following calltrace:

kernel BUG at drivers/iommu/intel-iommu.c:3260!
invalid opcode:  [#5] PREEMPT SMP
Hardware name: Intel Corp. Harcuvar/Server, BIOS 
HAVLCRB0.X64.0013.D39.1608311820 08/31/2016
task: 880175389950 ti: 880176bec000 task.ti: 880176bec000
RIP: 0010:[]  [] intel_unmap+0x25b/0x260
RSP: 0018:880176bef5e8  EFLAGS: 00010296
RAX: 0024 RBX: 8800773c7c88 RCX: ce04
RDX: 8000 RSI:  RDI: 0009
RBP: 880176bef638 R08: 0010 R09: 0004
R10: 880175389c78 R11: 0a4f R12: 8800773c7868
R13: ac88 R14: 8800773c7818 R15: 0001
FS:  7fef21258700() GS:88017b5c() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 0066d6d8 CR3: 7118c000 CR4: 003406e0
Stack:
 ac88 8199867f 880176bef5f8 88010030
 880176bef668 8800773c7c88 880178288098 8800772c0010
 8800773c7818 0001 880176bef648 8150a86e
Call Trace:
 [] ? printk+0x46/0x48
 [] intel_unmap_page+0xe/0x10
 [] ismt_access+0x27b/0x8fa [i2c_ismt]
 [] ? __pm_runtime_suspend+0xa0/0xa0
 [] ? pm_suspend_timer_fn+0x80/0x80
 [] ? __pm_runtime_suspend+0xa0/0xa0
 [] ? pm_suspend_timer_fn+0x80/0x80
 [] ? pci_bus_read_dev_vendor_id+0xf0/0xf0
 [] i2c_smbus_xfer+0xec/0x4b0
 [] ? vprintk_emit+0x345/0x530
 [] i2cdev_ioctl_smbus+0x12b/0x240 [i2c_dev]
 [] ? vprintk_default+0x29/0x40
 [] i2cdev_ioctl+0x63/0x1ec [i2c_dev]
 [] do_vfs_ioctl+0x328/0x5d0
 [] ? vfs_write+0x11c/0x190
 [] ? rt_up_read+0x19/0x20
 [] SyS_ioctl+0x81/0xa0
 [] system_call_fastpath+0x16/0x6e

This happen When run "i2cdetect -y 0" detect SMBus iSMT adapter.

After finished I2C block read/write, when unmap the data buffer,
a wrong device address was pass to dma_unmap_single(), the right
device address should be "dev" not "&adap->dev", the relation is
*(&adap->dev) == dev. When come into Intel IOMMU routine, the wrong
devices address was operated.

To fix this, give dma_unmap_single() the "dev" parameter, just like
what dma_map_single() does, then unmap can find the right devices.

Signed-off-by: Liwei Song 
---
 drivers/i2c/busses/i2c-ismt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c
index 1db3e0d..605d44e 100644
--- a/drivers/i2c/busses/i2c-ismt.c
+++ b/drivers/i2c/busses/i2c-ismt.c
@@ -585,7 +585,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,
 
/* unmap the data buffer */
if (dma_size != 0)
-   dma_unmap_single(&adap->dev, dma_addr, dma_size, dma_direction);
+   dma_unmap_single(dev, dma_addr, dma_size, dma_direction);
 
if (unlikely(!time_left)) {
dev_err(dev, "completion wait timed out\n");
-- 
2.7.4



[PATCH] drm: panel: fix s6e3ha2.c build errors

2017-06-11 Thread Randy Dunlap
From: Randy Dunlap 

Fix build errors in panel-samsung-s6e3ha2.c driver build. The driver
uses backlight interfaces so it should depend on BACKLIGHT_CLASS_DEVICE.

drivers/built-in.o: In function `s6e3ha2_remove':
panel-samsung-s6e3ha2.c:(.text+0xe49c2): undefined reference to 
`backlight_device_unregister'
drivers/built-in.o: In function `s6e3ha2_probe':
panel-samsung-s6e3ha2.c:(.text+0xe4dad): undefined reference to 
`backlight_device_register'
panel-samsung-s6e3ha2.c:(.text+0xe4e33): undefined reference to 
`backlight_device_unregister'

Reported-by: kbuild test robot 
Signed-off-by: Randy Dunlap 
Cc: David Airlie 
Cc: dri-de...@lists.freedesktop.org
Cc: Hoegeun Kwon 
---
 drivers/gpu/drm/panel/Kconfig |1 +
 1 file changed, 1 insertion(+)

--- lnx-412-rc5.orig/drivers/gpu/drm/panel/Kconfig
+++ lnx-412-rc5/drivers/gpu/drm/panel/Kconfig
@@ -66,6 +66,7 @@ config DRM_PANEL_SAMSUNG_S6E3HA2
tristate "Samsung S6E3HA2 DSI video mode panel"
depends on OF
depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
select VIDEOMODE_HELPERS
 
 config DRM_PANEL_SAMSUNG_S6E8AA0




Re: [PATCH 3/3] cpufreq: intel_pstate: Provide resolve_freq() to fix regression

2017-06-11 Thread Viresh Kumar
On 10-06-17, 02:26, Joel Fernandes wrote:
> On Fri, Jun 9, 2017 at 3:15 AM, Viresh Kumar  wrote:
> > When the schedutil governor calls cpufreq_driver_resolve_freq() for the
> > intel_pstate (in passive mode) driver, it simply returns the requested
> > frequency as there is no ->resolve_freq() callback provided.
> >
> > The result is that get_next_freq() doesn't get a chance to know the
> > frequency which will be set eventually and we can hit a potential
> > regression as explained in the following paragraph.
> >
> > For example, consider the possible range of frequencies as 900 MHz, 1
> > GHz, 1.1 GHz, and 1.2 GHz. If the current frequency is 1.1 GHz and the
> > next frequency (based on current utilization) is 1 GHz, then the
> > schedutil governor will try to set the average of these as the next
> > frequency (i.e. 1.05 GHz).
> >
> > Because we always try to find the lowest frequency greater than equal to
> > the target frequency, the intel_pstate driver will end up setting the
> > frequency as 1.1 GHz.
> >
> > Though the sg_policy->next_freq field gets updated with the average
> > frequency only. And so we will finally select the min frequency when the
> > next_freq is 1 more than the min frequency as the average then will be
> > equal to the min frequency. But that will also take lots of iterations
> > of the schedutil update callbacks.
> >
> > Fix that by providing a resolve_freq() callback.
> >
> > Tested on desktop with Intel Skylake processors.
> >
> > Fixes: 39b64aa1c007 ("cpufreq: schedutil: Reduce frequencies slower")
> > Signed-off-by: Viresh Kumar 
> > ---
> >  drivers/cpufreq/intel_pstate.c | 14 ++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> > index 029a93bfb558..e177352180c3 100644
> > --- a/drivers/cpufreq/intel_pstate.c
> > +++ b/drivers/cpufreq/intel_pstate.c
> > @@ -2213,6 +2213,19 @@ static int intel_cpufreq_target(struct 
> > cpufreq_policy *policy,
> > return 0;
> >  }
> >
> > +unsigned int intel_cpufreq_resolve_freq(struct cpufreq_policy *policy,
> > +   unsigned int target_freq)
> 
> Should be defined as static?

Yes.

-- 
viresh


Re: [PATCH] cpufreq: conservative: Allow down_threshold to take values from 1 to 10

2017-06-11 Thread Viresh Kumar
On 11-06-17, 17:28, Tomasz Wilczyński wrote:
> Commit 27ed3cd2ebf4cd78b198be9758c538cdede36d8a ("cpufreq: conservative:
> Fix the logic in frequency decrease checking") removed the 10 point
> substraction when comparing the load against down_threshold but did not
> remove the related limit for the down_threshold value. As a result,
> down_threshold lower than 11 is not allowed even though values from
> 1 to 10 do work correctly too. The comment ("cannot be lower than 11
> otherwise freq will not fall") is also not true after removing the
> substraction.
> 
> For this reason, allow down_threshold to take any value from 1 to 99
> and fix the related comment.
> 
> Signed-off-by: Tomasz Wilczyński 

Please add Fixes tag and relevant kernel release for stable tag.

> ---
>  drivers/cpufreq/cpufreq_conservative.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq_conservative.c 
> b/drivers/cpufreq/cpufreq_conservative.c
> index 992f7c2..88220ff 100644
> --- a/drivers/cpufreq/cpufreq_conservative.c
> +++ b/drivers/cpufreq/cpufreq_conservative.c
> @@ -185,8 +185,8 @@ static ssize_t store_down_threshold(struct gov_attr_set 
> *attr_set,
>   int ret;
>   ret = sscanf(buf, "%u", &input);
>  
> - /* cannot be lower than 11 otherwise freq will not fall */
> - if (ret != 1 || input < 11 || input > 100 ||
> + /* cannot be lower than 1 otherwise freq will not fall */
> + if (ret != 1 || input < 1 || input > 100 ||
>   input >= dbs_data->up_threshold)
>   return -EINVAL;

Acked-by: Viresh Kumar 

-- 
viresh


[PATCH 23/27] unicore32: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

I moved "generic-y += kprobes.h" to keep the entries sorted.

Signed-off-by: Masahiro Yamada 
---

 arch/unicore32/include/asm/Kbuild  | 31 +--
 arch/unicore32/include/uapi/asm/Kbuild | 28 
 2 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/arch/unicore32/include/asm/Kbuild 
b/arch/unicore32/include/asm/Kbuild
index e9ad511c1043..fda7e2153086 100644
--- a/arch/unicore32/include/asm/Kbuild
+++ b/arch/unicore32/include/asm/Kbuild
@@ -1,67 +1,38 @@
-
 generic-y += atomic.h
-generic-y += auxvec.h
-generic-y += bitsperlong.h
 generic-y += bugs.h
 generic-y += clkdev.h
 generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += fb.h
-generic-y += fcntl.h
 generic-y += ftrace.h
 generic-y += futex.h
 generic-y += hardirq.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
+generic-y += kprobes.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
 generic-y += module.h
-generic-y += msgbuf.h
-generic-y += param.h
 generic-y += parport.h
 generic-y += percpu.h
-generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += sections.h
 generic-y += segment.h
-generic-y += sembuf.h
 generic-y += serial.h
-generic-y += setup.h
-generic-y += shmbuf.h
-generic-y += shmparam.h
-generic-y += siginfo.h
-generic-y += signal.h
 generic-y += sizes.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += stat.h
-generic-y += statfs.h
-generic-y += swab.h
 generic-y += syscalls.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += topology.h
 generic-y += trace_clock.h
-generic-y += types.h
-generic-y += ucontext.h
 generic-y += unaligned.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += word-at-a-time.h
 generic-y += xor.h
-generic-y += kprobes.h
diff --git a/arch/unicore32/include/uapi/asm/Kbuild 
b/arch/unicore32/include/uapi/asm/Kbuild
index 13a97aa2285f..759a71411169 100644
--- a/arch/unicore32/include/uapi/asm/Kbuild
+++ b/arch/unicore32/include/uapi/asm/Kbuild
@@ -1,4 +1,32 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
+generic-y += auxvec.h
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ioctls.h
+generic-y += ipcbuf.h
 generic-y += kvm_para.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += param.h
+generic-y += poll.h
+generic-y += posix_types.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += setup.h
+generic-y += shmbuf.h
+generic-y += shmparam.h
+generic-y += siginfo.h
+generic-y += signal.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += stat.h
+generic-y += statfs.h
+generic-y += swab.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
+generic-y += ucontext.h
-- 
2.7.4



[PATCH 21/27] sparc: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/sparc/include/asm/Kbuild  | 1 -
 arch/sparc/include/uapi/asm/Kbuild | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index e9e837bc3158..80ddc01f57ac 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -18,5 +18,4 @@ generic-y += preempt.h
 generic-y += rwsem.h
 generic-y += serial.h
 generic-y += trace_clock.h
-generic-y += types.h
 generic-y += word-at-a-time.h
diff --git a/arch/sparc/include/uapi/asm/Kbuild 
b/arch/sparc/include/uapi/asm/Kbuild
index b15bf6bc0e94..2178c78c7c1a 100644
--- a/arch/sparc/include/uapi/asm/Kbuild
+++ b/arch/sparc/include/uapi/asm/Kbuild
@@ -1,2 +1,4 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
+
+generic-y += types.h
-- 
2.7.4



[PATCH 03/27] kbuild: pass dst= to Makefile.headersinst from top Makefile

2017-06-11 Thread Masahiro Yamada
We can always pass dst= from the top Makefile.  This will simplify
the logic in Makefile.headersinst.

Signed-off-by: Masahiro Yamada 
---

 Makefile | 4 ++--
 scripts/Makefile.headersinst | 7 ++-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 298a096863a9..1bb8c07db134 100644
--- a/Makefile
+++ b/Makefile
@@ -1162,7 +1162,7 @@ PHONY += headers_install
 headers_install: __headers
$(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \
  $(error Headers not exportable for the $(SRCARCH) architecture))
-   $(Q)$(MAKE) $(hdr-inst)=include/uapi
+   $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include
$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst)
 
 PHONY += headers_check_all
@@ -1171,7 +1171,7 @@ headers_check_all: headers_install_all
 
 PHONY += headers_check
 headers_check: headers_install
-   $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
+   $(Q)$(MAKE) $(hdr-inst)=include/uapi dst=include HDRCHECK=1
$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi $(hdr-dst) 
HDRCHECK=1
 
 # ---
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index c801bc129635..b3135b76fac2 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -15,15 +15,13 @@ include scripts/Kbuild.include
 
 srcdir:= $(srctree)/$(obj)
 subdirs   := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/*/.))
-# caller may set destination dir (when installing to asm/)
-_dst  := $(if $(dst),$(dst),$(obj))
 
 # Recursion
 __headers: $(subdirs)
 
 .PHONY: $(subdirs)
 $(subdirs):
-   $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
+   $(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(dst)/$@
 
 # Skip header install/check for include/uapi and arch/$(hdr-arch)/include/uapi.
 # We have only sub-directories there.
@@ -40,8 +38,7 @@ ifneq ($(wildcard $(old-kbuild-file)),)
 include $(old-kbuild-file)
 endif
 
-installdir:= $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
-
+installdir:= $(INSTALL_HDR_PATH)/$(dst)
 gendir:= $(objtree)/$(subst include/,include/generated/,$(obj))
 header-files  := $(notdir $(wildcard $(srcdir)/*.h))
 header-files  += $(notdir $(wildcard $(srcdir)/*.agh))
-- 
2.7.4



[PATCH 01/27] kbuild: remove useless $(gen) variable in Makefile.headersinst

2017-06-11 Thread Masahiro Yamada
We have no true case for the $(if $(gen), ...) conditional.  Drop it
to simplify the gendir calculation.

Signed-off-by: Masahiro Yamada 
---

 scripts/Makefile.headersinst | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index ce753a408c56..c801bc129635 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -31,9 +31,6 @@ skip-inst := $(if $(filter %/uapi,$(obj)),1)
 
 ifeq ($(skip-inst),)
 
-# generated header directory
-gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
-
 # Kbuild file is optional
 kbuild-file := $(srctree)/$(obj)/Kbuild
 -include $(kbuild-file)
@@ -45,7 +42,7 @@ endif
 
 installdir:= $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
 
-gendir:= $(objtree)/$(gen)
+gendir:= $(objtree)/$(subst include/,include/generated/,$(obj))
 header-files  := $(notdir $(wildcard $(srcdir)/*.h))
 header-files  += $(notdir $(wildcard $(srcdir)/*.agh))
 header-files  := $(filter-out $(no-export-headers), $(header-files))
-- 
2.7.4



[PATCH 13/27] m32r: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/m32r/include/asm/Kbuild  | 2 --
 arch/m32r/include/uapi/asm/Kbuild | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index c000ffac8586..15ad847321fc 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -1,10 +1,8 @@
-
 generic-y += clkdev.h
 generic-y += current.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += irq_work.h
-generic-y += kvm_para.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
 generic-y += module.h
diff --git a/arch/m32r/include/uapi/asm/Kbuild 
b/arch/m32r/include/uapi/asm/Kbuild
index b15bf6bc0e94..13a97aa2285f 100644
--- a/arch/m32r/include/uapi/asm/Kbuild
+++ b/arch/m32r/include/uapi/asm/Kbuild
@@ -1,2 +1,4 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
+
+generic-y += kvm_para.h
-- 
2.7.4



[PATCH 02/27] kbuild: fix comment about dst of headers_{install,check}_all

2017-06-11 Thread Masahiro Yamada
Commit 61562f981e92 ("uapi: export all arch specifics directories")
changed the dst from asm- to arch- for headers_install_all
or headers_check_all.  Update the comment.

Signed-off-by: Masahiro Yamada 
---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 63e10bd4f14a..298a096863a9 100644
--- a/Makefile
+++ b/Makefile
@@ -1141,7 +1141,7 @@ firmware_install:
 #Default location for installed headers
 export INSTALL_HDR_PATH = $(objtree)/usr
 
-# If we do an all arch process set dst to asm-$(hdr-arch)
+# If we do an all arch process set dst to include/arch-$(hdr-arch)
 hdr-dst = $(if $(KBUILD_HEADERS), dst=include/arch-$(hdr-arch), dst=include)
 
 PHONY += archheaders
-- 
2.7.4



[PATCH 25/27] kbuild: do not include old-kbuild-file from Makefile.headersinst

2017-06-11 Thread Masahiro Yamada
Now asm-generic wrappers to be exported are all listed in
arch/*/include/uapi/asm/Kbuild.  "make headers_install" no longer
depends on any Kbuild files outside uapi directories.

Signed-off-by: Masahiro Yamada 
---

 scripts/Makefile.headersinst | 5 -
 1 file changed, 5 deletions(-)

diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index b3135b76fac2..d6be5e482636 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -33,11 +33,6 @@ ifeq ($(skip-inst),)
 kbuild-file := $(srctree)/$(obj)/Kbuild
 -include $(kbuild-file)
 
-old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
-ifneq ($(wildcard $(old-kbuild-file)),)
-include $(old-kbuild-file)
-endif
-
 installdir:= $(INSTALL_HDR_PATH)/$(dst)
 gendir:= $(objtree)/$(subst include/,include/generated/,$(obj))
 header-files  := $(notdir $(wildcard $(srcdir)/*.h))
-- 
2.7.4



[PATCH 26/27] kbuild: split exported generic header creation into uapi-asm-generic

2017-06-11 Thread Masahiro Yamada
When we install headers, we are interested only in headers under uapi
directories.  Split out uapi-asm-generic target and make headers_install
depend on it.  It will avoid generating unneeded asm-generic wrappers.

Signed-off-by: Masahiro Yamada 
---

 Makefile | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 1bb8c07db134..4fe556511c0d 100644
--- a/Makefile
+++ b/Makefile
@@ -465,10 +465,11 @@ ifneq ($(KBUILD_SRC),)
 endif
 
 # Support for using generic headers in asm-generic
-PHONY += asm-generic
-asm-generic:
+PHONY += asm-generic uapi-asm-generic
+asm-generic: uapi-asm-generic
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
src=asm obj=arch/$(SRCARCH)/include/generated/asm
+uapi-asm-generic:
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm
 
@@ -1151,7 +1152,7 @@ PHONY += archscripts
 archscripts:
 
 PHONY += __headers
-__headers: $(version_h) scripts_basic asm-generic archheaders archscripts
+__headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts
$(Q)$(MAKE) $(build)=scripts build_unifdef
 
 PHONY += headers_install_all
-- 
2.7.4



[PATCH 16/27] nios2: remove unneeded arch/nios2/include/(generated/)asm/signal.h

2017-06-11 Thread Masahiro Yamada
Currently, NIOS2 has three signal.h files under arch/nios2/include:

[1] arch/nios2/include/asm/signal.h
[2] arch/nios2/include/uapi/asm/signal.h
[3] arch/nios2/include/generated/asm/signal.h

[3] is build-time generated by scripts/Makefile.asm-generic.
However, -I$(srctree)/arch/$(hdr-arch)/include search path is listed
before -I$(objtree)/arch/$(hdr-arch)/include/generated in LINUXINCLUDE.
Therefore [1] is always included instead of [3].  Remove [3] which
is never included.

If we look at [1], it just includes [2].  So, [1] can be removed
as well.

Signed-off-by: Masahiro Yamada 
---

 arch/nios2/include/asm/Kbuild   |  1 -
 arch/nios2/include/asm/signal.h | 22 --
 2 files changed, 23 deletions(-)
 delete mode 100644 arch/nios2/include/asm/signal.h

diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index 727dbb333f60..fcef68198465 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -48,7 +48,6 @@ generic-y += sembuf.h
 generic-y += serial.h
 generic-y += shmbuf.h
 generic-y += siginfo.h
-generic-y += signal.h
 generic-y += socket.h
 generic-y += sockios.h
 generic-y += spinlock.h
diff --git a/arch/nios2/include/asm/signal.h b/arch/nios2/include/asm/signal.h
deleted file mode 100644
index bbcf11eecb01..
--- a/arch/nios2/include/asm/signal.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright Altera Corporation (C) 2013. All rights reserved
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program.  If not, see .
- *
- */
-#ifndef _NIOS2_SIGNAL_H
-#define _NIOS2_SIGNAL_H
-
-#include 
-
-#endif /* _NIOS2_SIGNAL_H */
-- 
2.7.4



[PATCH 27/27] kbuild: remove wrapper files handling from Makefile.headersinst

2017-06-11 Thread Masahiro Yamada
scripts/Makefike.headersinst creates asm-generic wrappers by itself
because scripts/Makefile.asm-generic created some of exported wrappers
outside uapi directories.

Now this distortion has been fixed.  scripts/Makefile.headersinst can
simply copy wrappers created by scripts/Makefile.asm-generic.

Signed-off-by: Masahiro Yamada 
---

 scripts/Makefile.headersinst | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index d6be5e482636..5a3da7c42c09 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -45,14 +45,8 @@ genhdr-files  := $(filter-out $(header-files), 
$(genhdr-files))
 install-file  := $(installdir)/.install
 check-file:= $(installdir)/.check
 
-# generic-y list all files an architecture uses from asm-generic
-# Use this to build a list of headers which require a wrapper
-generic-files := $(notdir $(wildcard $(srctree)/include/uapi/asm-generic/*.h))
-wrapper-files := $(filter $(generic-files), $(generic-y))
-wrapper-files := $(filter-out $(header-files), $(wrapper-files))
-
 # all headers files for this dir
-all-files := $(header-files) $(genhdr-files) $(wrapper-files)
+all-files := $(header-files) $(genhdr-files)
 output-files  := $(addprefix $(installdir)/, $(all-files))
 
 ifneq ($(mandatory-y),)
@@ -76,9 +70,6 @@ quiet_cmd_install = INSTALL $(printdir) ($(words 
$(all-files))\
   cmd_install = \
 $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(header-files); \
 $(CONFIG_SHELL) $< $(installdir) $(gendir) $(genhdr-files); \
-for F in $(wrapper-files); do   \
-echo "\#include " > $(installdir)/$$F;\
-done;   \
 touch $@
 
 quiet_cmd_remove = REMOVE  $(unwanted)
-- 
2.7.4



[PATCH 17/27] nios2: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/nios2/include/asm/Kbuild  | 24 
 arch/nios2/include/uapi/asm/Kbuild | 24 
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index fcef68198465..7010251c0545 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -1,8 +1,6 @@
 generic-y += atomic.h
-generic-y += auxvec.h
 generic-y += barrier.h
 generic-y += bitops.h
-generic-y += bitsperlong.h
 generic-y += bug.h
 generic-y += bugs.h
 generic-y += clkdev.h
@@ -12,52 +10,30 @@ generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += fb.h
-generic-y += fcntl.h
 generic-y += ftrace.h
 generic-y += futex.h
 generic-y += hardirq.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
-generic-y += kvm_para.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
 generic-y += module.h
-generic-y += msgbuf.h
-generic-y += param.h
 generic-y += pci.h
 generic-y += percpu.h
-generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += sections.h
 generic-y += segment.h
-generic-y += sembuf.h
 generic-y += serial.h
-generic-y += shmbuf.h
-generic-y += siginfo.h
-generic-y += socket.h
-generic-y += sockios.h
 generic-y += spinlock.h
-generic-y += stat.h
-generic-y += statfs.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += topology.h
 generic-y += trace_clock.h
-generic-y += types.h
 generic-y += unaligned.h
 generic-y += user.h
 generic-y += vga.h
diff --git a/arch/nios2/include/uapi/asm/Kbuild 
b/arch/nios2/include/uapi/asm/Kbuild
index 374bd123329f..ffca24da7647 100644
--- a/arch/nios2/include/uapi/asm/Kbuild
+++ b/arch/nios2/include/uapi/asm/Kbuild
@@ -1,5 +1,29 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
+generic-y += auxvec.h
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ioctls.h
+generic-y += ipcbuf.h
+generic-y += kvm_para.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += param.h
+generic-y += poll.h
+generic-y += posix_types.h
+generic-y += resource.h
+generic-y += sembuf.h
 generic-y += setup.h
+generic-y += shmbuf.h
+generic-y += siginfo.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += stat.h
+generic-y += statfs.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
 generic-y += ucontext.h
-- 
2.7.4



[PATCH 12/27] ia64: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
"generic-y += kvm_para.h" is doubled in asm/Kbuild and uapi/asm/Kbuild.
The one in the former should be simply removed because kvm_para.h is
exported.

Signed-off-by: Masahiro Yamada 
---

 arch/ia64/include/asm/Kbuild | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index 502a91d8dbbd..1d7641f891e1 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -1,8 +1,6 @@
-
 generic-y += clkdev.h
 generic-y += exec.h
 generic-y += irq_work.h
-generic-y += kvm_para.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
 generic-y += preempt.h
-- 
2.7.4



[PATCH 00/27] kbuild, arch: complete UAPI de-coupling and cleanup scripts/Makefile.headersinst

2017-06-11 Thread Masahiro Yamada

In v4.12-rc1, we had a big progress for headers_install.
All (and only) headers under UAPI directories are exported.
However, asm-generic wrappers are still exceptions because
most of arch/*/include/asm/Kbuild include "generic-y" for
exported headers.  As a result, many of generic-wrappers to be
exported are generated outside UAPI directories.

To finish de-coupling UAPI, "generic-y" for exported headers
should be moved to arch/*/include/uapi/asm/Kbuild.

With those cleanups, the logic of headers_install will become
even simpler.  UAPI will be completely self-contained.

This series is based on v4.12-rc2 tag.

This series touches Kbuild files under arch/.  We have two options
to merge this series.

[1] I will collect Acked-by from arch maintainers, then apply the
whole series to the Kbuild tree.

[2] I will ask arch maintainers to pick up arch changes (for v4.13),
then apply Makefile changes to the Kbuild tree (for v4.14).

[1] will finish this work by v4.13, but need to deal with some conflicts.
[2] will allow us to reduce conflicts (still a bit conflicts),
but take more time to finish this work.

If arch maintainers ack [1], I can manage conflicts
before sending a pull request to Linus.



Masahiro Yamada (27):
  kbuild: remove useless $(gen) variable in Makefile.headersinst
  kbuild: fix comment about dst of headers_{install,check}_all
  kbuild: pass dst= to Makefile.headersinst from top Makefile
  arm64: move generic-y of exported headers to uapi/asm/Kbuild
  ARM: move generic-y of exported headers to uapi/asm/Kbuild
  arc: move generic-y of exported headers to uapi/asm/Kbuild
  blackfin: move generic-y of exported headers to uapi/asm/Kbuild
  c6x: move generic-y of exported headers to uapi/asm/Kbuild
  cris: move generic-y of exported headers to uapi/asm/Kbuild
  h8300: move generic-y of exported headers to uapi/asm/Kbuild
  hexagon: move generic-y of exported headers to uapi/asm/Kbuild
  ia64: move generic-y of exported headers to uapi/asm/Kbuild
  m32r: move generic-y of exported headers to uapi/asm/Kbuild
  m68k: move generic-y of exported headers to uapi/asm/Kbuild
  metag: move generic-y of exported headers to uapi/asm/Kbuild
  nios2: remove unneeded arch/nios2/include/(generated/)asm/signal.h
  nios2: move generic-y of exported headers to uapi/asm/Kbuild
  openrisc: move generic-y of exported headers to uapi/asm/Kbuild
  parisc: move generic-y of exported headers to uapi/asm/Kbuild
  sh: move generic-y of exported headers to uapi/asm/Kbuild
  sparc: move generic-y of exported headers to uapi/asm/Kbuild
  tile: move generic-y of exported headers to uapi/asm/Kbuild
  unicore32: move generic-y of exported headers to uapi/asm/Kbuild
  xtensa: move generic-y of exported headers to uapi/asm/Kbuild
  kbuild: do not include old-kbuild-file from Makefile.headersinst
  kbuild: split exported generic header creation into uapi-asm-generic
  kbuild: remove wrapper files handling from Makefile.headersinst

 Makefile   | 13 +++--
 arch/arc/include/asm/Kbuild| 25 -
 arch/arc/include/uapi/asm/Kbuild   | 26 ++
 arch/arm/include/asm/Kbuild| 17 -
 arch/arm/include/uapi/asm/Kbuild   | 16 
 arch/arm64/include/asm/Kbuild  | 17 -
 arch/arm64/include/uapi/asm/Kbuild | 16 
 arch/blackfin/include/asm/Kbuild   | 22 --
 arch/blackfin/include/uapi/asm/Kbuild  | 22 ++
 arch/c6x/include/asm/Kbuild| 27 ---
 arch/c6x/include/uapi/asm/Kbuild   | 26 ++
 arch/cris/include/asm/Kbuild   | 18 --
 arch/cris/include/uapi/asm/Kbuild  | 19 +++
 arch/h8300/include/asm/Kbuild  | 27 ---
 arch/h8300/include/uapi/asm/Kbuild | 28 
 arch/hexagon/include/asm/Kbuild| 23 ---
 arch/hexagon/include/uapi/asm/Kbuild   | 24 
 arch/ia64/include/asm/Kbuild   |  2 --
 arch/m32r/include/asm/Kbuild   |  2 --
 arch/m32r/include/uapi/asm/Kbuild  |  2 ++
 arch/m68k/include/asm/Kbuild   | 12 
 arch/m68k/include/uapi/asm/Kbuild  | 11 +++
 arch/metag/include/asm/Kbuild  | 24 
 arch/metag/include/uapi/asm/Kbuild | 24 
 arch/nios2/include/asm/Kbuild  | 25 -
 arch/nios2/include/asm/signal.h| 22 --
 arch/nios2/include/uapi/asm/Kbuild | 24 
 arch/openrisc/include/asm/Kbuild   | 28 
 arch/openrisc/include/uapi/asm/Kbuild  | 29 +
 arch/parisc/include/asm/Kbuild |  5 -
 arch/parisc/include/uapi/asm/Kbuild|  4 
 arch/sh/include/asm/Kb

[PATCH 22/27] tile: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/tile/include/asm/Kbuild  | 19 ---
 arch/tile/include/uapi/asm/Kbuild | 19 +++
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index 16f0b08c8ce9..d28d2b8932c7 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -2,37 +2,18 @@ generic-y += bug.h
 generic-y += bugs.h
 generic-y += clkdev.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += fb.h
-generic-y += fcntl.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += msgbuf.h
-generic-y += param.h
 generic-y += parport.h
-generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += seccomp.h
-generic-y += sembuf.h
 generic-y += serial.h
-generic-y += shmbuf.h
-generic-y += shmparam.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += statfs.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += trace_clock.h
-generic-y += types.h
 generic-y += xor.h
diff --git a/arch/tile/include/uapi/asm/Kbuild 
b/arch/tile/include/uapi/asm/Kbuild
index 0c74c3c5ebfa..5711de0a1b5e 100644
--- a/arch/tile/include/uapi/asm/Kbuild
+++ b/arch/tile/include/uapi/asm/Kbuild
@@ -1,4 +1,23 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ioctls.h
+generic-y += ipcbuf.h
+generic-y += msgbuf.h
+generic-y += param.h
+generic-y += poll.h
+generic-y += posix_types.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += shmbuf.h
+generic-y += shmparam.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += statfs.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
 generic-y += ucontext.h
-- 
2.7.4



[PATCH 09/27] cris: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/cris/include/asm/Kbuild  | 18 --
 arch/cris/include/uapi/asm/Kbuild | 19 +++
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index 289002a9..5194aad168a3 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -1,48 +1,30 @@
 generic-y += atomic.h
-generic-y += auxvec.h
 generic-y += barrier.h
-generic-y += bitsperlong.h
 generic-y += clkdev.h
 generic-y += cmpxchg.h
 generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += emergency-restart.h
-generic-y += fcntl.h
 generic-y += futex.h
 generic-y += hardirq.h
-generic-y += ioctl.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
-generic-y += kvm_para.h
 generic-y += linkage.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
 generic-y += module.h
-generic-y += msgbuf.h
 generic-y += percpu.h
-generic-y += poll.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += sections.h
-generic-y += sembuf.h
-generic-y += shmbuf.h
-generic-y += siginfo.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += statfs.h
 generic-y += topology.h
 generic-y += trace_clock.h
-generic-y += types.h
 generic-y += vga.h
 generic-y += word-at-a-time.h
 generic-y += xor.h
diff --git a/arch/cris/include/uapi/asm/Kbuild 
b/arch/cris/include/uapi/asm/Kbuild
index b15bf6bc0e94..3687b54bb18e 100644
--- a/arch/cris/include/uapi/asm/Kbuild
+++ b/arch/cris/include/uapi/asm/Kbuild
@@ -1,2 +1,21 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
+
+generic-y += auxvec.h
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ipcbuf.h
+generic-y += kvm_para.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += poll.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += shmbuf.h
+generic-y += siginfo.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += statfs.h
+generic-y += types.h
-- 
2.7.4



[PATCH 15/27] metag: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/metag/include/asm/Kbuild  | 24 
 arch/metag/include/uapi/asm/Kbuild | 24 
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/metag/include/asm/Kbuild b/arch/metag/include/asm/Kbuild
index 8f940553a579..cd06d246d06c 100644
--- a/arch/metag/include/asm/Kbuild
+++ b/arch/metag/include/asm/Kbuild
@@ -1,55 +1,31 @@
-generic-y += auxvec.h
-generic-y += bitsperlong.h
 generic-y += bugs.h
 generic-y += clkdev.h
 generic-y += current.h
 generic-y += device.h
 generic-y += dma.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += fb.h
-generic-y += fcntl.h
 generic-y += futex.h
 generic-y += hardirq.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
-generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += msgbuf.h
-generic-y += param.h
 generic-y += pci.h
 generic-y += percpu.h
-generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
 generic-y += sections.h
-generic-y += sembuf.h
 generic-y += serial.h
-generic-y += shmbuf.h
-generic-y += shmparam.h
-generic-y += signal.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += stat.h
-generic-y += statfs.h
 generic-y += switch_to.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += timex.h
 generic-y += trace_clock.h
-generic-y += types.h
-generic-y += ucontext.h
 generic-y += unaligned.h
 generic-y += user.h
 generic-y += vga.h
diff --git a/arch/metag/include/uapi/asm/Kbuild 
b/arch/metag/include/uapi/asm/Kbuild
index b29731ebd7a9..6ac763d9a3e3 100644
--- a/arch/metag/include/uapi/asm/Kbuild
+++ b/arch/metag/include/uapi/asm/Kbuild
@@ -1,6 +1,30 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
+generic-y += auxvec.h
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ioctls.h
+generic-y += ipcbuf.h
+generic-y += kvm_para.h
 generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += param.h
+generic-y += poll.h
+generic-y += posix_types.h
 generic-y += resource.h
+generic-y += sembuf.h
 generic-y += setup.h
+generic-y += shmbuf.h
+generic-y += shmparam.h
+generic-y += signal.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += stat.h
+generic-y += statfs.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
+generic-y += ucontext.h
-- 
2.7.4



[PATCH 20/27] sh: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/sh/include/asm/Kbuild  | 20 
 arch/sh/include/uapi/asm/Kbuild | 20 
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index cf2a75063b53..1a6f9c39feef 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,40 +1,20 @@
-
-generic-y += bitsperlong.h
 generic-y += clkdev.h
 generic-y += current.h
 generic-y += delay.h
 generic-y += div64.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
-generic-y += fcntl.h
-generic-y += ioctl.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
-generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
-generic-y += msgbuf.h
-generic-y += param.h
 generic-y += parport.h
 generic-y += percpu.h
-generic-y += poll.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += rwsem.h
-generic-y += sembuf.h
 generic-y += serial.h
-generic-y += shmbuf.h
-generic-y += siginfo.h
 generic-y += sizes.h
-generic-y += socket.h
-generic-y += statfs.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += trace_clock.h
-generic-y += ucontext.h
 generic-y += xor.h
diff --git a/arch/sh/include/uapi/asm/Kbuild b/arch/sh/include/uapi/asm/Kbuild
index b15bf6bc0e94..e28531333efa 100644
--- a/arch/sh/include/uapi/asm/Kbuild
+++ b/arch/sh/include/uapi/asm/Kbuild
@@ -1,2 +1,22 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
+
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ipcbuf.h
+generic-y += kvm_para.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += param.h
+generic-y += poll.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += shmbuf.h
+generic-y += siginfo.h
+generic-y += socket.h
+generic-y += statfs.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += ucontext.h
-- 
2.7.4



[PATCH 08/27] c6x: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/c6x/include/asm/Kbuild  | 27 ---
 arch/c6x/include/uapi/asm/Kbuild | 26 ++
 2 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index f0eaf0475e7e..7c971e182b35 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -1,8 +1,5 @@
-
 generic-y += atomic.h
-generic-y += auxvec.h
 generic-y += barrier.h
-generic-y += bitsperlong.h
 generic-y += bugs.h
 generic-y += clkdev.h
 generic-y += current.h
@@ -10,17 +7,12 @@ generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += fb.h
-generic-y += fcntl.h
 generic-y += futex.h
 generic-y += hw_irq.h
 generic-y += io.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
@@ -28,36 +20,17 @@ generic-y += kmap_types.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
 generic-y += mmu.h
 generic-y += mmu_context.h
-generic-y += msgbuf.h
-generic-y += param.h
 generic-y += pci.h
 generic-y += percpu.h
 generic-y += pgalloc.h
-generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += segment.h
-generic-y += sembuf.h
 generic-y += serial.h
-generic-y += shmbuf.h
-generic-y += shmparam.h
-generic-y += siginfo.h
-generic-y += signal.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += stat.h
-generic-y += statfs.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += tlbflush.h
 generic-y += topology.h
 generic-y += trace_clock.h
-generic-y += types.h
-generic-y += ucontext.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += word-at-a-time.h
diff --git a/arch/c6x/include/uapi/asm/Kbuild b/arch/c6x/include/uapi/asm/Kbuild
index 13a97aa2285f..67ee896a76a7 100644
--- a/arch/c6x/include/uapi/asm/Kbuild
+++ b/arch/c6x/include/uapi/asm/Kbuild
@@ -1,4 +1,30 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
+generic-y += auxvec.h
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ioctls.h
+generic-y += ipcbuf.h
 generic-y += kvm_para.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += param.h
+generic-y += poll.h
+generic-y += posix_types.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += shmbuf.h
+generic-y += shmparam.h
+generic-y += siginfo.h
+generic-y += signal.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += stat.h
+generic-y += statfs.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
+generic-y += ucontext.h
-- 
2.7.4



[PATCH 10/27] h8300: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/h8300/include/asm/Kbuild  | 27 ---
 arch/h8300/include/uapi/asm/Kbuild | 28 
 2 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index 757cdeb24e6e..5f2af32a7a57 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -1,5 +1,4 @@
 generic-y += asm-offsets.h
-generic-y += auxvec.h
 generic-y += barrier.h
 generic-y += bugs.h
 generic-y += cacheflush.h
@@ -11,65 +10,39 @@ generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += fb.h
-generic-y += fcntl.h
 generic-y += ftrace.h
 generic-y += futex.h
 generic-y += hardirq.h
 generic-y += hash.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
-generic-y += kvm_para.h
 generic-y += linkage.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
 generic-y += mmu.h
 generic-y += mmu_context.h
 generic-y += module.h
-generic-y += msgbuf.h
-generic-y += param.h
 generic-y += parport.h
 generic-y += percpu.h
 generic-y += pgalloc.h
-generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += scatterlist.h
 generic-y += sections.h
-generic-y += sembuf.h
 generic-y += serial.h
-generic-y += setup.h
-generic-y += shmbuf.h
-generic-y += shmparam.h
-generic-y += siginfo.h
 generic-y += sizes.h
-generic-y += socket.h
-generic-y += sockios.h
 generic-y += spinlock.h
-generic-y += stat.h
-generic-y += statfs.h
-generic-y += swab.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += timex.h
 generic-y += tlbflush.h
 generic-y += trace_clock.h
 generic-y += topology.h
-generic-y += types.h
-generic-y += ucontext.h
 generic-y += unaligned.h
 generic-y += vga.h
 generic-y += word-at-a-time.h
diff --git a/arch/h8300/include/uapi/asm/Kbuild 
b/arch/h8300/include/uapi/asm/Kbuild
index b15bf6bc0e94..187aed820e71 100644
--- a/arch/h8300/include/uapi/asm/Kbuild
+++ b/arch/h8300/include/uapi/asm/Kbuild
@@ -1,2 +1,30 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
+
+generic-y += auxvec.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ioctls.h
+generic-y += ipcbuf.h
+generic-y += kvm_para.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += param.h
+generic-y += poll.h
+generic-y += posix_types.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += setup.h
+generic-y += shmbuf.h
+generic-y += shmparam.h
+generic-y += siginfo.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += stat.h
+generic-y += statfs.h
+generic-y += swab.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
+generic-y += ucontext.h
-- 
2.7.4



[PATCH 24/27] xtensa: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/xtensa/include/asm/Kbuild  |  9 -
 arch/xtensa/include/uapi/asm/Kbuild | 10 ++
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index cc23e9ecc6bb..0b408dc2366e 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -1,20 +1,15 @@
-generic-y += bitsperlong.h
 generic-y += bug.h
 generic-y += clkdev.h
 generic-y += div64.h
 generic-y += dma-contiguous.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
-generic-y += fcntl.h
 generic-y += hardirq.h
-generic-y += ioctl.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
-generic-y += kvm_para.h
 generic-y += linkage.h
 generic-y += local.h
 generic-y += local64.h
@@ -22,12 +17,8 @@ generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
 generic-y += percpu.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += rwsem.h
 generic-y += sections.h
-generic-y += siginfo.h
-generic-y += statfs.h
-generic-y += termios.h
 generic-y += topology.h
 generic-y += trace_clock.h
 generic-y += word-at-a-time.h
diff --git a/arch/xtensa/include/uapi/asm/Kbuild 
b/arch/xtensa/include/uapi/asm/Kbuild
index b15bf6bc0e94..a5bcdfb890f1 100644
--- a/arch/xtensa/include/uapi/asm/Kbuild
+++ b/arch/xtensa/include/uapi/asm/Kbuild
@@ -1,2 +1,12 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
+
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += kvm_para.h
+generic-y += resource.h
+generic-y += siginfo.h
+generic-y += statfs.h
+generic-y += termios.h
-- 
2.7.4



[PATCH 05/27] ARM: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/include/asm/Kbuild  | 17 -
 arch/arm/include/uapi/asm/Kbuild | 16 
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 3a36d99ff836..721ab5ecfb9b 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -1,40 +1,23 @@
-
-
-generic-y += bitsperlong.h
 generic-y += clkdev.h
 generic-y += current.h
 generic-y += early_ioremap.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
-generic-y += ioctl.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += kdebug.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mm-arch-hooks.h
-generic-y += msgbuf.h
 generic-y += msi.h
-generic-y += param.h
 generic-y += parport.h
-generic-y += poll.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += rwsem.h
 generic-y += seccomp.h
 generic-y += segment.h
-generic-y += sembuf.h
 generic-y += serial.h
-generic-y += shmbuf.h
-generic-y += siginfo.h
 generic-y += simd.h
 generic-y += sizes.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += timex.h
 generic-y += trace_clock.h
 generic-y += unaligned.h
diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild
index 607f702c2d62..b531c2786f27 100644
--- a/arch/arm/include/uapi/asm/Kbuild
+++ b/arch/arm/include/uapi/asm/Kbuild
@@ -1,6 +1,22 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += ioctl.h
+generic-y += ipcbuf.h
+generic-y += msgbuf.h
+generic-y += param.h
+generic-y += poll.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += shmbuf.h
+generic-y += siginfo.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += termbits.h
+generic-y += termios.h
+
 genhdr-y += unistd-common.h
 genhdr-y += unistd-oabi.h
 genhdr-y += unistd-eabi.h
-- 
2.7.4



[PATCH 18/27] openrisc: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/openrisc/include/asm/Kbuild  | 28 
 arch/openrisc/include/uapi/asm/Kbuild | 29 +
 2 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index fdbcf0bf44a4..5e209fcd9a54 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -1,6 +1,4 @@
-generic-y += auxvec.h
 generic-y += barrier.h
-generic-y += bitsperlong.h
 generic-y += bug.h
 generic-y += bugs.h
 generic-y += cacheflush.h
@@ -11,56 +9,30 @@ generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += fb.h
-generic-y += fcntl.h
 generic-y += ftrace.h
 generic-y += hardirq.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += irq.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
-generic-y += kvm_para.h
 generic-y += local.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
 generic-y += module.h
-generic-y += msgbuf.h
 generic-y += pci.h
 generic-y += percpu.h
-generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += sections.h
 generic-y += segment.h
-generic-y += sembuf.h
-generic-y += setup.h
-generic-y += shmbuf.h
-generic-y += shmparam.h
-generic-y += siginfo.h
-generic-y += signal.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += stat.h
-generic-y += statfs.h
 generic-y += string.h
-generic-y += swab.h
 generic-y += switch_to.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += topology.h
 generic-y += trace_clock.h
-generic-y += types.h
-generic-y += ucontext.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += word-at-a-time.h
diff --git a/arch/openrisc/include/uapi/asm/Kbuild 
b/arch/openrisc/include/uapi/asm/Kbuild
index b15bf6bc0e94..62286dbeb904 100644
--- a/arch/openrisc/include/uapi/asm/Kbuild
+++ b/arch/openrisc/include/uapi/asm/Kbuild
@@ -1,2 +1,31 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
+
+generic-y += auxvec.h
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ioctls.h
+generic-y += ipcbuf.h
+generic-y += kvm_para.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += poll.h
+generic-y += posix_types.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += setup.h
+generic-y += shmbuf.h
+generic-y += shmparam.h
+generic-y += siginfo.h
+generic-y += signal.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += stat.h
+generic-y += statfs.h
+generic-y += swab.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
+generic-y += ucontext.h
-- 
2.7.4



Re: [PATCH] drm/sun4i: hdmi: Implement I2C adapter for A10s DDC bus

2017-06-11 Thread Chen-Yu Tsai
On Mon, Jun 12, 2017 at 10:12 AM, Jonathan Liu  wrote:
> The drm_get_edid function should be used instead of drm_do_get_edid by
> exposing the DDC bus as an I2C adapter. Implement this for A10s.

Nice!

>
> Signed-off-by: Jonathan Liu 
> ---
>  drivers/gpu/drm/sun4i/Makefile |   1 +
>  drivers/gpu/drm/sun4i/sun4i_hdmi.h |  11 ++-
>  drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c |  96 +++
>  drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c | 166 
> +
>  4 files changed, 190 insertions(+), 84 deletions(-)
>  create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c
>
> diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
> index e29fd3a2ba9c..43c753cafc88 100644
> --- a/drivers/gpu/drm/sun4i/Makefile
> +++ b/drivers/gpu/drm/sun4i/Makefile
> @@ -2,6 +2,7 @@ sun4i-drm-y += sun4i_drv.o
>  sun4i-drm-y += sun4i_framebuffer.o
>
>  sun4i-drm-hdmi-y += sun4i_hdmi_enc.o
> +sun4i-drm-hdmi-y += sun4i_hdmi_i2c.o
>  sun4i-drm-hdmi-y += sun4i_hdmi_ddc_clk.o
>  sun4i-drm-hdmi-y += sun4i_hdmi_tmds_clk.o
>
> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h 
> b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
> index 2589bc92be59..8e7a70f67f04 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h
> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
> @@ -100,6 +100,7 @@
>  #define SUN4I_HDMI_DDC_CTRL_START_CMD  BIT(30)
>  #define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_MASK  BIT(8)
>  #define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_READ  (0 << 8)
> +#define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_WRITE (1 << 8)
>  #define SUN4I_HDMI_DDC_CTRL_RESET  BIT(0)
>
>  #define SUN4I_HDMI_DDC_ADDR_REG0x504
> @@ -108,6 +109,10 @@
>  #define SUN4I_HDMI_DDC_ADDR_OFFSET(off)(((off) & 0xff) << 8)
>  #define SUN4I_HDMI_DDC_ADDR_SLAVE(addr)((addr) & 0xff)
>
> +#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_REG0x50c
> +#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_FIFO_REQUEST   BIT(4)
> +#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_TRANSFER_COMPLETE  BIT(0)
> +
>  #define SUN4I_HDMI_DDC_FIFO_CTRL_REG   0x510
>  #define SUN4I_HDMI_DDC_FIFO_CTRL_CLEAR BIT(31)
>
> @@ -115,7 +120,8 @@
>  #define SUN4I_HDMI_DDC_BYTE_COUNT_REG  0x51c
>
>  #define SUN4I_HDMI_DDC_CMD_REG 0x520
> -#define SUN4I_HDMI_DDC_CMD_EXPLICIT_EDDC_READ  6
> +#define SUN4I_HDMI_DDC_CMD_IMPLICIT_WRITE  3
> +#define SUN4I_HDMI_DDC_CMD_IMPLICIT_READ   5
>
>  #define SUN4I_HDMI_DDC_CLK_REG 0x528
>  #define SUN4I_HDMI_DDC_CLK_M(m)(((m) & 0x7) << 3)
> @@ -181,6 +187,8 @@ struct sun4i_hdmi {
> struct clk  *ddc_clk;
> struct clk  *tmds_clk;
>
> +   struct i2c_adapter  *i2c;
> +
> struct sun4i_drv*drv;
>
> boolhdmi_monitor;
> @@ -192,5 +200,6 @@ int sun4i_ddc_create(struct sun4i_hdmi *hdmi, struct clk 
> *clk);
>  int sun6i_ddc_create(struct sun4i_hdmi *hdmi, struct clk *clk);
>  int sun4i_tmds_create(struct sun4i_hdmi *hdmi);
>  int sun6i_tmds_create(struct sun4i_hdmi *hdmi);
> +int sun4i_hdmi_i2c_create(struct sun4i_hdmi *hdmi);

However you seem to have based it on the wrong branch/patches.
You based them on my A31 HDMI patches, instead of what Maxime has
in his sunxi-drm/for-next branch.

I could add this to my A31 patches, though it probably won't make
4.13. Alternatively you could rebase them on top of Maxime's branch.

>
>  #endif /* _SUN4I_HDMI_H_ */
> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c 
> b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> index e9abf93eb41c..6c9b11c4cf68 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> @@ -186,93 +186,13 @@ static const struct drm_encoder_funcs sun4i_hdmi_funcs 
> = {
> .destroy= drm_encoder_cleanup,
>  };
>
> -static int sun4i_hdmi_read_sub_block(struct sun4i_hdmi *hdmi,
> -unsigned int blk, unsigned int offset,
> -u8 *buf, unsigned int count)
> -{
> -   unsigned long reg;
> -   int i;
> -
> -   reg = readl(hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
> -   reg &= ~SUN4I_HDMI_DDC_CTRL_FIFO_DIR_MASK;
> -   writel(reg | SUN4I_HDMI_DDC_CTRL_FIFO_DIR_READ,
> -  hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
> -
> -   writel(SUN4I_HDMI_DDC_ADDR_SEGMENT(offset >> 8) |
> -  SUN4I_HDMI_DDC_ADDR_EDDC(DDC_SEGMENT_ADDR << 1) |
> -  SUN4I_HDMI_DDC_ADDR_OFFSET(offset) |
> -  SUN4I_HDMI_DDC_ADDR_SLAVE(DDC_ADDR),
> -  hdmi->base + SUN4I_HDMI_DDC_ADDR_REG);
> -
> -   reg = readl(hdmi->base + SUN4I_HDMI_DDC_FIFO_CTRL_REG);
> -   writel(reg | SUN4I_HDMI_DDC_FIFO_CTRL_CLEAR,
> -  hdmi->base + SUN4I_HDMI_DDC_FIFO_CTRL_REG);
> -
> -   writel(count, hdmi->base + SUN4I_HDMI_DDC_BYTE_COUNT_REG);
> -   writel(SUN4I_HDMI_DDC_CMD_EXPLICIT_EDDC_READ,
> -  hdmi->base + SUN4I_HDMI_DDC_CMD_REG);
> -

[PATCH 11/27] hexagon: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/hexagon/include/asm/Kbuild  | 23 ---
 arch/hexagon/include/uapi/asm/Kbuild | 24 
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index 6b45ef79eb8f..28d1fe16278e 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -1,4 +1,3 @@
-generic-y += auxvec.h
 generic-y += barrier.h
 generic-y += bug.h
 generic-y += bugs.h
@@ -7,17 +6,12 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += extable.h
 generic-y += fb.h
-generic-y += fcntl.h
 generic-y += ftrace.h
 generic-y += hardirq.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ioctls.h
 generic-y += iomap.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
@@ -26,33 +20,16 @@ generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
-generic-y += msgbuf.h
 generic-y += pci.h
 generic-y += percpu.h
-generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += rwsem.h
 generic-y += sections.h
 generic-y += segment.h
-generic-y += sembuf.h
 generic-y += serial.h
-generic-y += shmbuf.h
-generic-y += shmparam.h
-generic-y += siginfo.h
 generic-y += sizes.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += stat.h
-generic-y += statfs.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += topology.h
 generic-y += trace_clock.h
-generic-y += types.h
-generic-y += ucontext.h
 generic-y += unaligned.h
 generic-y += vga.h
 generic-y += word-at-a-time.h
diff --git a/arch/hexagon/include/uapi/asm/Kbuild 
b/arch/hexagon/include/uapi/asm/Kbuild
index b15bf6bc0e94..cb5df3aad3a8 100644
--- a/arch/hexagon/include/uapi/asm/Kbuild
+++ b/arch/hexagon/include/uapi/asm/Kbuild
@@ -1,2 +1,26 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
+
+generic-y += auxvec.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ioctls.h
+generic-y += ipcbuf.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += poll.h
+generic-y += posix_types.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += shmbuf.h
+generic-y += shmparam.h
+generic-y += siginfo.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += stat.h
+generic-y += statfs.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
+generic-y += ucontext.h
-- 
2.7.4



[PATCH 07/27] blackfin: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/blackfin/include/asm/Kbuild  | 22 --
 arch/blackfin/include/uapi/asm/Kbuild | 22 ++
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index dc4ef9ac1e83..080cac9d6704 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -1,48 +1,26 @@
-
-generic-y += auxvec.h
-generic-y += bitsperlong.h
 generic-y += bugs.h
 generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += extable.h
 generic-y += fb.h
 generic-y += futex.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
-generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
-generic-y += msgbuf.h
-generic-y += param.h
 generic-y += percpu.h
 generic-y += pgalloc.h
 generic-y += preempt.h
-generic-y += resource.h
-generic-y += sembuf.h
 generic-y += serial.h
-generic-y += setup.h
-generic-y += shmbuf.h
-generic-y += shmparam.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += statfs.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += topology.h
 generic-y += trace_clock.h
-generic-y += types.h
-generic-y += ucontext.h
 generic-y += unaligned.h
 generic-y += user.h
 generic-y += word-at-a-time.h
diff --git a/arch/blackfin/include/uapi/asm/Kbuild 
b/arch/blackfin/include/uapi/asm/Kbuild
index b15bf6bc0e94..aa624b4ab655 100644
--- a/arch/blackfin/include/uapi/asm/Kbuild
+++ b/arch/blackfin/include/uapi/asm/Kbuild
@@ -1,2 +1,24 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
+
+generic-y += auxvec.h
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += ioctl.h
+generic-y += ipcbuf.h
+generic-y += kvm_para.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += param.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += setup.h
+generic-y += shmbuf.h
+generic-y += shmparam.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += statfs.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
+generic-y += ucontext.h
-- 
2.7.4



[PATCH 19/27] parisc: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/parisc/include/asm/Kbuild  | 5 -
 arch/parisc/include/uapi/asm/Kbuild | 4 
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index a9909c2d04c5..e26348d52ecc 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -1,5 +1,3 @@
-
-generic-y += auxvec.h
 generic-y += barrier.h
 generic-y += clkdev.h
 generic-y += current.h
@@ -11,14 +9,11 @@ generic-y += hw_irq.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
-generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += param.h
 generic-y += percpu.h
-generic-y += poll.h
 generic-y += preempt.h
 generic-y += seccomp.h
 generic-y += segment.h
diff --git a/arch/parisc/include/uapi/asm/Kbuild 
b/arch/parisc/include/uapi/asm/Kbuild
index 3971c60a7e7f..196d2a4efb31 100644
--- a/arch/parisc/include/uapi/asm/Kbuild
+++ b/arch/parisc/include/uapi/asm/Kbuild
@@ -1,4 +1,8 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
+generic-y += auxvec.h
+generic-y += kvm_para.h
+generic-y += param.h
+generic-y += poll.h
 generic-y += resource.h
-- 
2.7.4



[PATCH 14/27] m68k: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

For m68k, "generic-y += termios.h" is doubled in asm/Kbuild and
uapi/asm/Kbuild.  So, the one in the former can be simply removed.

Signed-off-by: Masahiro Yamada 
---

 arch/m68k/include/asm/Kbuild  | 12 
 arch/m68k/include/uapi/asm/Kbuild | 11 +++
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 82005d2ff717..2e547df53344 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -1,37 +1,25 @@
 generic-y += barrier.h
-generic-y += bitsperlong.h
 generic-y += clkdev.h
 generic-y += device.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += exec.h
 generic-y += extable.h
 generic-y += futex.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
-generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
 generic-y += percpu.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += sections.h
-generic-y += shmparam.h
-generic-y += siginfo.h
 generic-y += spinlock.h
-generic-y += statfs.h
-generic-y += termios.h
 generic-y += topology.h
 generic-y += trace_clock.h
-generic-y += types.h
 generic-y += word-at-a-time.h
 generic-y += xor.h
 generic-y += kprobes.h
diff --git a/arch/m68k/include/uapi/asm/Kbuild 
b/arch/m68k/include/uapi/asm/Kbuild
index 64368077235a..3717b64a620d 100644
--- a/arch/m68k/include/uapi/asm/Kbuild
+++ b/arch/m68k/include/uapi/asm/Kbuild
@@ -2,10 +2,21 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += auxvec.h
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += ioctl.h
+generic-y += ipcbuf.h
+generic-y += kvm_para.h
+generic-y += mman.h
 generic-y += msgbuf.h
+generic-y += resource.h
 generic-y += sembuf.h
 generic-y += shmbuf.h
+generic-y += shmparam.h
+generic-y += siginfo.h
 generic-y += socket.h
 generic-y += sockios.h
+generic-y += statfs.h
 generic-y += termbits.h
 generic-y += termios.h
+generic-y += types.h
-- 
2.7.4



[PATCH 06/27] arc: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

Signed-off-by: Masahiro Yamada 
---

 arch/arc/include/asm/Kbuild  | 25 -
 arch/arc/include/uapi/asm/Kbuild | 26 ++
 2 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 7bee4e4799fd..353dae386b2f 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -1,52 +1,27 @@
-generic-y += auxvec.h
-generic-y += bitsperlong.h
 generic-y += bugs.h
 generic-y += clkdev.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += extable.h
 generic-y += fb.h
-generic-y += fcntl.h
 generic-y += ftrace.h
 generic-y += hardirq.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kmap_types.h
-generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
-generic-y += msgbuf.h
 generic-y += msi.h
-generic-y += param.h
 generic-y += parport.h
 generic-y += pci.h
 generic-y += percpu.h
-generic-y += poll.h
-generic-y += posix_types.h
 generic-y += preempt.h
-generic-y += resource.h
-generic-y += sembuf.h
-generic-y += shmbuf.h
-generic-y += siginfo.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += stat.h
-generic-y += statfs.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += topology.h
 generic-y += trace_clock.h
-generic-y += types.h
-generic-y += ucontext.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += word-at-a-time.h
diff --git a/arch/arc/include/uapi/asm/Kbuild b/arch/arc/include/uapi/asm/Kbuild
index b15bf6bc0e94..fa6d0ff4ff89 100644
--- a/arch/arc/include/uapi/asm/Kbuild
+++ b/arch/arc/include/uapi/asm/Kbuild
@@ -1,2 +1,28 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
+
+generic-y += auxvec.h
+generic-y += bitsperlong.h
+generic-y += errno.h
+generic-y += fcntl.h
+generic-y += ioctl.h
+generic-y += ioctls.h
+generic-y += ipcbuf.h
+generic-y += kvm_para.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += param.h
+generic-y += poll.h
+generic-y += posix_types.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += shmbuf.h
+generic-y += siginfo.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += stat.h
+generic-y += statfs.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
+generic-y += ucontext.h
-- 
2.7.4



[PATCH 04/27] arm64: move generic-y of exported headers to uapi/asm/Kbuild

2017-06-11 Thread Masahiro Yamada
Since commit fcc8487d477a ("uapi: export all headers under uapi
directories"), all (and only) headers under uapi directories are
exported, but asm-generic wrappers are still exceptions.

scripts/Makefile.headersinst still need to deal with old-kbuild-file
for headers listed in arch/*/include/asm/Kbuild, but actually exported.

As the last work to finish de-coupling the uapi from kernel headers,
move generic-y of exported headers to uapi/asm/Kbuild.

For arm64, "generic-y += kvm_para.h" is doubled in asm/Kbuild and
uapi/asm/Kbuild.  So, the one in the former can be simply removed.

Signed-off-by: Masahiro Yamada 
---

 arch/arm64/include/asm/Kbuild  | 17 -
 arch/arm64/include/uapi/asm/Kbuild | 16 
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index a7a97a608033..f81c7b685fc6 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -6,41 +6,24 @@ generic-y += dma.h
 generic-y += dma-contiguous.h
 generic-y += early_ioremap.h
 generic-y += emergency-restart.h
-generic-y += errno.h
 generic-y += hw_irq.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += irq_regs.h
 generic-y += kdebug.h
 generic-y += kmap_types.h
-generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += mman.h
-generic-y += msgbuf.h
 generic-y += msi.h
-generic-y += poll.h
 generic-y += preempt.h
-generic-y += resource.h
 generic-y += rwsem.h
 generic-y += segment.h
-generic-y += sembuf.h
 generic-y += serial.h
 generic-y += set_memory.h
-generic-y += shmbuf.h
 generic-y += simd.h
 generic-y += sizes.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += swab.h
 generic-y += switch_to.h
-generic-y += termbits.h
-generic-y += termios.h
 generic-y += trace_clock.h
-generic-y += types.h
 generic-y += unaligned.h
 generic-y += user.h
 generic-y += vga.h
diff --git a/arch/arm64/include/uapi/asm/Kbuild 
b/arch/arm64/include/uapi/asm/Kbuild
index 13a97aa2285f..fc28bd95c6d3 100644
--- a/arch/arm64/include/uapi/asm/Kbuild
+++ b/arch/arm64/include/uapi/asm/Kbuild
@@ -1,4 +1,20 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
+generic-y += errno.h
+generic-y += ioctl.h
+generic-y += ioctls.h
+generic-y += ipcbuf.h
 generic-y += kvm_para.h
+generic-y += mman.h
+generic-y += msgbuf.h
+generic-y += poll.h
+generic-y += resource.h
+generic-y += sembuf.h
+generic-y += shmbuf.h
+generic-y += socket.h
+generic-y += sockios.h
+generic-y += swab.h
+generic-y += termbits.h
+generic-y += termios.h
+generic-y += types.h
-- 
2.7.4



[PATCH] f2fs: fix ref of discard command

2017-06-11 Thread Jaegeuk Kim
This patch resolves kernel panic for xfstests/081, caused by recent f2fs_bug_on

  f2fs: add f2fs_bug_on in __remove_discard_cmd

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/segment.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 86a0c1095939..a6d77388a806 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1025,6 +1025,8 @@ static void __wait_discard_cmd(struct f2fs_sb_info *sbi, 
bool wait_cond)
list_for_each_entry_safe(dc, tmp, wait_list, list) {
if (!wait_cond || (dc->state == D_DONE && !dc->ref)) {
wait_for_completion_io(&dc->wait);
+   if (dc->state == D_DONE && dc->ref)
+   dc->ref--;
__remove_discard_cmd(sbi, dc);
} else {
dc->ref++;
-- 
2.13.0.rc1.294.g07d810a77f-goog



Re: [PATCH v8 10/10] tracing/hyper-v: trace hyperv_mmu_flush_tlb_others()

2017-06-11 Thread Vitaly Kuznetsov
Steven Rostedt  writes:

> On Fri, 09 Jun 2017 20:53:53 +0200
> Paul Bolle  wrote:
>
>> On Fri, 2017-06-09 at 14:32 -0400, Steven Rostedt wrote:
>> > I'm sure it works, but it just adds one more way of doing the same
>> > thing. I thought that was what perl was always criticized for, and why
>> > people usually prefer python. Don't get me wrong, I prefer oysters over
>> > snakes. But I just wanted to point out the lack of consistency here.  
>> 
>> A major benefit is that
>> #if IS_ENABLED(CONFIG_HYPERV)
>> 
>> is shorter than
>> #if defined(CONFIG_HYPERV) || defined(CONFIG_HYPERV_MODULE)
>> 
>> and less prone to typos.
>> 
>
> I don't believe the module version is needed here. Otherwise I would
> question the #if altogether. Which now I'm looking at it, why is it
> needed?
>
> What includes this header file that wouldn't have that set anyway? The
> only place it is included is in:
>
>  arch/x86/hyperv/mmu.c
>
> Is that compiled without CONFIG_HYPERV?

No, it is not but as was already mentioned it is valid and common to have
CONFIG_HYPERV=m (we should've probably done things differently in the past;
CONFIG_HYPERV=y/n should've been used for indicating Hyper-V support and
something like CONFIG_HYPERV_VMBUS=y/m/n to say if we want to have vmbus
as a module but...).

arch/x86/hyperv/mmu.c is compiled in vmlinux when CONFIG_HYPERV is
enabled in any way, this is updated in PATCH8 of this series:

diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
index 586b786..3e6f640 100644
--- a/arch/x86/Kbuild
+++ b/arch/x86/Kbuild
@@ -8,7 +8,7 @@ obj-$(CONFIG_KVM) += kvm/
 obj-$(CONFIG_XEN) += xen/

 # Hyper-V paravirtualization support
-obj-$(CONFIG_HYPERVISOR_GUEST) += hyperv/
+obj-$(subst m,y,$(CONFIG_HYPERV)) += hyperv/

 # lguest paravirtualization support
 obj-$(CONFIG_LGUEST_GUEST) += lguest/

(it was Andy who suggested we use 'subst', not me :-)

So we can't just change IS_ENABLED -> ifdef in this patch. We can, of
course, write " #if defined(CONFIG_HYPERV) ||
defined(CONFIG_HYPERV_MODULE)" but we were replacing it with IF_ENABLED
in the past, not sure we should do that. Dropping the #if altogether is
possible, but why having it when CONFIG_HYPERV=n?

-- 
  Vitaly


Re: [GIT PULL] random bug fixes for 4.12

2017-06-11 Thread Jason A. Donenfeld
Since it looks like Linus already pulled, here's the diff-commit I
made from before, that you can submit on top:

https://lkml.org/lkml/2017/6/8/408

It should row "Cc: sta...@vger.kernel.org" if it's not going to be
rebased into the existing commit there.


panel-samsung-s6e3ha2.c:undefined reference to `backlight_device_unregister'

2017-06-11 Thread kbuild test robot
Hi Dave,

It's probably a bug fix that unveils the link errors.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   32c1431eea4881a6b17bd7c639315010aeefa452
commit: ab6eb211b07a42a6346e284056422fd9a8576a99 Merge tag 
'drm/panel/for-4.12-rc1' of git://anongit.freedesktop.org/tegra/linux into 
drm-next
date:   9 weeks ago
config: x86_64-randconfig-h0-06120933 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
git checkout ab6eb211b07a42a6346e284056422fd9a8576a99
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `s6e3ha2_remove':
>> panel-samsung-s6e3ha2.c:(.text+0x1a238e): undefined reference to 
>> `backlight_device_unregister'
   drivers/built-in.o: In function `s6e3ha2_probe':
>> panel-samsung-s6e3ha2.c:(.text+0x1a257d): undefined reference to 
>> `backlight_device_register'
   panel-samsung-s6e3ha2.c:(.text+0x1a2672): undefined reference to 
`backlight_device_unregister'

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


.config.gz
Description: application/gzip


Re: [PATCH v1] shebang: restrict python interactive prompt/interpreter

2017-06-11 Thread Mimi Zohar
On Sun, 2017-06-11 at 13:44 +0200, Mickaël Salaün wrote:
> On 10/06/2017 07:27, Tetsuo Handa wrote:
> > Kees Cook wrote:
> >> On Fri, Jun 9, 2017 at 10:23 AM, Matt Brown  wrote:
> >>> what does everyone thing about a envp_blacklist option that is a list of
> >>> environmental variables that will be stripped from exec calls. This can
> >>> be done in the LSM hook bprm_check_security.
> >>>
> >>> Is there any reason on a hardened system why you would need the
> >>> PYTHONINSPECT environmental variable?
> >>
> >> As part of shebang, it likely makes sense to whitelist (rather than
> >> blacklist) the env of the restricted interpreters. Though this is
> >> starting to get complex. :P
> > 
> > Blacklisting environment variables is dangerous. I think that
> > administrators can afford whitelisting environment variable names.
> > I think that implementing whitelist of environment variable names
> > as an independent LSM module would be fine.
> > 
> > While it is true that things starts getting complex if we check environment
> > variables, shebang will already become complex if it starts worrying about
> > updating inode number list in order to close the race window between doing
> > creat()+write()+close()+chmod()+rename() by the package manager and teaching
> > the kernel the new inode number determined by creat(). We will need an
> > interface for allowing the package manager to teach the kernel the new inode
> > number and modification of the package manager, for the kernel side is doing
> > inode number based blacklisting while user side can execute it before 
> > rename().

I don't think we're trying to protect against executing the
interpreter prior to the rename.  Rename, itself, would trigger
associating the interpreter name with an inode number.

> > --
> > To unsubscribe from this list: send the line "unsubscribe 
> > linux-security-module" in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 
> Using filesystem xattr seems like a good idea for this kind of
> exceptions and instead of a hardcoded interpreter path. Something like
> "security.tpe.interpreter=1|2" (bitmask for interpreter-only and/or CLI)
> and "security.tpe.environment=HOME,LOGNAME" would be quite flexible to
> configure a security policy for some binaries. This could also be
> protected by IMA/EVM, if needed.

Checking for the existence of an xattr without caching is relatively
slow.  I'm not sure that we would want to go this route.

> This kind of xattr should be writable by the owner of the file. The TPE
> LSM [1] could then take these xattr into account according to the TPE
> policy.

Security xattrs are only writable by root.

Mimi

> The "security.tpe.environment" could also be set on a script file to be
> part of the union with the interpreter's environment whitelist. This may
> be needed to be able to use environment variables as configuration in a
> script.
> 
> In the future, a "security.tpe.memory" could contain a set of flags as
> PaX uses for mprotect-like exceptions (user.pax.flags).
> 
> Userland daemons such as paxctld or paxrat could be used (with some
> tweaks) to keep a consistent TPE policy over time.
> 
>  Mickaël
> 
> 
> [1] https://lkml.kernel.org/r/1497015878.21594.201.ca...@linux.vnet.ibm.com
> 



[PATCH] audit: style fix

2017-06-11 Thread Derek Robson
Fixed checkpatch.pl warnings of "function definition argument FOO
 should also have an identifier name"

Signed-off-by: Derek Robson 
---
 kernel/audit.h | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/kernel/audit.h b/kernel/audit.h
index ddfce2ea4891..90b891eea204 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -247,13 +247,13 @@ struct audit_netlink_list {
struct sk_buff_head q;
 };
 
-int audit_send_list(void *);
+int audit_send_list(void *_dest);
 
 extern int selinux_audit_rule_update(void);
 
 extern struct mutex audit_filter_mutex;
-extern int audit_del_rule(struct audit_entry *);
-extern void audit_free_rule_rcu(struct rcu_head *);
+extern int audit_del_rule(struct audit_entry *entry);
+extern void audit_free_rule_rcu(struct rcu_head *head);
 extern struct list_head audit_filter_list[];
 
 extern struct audit_entry *audit_dupe_rule(struct audit_krule *old);
@@ -301,17 +301,17 @@ extern int audit_exe_compare(struct task_struct *tsk, 
struct audit_fsnotify_mark
 #endif /* CONFIG_AUDIT_WATCH */
 
 #ifdef CONFIG_AUDIT_TREE
-extern struct audit_chunk *audit_tree_lookup(const struct inode *);
-extern void audit_put_chunk(struct audit_chunk *);
-extern bool audit_tree_match(struct audit_chunk *, struct audit_tree *);
-extern int audit_make_tree(struct audit_krule *, char *, u32);
-extern int audit_add_tree_rule(struct audit_krule *);
-extern int audit_remove_tree_rule(struct audit_krule *);
+extern struct audit_chunk *audit_tree_lookup(const struct inode *inode);
+extern void audit_put_chunk(struct audit_chunk *chunk);
+extern bool audit_tree_match(struct audit_chunk *chunk, struct audit_tree 
*tree);
+extern int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op);
+extern int audit_add_tree_rule(struct audit_krule *rule);
+extern int audit_remove_tree_rule(struct audit_krule *rule);
 extern void audit_trim_trees(void);
 extern int audit_tag_tree(char *old, char *new);
-extern const char *audit_tree_path(struct audit_tree *);
-extern void audit_put_tree(struct audit_tree *);
-extern void audit_kill_trees(struct list_head *);
+extern const char *audit_tree_path(struct audit_tree *tree);
+extern void audit_put_tree(struct audit_tree *tree);
+extern void audit_kill_trees(struct list_head *list);
 #else
 #define audit_remove_tree_rule(rule) BUG()
 #define audit_add_tree_rule(rule) -EINVAL
@@ -323,7 +323,7 @@ extern void audit_kill_trees(struct list_head *);
 #define audit_kill_trees(list) BUG()
 #endif
 
-extern char *audit_unpack_string(void **, size_t *, size_t);
+extern char *audit_unpack_string(void **bufp, size_t *remain, size_t len);
 
 extern pid_t audit_sig_pid;
 extern kuid_t audit_sig_uid;
@@ -333,7 +333,7 @@ extern int audit_filter(int msgtype, unsigned int listtype);
 
 #ifdef CONFIG_AUDITSYSCALL
 extern int audit_signal_info(int sig, struct task_struct *t);
-extern void audit_filter_inodes(struct task_struct *, struct audit_context *);
+extern void audit_filter_inodes(struct task_struct *tsk, struct audit_context 
*ctx);
 extern struct list_head *audit_killed_trees(void);
 #else
 #define audit_signal_info(s,t) AUDIT_DISABLED
-- 
2.13.0



Re: [GIT PULL] random bug fixes for 4.12

2017-06-11 Thread Jason A. Donenfeld
Hi Ted,

Did you forget this discussion [1][2][3], where we talked about how
you accidentally pulled v4 instead of v5, and would replace that v4
patch [4] with the v5 one [5]?

Jason

[1] https://lkml.org/lkml/2017/6/8/1046
[2] https://lkml.org/lkml/2017/6/8/1173
[3] https://lkml.org/lkml/2017/6/8/1173
[4] http://www.openwall.com/lists/kernel-hardening/2017/06/06/50
[5] https://patchwork.kernel.org/patch/9773235/


Re: [PATCH v1 2/2] selftests: kselftest_harness: Fix compile warning

2017-06-11 Thread Kees Cook
On Sun, Jun 11, 2017 at 5:32 AM, Mickaël Salaün  wrote:
> Do not confuse the compiler with a semicolon preceding a block. Replace
> the semicolon with an empty block to avoid a warning:
>
>   gcc -Wl,-no-as-needed -Wall -lpthread seccomp_bpf.c -o 
> /.../linux/tools/testing/selftests/seccomp/seccomp_bpf
>   In file included from seccomp_bpf.c:40:0:
>   seccomp_bpf.c: In function ‘change_syscall’:
>   ../kselftest_harness.h:558:2: warning: this ‘for’ clause does not guard... 
> [-Wmisleading-indentation]
> for (; _metadata->trigger;  _metadata->trigger = __bail(_assert))
> ^
>   ../kselftest_harness.h:574:14: note: in expansion of macro 
> ‘OPTIONAL_HANDLER’
>} while (0); OPTIONAL_HANDLER(_assert)
> ^~~~
>   ../kselftest_harness.h:440:2: note: in expansion of macro ‘__EXPECT’
> __EXPECT(expected, seen, ==, 0)
> ^~~~
>   seccomp_bpf.c:1313:2: note: in expansion of macro ‘EXPECT_EQ’
> EXPECT_EQ(0, ret);
> ^
>   seccomp_bpf.c:1317:2: note: ...this statement, but the latter is 
> misleadingly indented as if it is guarded by the ‘for’
> {
> ^
>
> Signed-off-by: Mickaël Salaün 
> Cc: Andy Lutomirski 
> Cc: Kees Cook 
> Cc: Shuah Khan 
> Cc: Will Drewry 

Eek, thanks for catching that. :)

Acked-by: Kees Cook 

-Kees

> ---
>  tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c 
> b/tools/testing/selftests/seccomp/seccomp_bpf.c
> index 7ba94efb24fd..18dad07ae16b 100644
> --- a/tools/testing/selftests/seccomp/seccomp_bpf.c
> +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
> @@ -1310,7 +1310,7 @@ void change_syscall(struct __test_metadata *_metadata,
> iov.iov_len = sizeof(regs);
> ret = ptrace(PTRACE_GETREGSET, tracee, NT_PRSTATUS, &iov);
>  #endif
> -   EXPECT_EQ(0, ret);
> +   EXPECT_EQ(0, ret) {}
>
>  #if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \
>  defined(__s390__) || defined(__hppa__)
> --
> 2.11.0
>



-- 
Kees Cook
Pixel Security


RE: [PATCH] security: selinux: use kmem_cache for ebitmap

2017-06-11 Thread Junil Lee
Dear Paul.
Thank you for your support.
I hope you'll be always happy.

Thanks,
Junil Lee.

> -Original Message-
> From: Paul Moore [mailto:p...@paul-moore.com]
> Sent: Saturday, June 10, 2017 5:17 AM
> To: Junil Lee 
> Cc: Stephen Smalley ; Eric Paris ;
> James Morris ; se...@hallyn.com;
> william.c.robe...@intel.com; adobri...@gmail.com; a...@linux-foundation.org;
> dledf...@redhat.com; dani...@mellanox.com; m...@chromium.org;
> seli...@tycho.nsa.gov; linux-security-mod...@vger.kernel.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH] security: selinux: use kmem_cache for ebitmap
> 
> On Thu, Jun 8, 2017 at 12:18 AM, Junil Lee  wrote:
> > The allocated size for each ebitmap_node is 192byte by kzalloc().
> > Then, ebitmap_node size is fixed, so it's possible to use only 144byte
> > for each object by kmem_cache_zalloc().
> > It can reduce some dynamic allocation size.
> >
> > Signed-off-by: Junil Lee 
> > ---
> >  security/selinux/ss/ebitmap.c  | 26 --
> > security/selinux/ss/ebitmap.h  |  3 +++
> > security/selinux/ss/services.c |  4 
> >  3 files changed, 27 insertions(+), 6 deletions(-)
> 
> I just applied this to selinux/next, thank you.
> 
> > diff --git a/security/selinux/ss/ebitmap.c
> > b/security/selinux/ss/ebitmap.c index 9db4709a..ad38299 100644
> > --- a/security/selinux/ss/ebitmap.c
> > +++ b/security/selinux/ss/ebitmap.c
> > @@ -24,6 +24,8 @@
> >
> >  #define BITS_PER_U64   (sizeof(u64) * 8)
> >
> > +static struct kmem_cache *ebitmap_node_cachep;
> > +
> >  int ebitmap_cmp(struct ebitmap *e1, struct ebitmap *e2)  {
> > struct ebitmap_node *n1, *n2;
> > @@ -54,7 +56,7 @@ int ebitmap_cpy(struct ebitmap *dst, struct ebitmap
> *src)
> > n = src->node;
> > prev = NULL;
> > while (n) {
> > -   new = kzalloc(sizeof(*new), GFP_ATOMIC);
> > +   new = kmem_cache_zalloc(ebitmap_node_cachep,
> > + GFP_ATOMIC);
> > if (!new) {
> > ebitmap_destroy(dst);
> > return -ENOMEM; @@ -162,7 +164,7 @@ int
> > ebitmap_netlbl_import(struct ebitmap *ebmap,
> > if (e_iter == NULL ||
> > offset >= e_iter->startbit + EBITMAP_SIZE) {
> > e_prev = e_iter;
> > -   e_iter = kzalloc(sizeof(*e_iter), GFP_ATOMIC);
> > +   e_iter =
> > + kmem_cache_zalloc(ebitmap_node_cachep, GFP_ATOMIC);
> > if (e_iter == NULL)
> > goto netlbl_import_failure;
> > e_iter->startbit = offset - (offset %
> > EBITMAP_SIZE); @@ -288,7 +290,7 @@ int ebitmap_set_bit(struct ebitmap *e,
> unsigned long bit, int value)
> > prev->next = n->next;
> > else
> > e->node = n->next;
> > -   kfree(n);
> > +   kmem_cache_free(ebitmap_node_cachep,
> > + n);
> > }
> > return 0;
> > }
> > @@ -299,7 +301,7 @@ int ebitmap_set_bit(struct ebitmap *e, unsigned long
> bit, int value)
> > if (!value)
> > return 0;
> >
> > -   new = kzalloc(sizeof(*new), GFP_ATOMIC);
> > +   new = kmem_cache_zalloc(ebitmap_node_cachep, GFP_ATOMIC);
> > if (!new)
> > return -ENOMEM;
> >
> > @@ -332,7 +334,7 @@ void ebitmap_destroy(struct ebitmap *e)
> > while (n) {
> > temp = n;
> > n = n->next;
> > -   kfree(temp);
> > +   kmem_cache_free(ebitmap_node_cachep, temp);
> > }
> >
> > e->highbit = 0;
> > @@ -400,7 +402,7 @@ int ebitmap_read(struct ebitmap *e, void *fp)
> >
> > if (!n || startbit >= n->startbit + EBITMAP_SIZE) {
> > struct ebitmap_node *tmp;
> > -   tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
> > +   tmp = kmem_cache_zalloc(ebitmap_node_cachep,
> > + GFP_KERNEL);
> > if (!tmp) {
> > printk(KERN_ERR
> >"SELinux: ebitmap: out of
> > memory\n"); @@ -519,3 +521,15 @@ int ebitmap_write(struct ebitmap *e,
> void *fp)
> > }
> > return 0;
> >  }
> > +
> > +void ebitmap_cache_init(void)
> > +{
> > +   ebitmap_node_cachep = kmem_cache_create("ebitmap_node",
> > +   sizeof(struct
> ebitmap_node),
> > +   0, SLAB_PANIC,
> > +NULL); }
> > +
> > +void ebitmap_cache_destroy(void)
> > +{
> > +   kmem_cache_destroy(ebitmap_node_cachep);
> > +}
> > diff --git a/security/selinux/ss/ebitmap.h
> > b/security/selinux/ss/ebitmap.h index 9637b8c..6d5a9ac 100644
> > --- a/security/selinux/ss/ebitmap.h
> > +++ b

mdio-thunder.c:undefined reference to `mdiobus_unregister'

2017-06-11 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   32c1431eea4881a6b17bd7c639315010aeefa452
commit: 90eff9096c01ba90cdae504a6b95ee87fe2556a3 net: phy: Allow splitting MDIO 
bus/device support from PHYs
date:   3 months ago
config: x86_64-randconfig-s2-06120830 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
git checkout 90eff9096c01ba90cdae504a6b95ee87fe2556a3
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `thunder_mdiobus_pci_remove':
>> mdio-thunder.c:(.text+0x2a212f): undefined reference to `mdiobus_unregister'
>> mdio-thunder.c:(.text+0x2a2138): undefined reference to `mdiobus_free'
   drivers/built-in.o: In function `thunder_mdiobus_pci_probe':
   mdio-thunder.c:(.text+0x2a22e7): undefined reference to 
`devm_mdiobus_alloc_size'
   mdio-thunder.c:(.text+0x2a236f): undefined reference to `of_mdiobus_register'

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


.config.gz
Description: application/gzip


[PATCH] drm/sun4i: hdmi: Implement I2C adapter for A10s DDC bus

2017-06-11 Thread Jonathan Liu
The drm_get_edid function should be used instead of drm_do_get_edid by
exposing the DDC bus as an I2C adapter. Implement this for A10s.

Signed-off-by: Jonathan Liu 
---
 drivers/gpu/drm/sun4i/Makefile |   1 +
 drivers/gpu/drm/sun4i/sun4i_hdmi.h |  11 ++-
 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c |  96 +++
 drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c | 166 +
 4 files changed, 190 insertions(+), 84 deletions(-)
 create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi_i2c.c

diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
index e29fd3a2ba9c..43c753cafc88 100644
--- a/drivers/gpu/drm/sun4i/Makefile
+++ b/drivers/gpu/drm/sun4i/Makefile
@@ -2,6 +2,7 @@ sun4i-drm-y += sun4i_drv.o
 sun4i-drm-y += sun4i_framebuffer.o
 
 sun4i-drm-hdmi-y += sun4i_hdmi_enc.o
+sun4i-drm-hdmi-y += sun4i_hdmi_i2c.o
 sun4i-drm-hdmi-y += sun4i_hdmi_ddc_clk.o
 sun4i-drm-hdmi-y += sun4i_hdmi_tmds_clk.o
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h 
b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
index 2589bc92be59..8e7a70f67f04 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
@@ -100,6 +100,7 @@
 #define SUN4I_HDMI_DDC_CTRL_START_CMD  BIT(30)
 #define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_MASK  BIT(8)
 #define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_READ  (0 << 8)
+#define SUN4I_HDMI_DDC_CTRL_FIFO_DIR_WRITE (1 << 8)
 #define SUN4I_HDMI_DDC_CTRL_RESET  BIT(0)
 
 #define SUN4I_HDMI_DDC_ADDR_REG0x504
@@ -108,6 +109,10 @@
 #define SUN4I_HDMI_DDC_ADDR_OFFSET(off)(((off) & 0xff) << 8)
 #define SUN4I_HDMI_DDC_ADDR_SLAVE(addr)((addr) & 0xff)
 
+#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_REG0x50c
+#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_FIFO_REQUEST   BIT(4)
+#define SUN4I_HDMI_DDC_INTERRUPT_STATUS_TRANSFER_COMPLETE  BIT(0)
+
 #define SUN4I_HDMI_DDC_FIFO_CTRL_REG   0x510
 #define SUN4I_HDMI_DDC_FIFO_CTRL_CLEAR BIT(31)
 
@@ -115,7 +120,8 @@
 #define SUN4I_HDMI_DDC_BYTE_COUNT_REG  0x51c
 
 #define SUN4I_HDMI_DDC_CMD_REG 0x520
-#define SUN4I_HDMI_DDC_CMD_EXPLICIT_EDDC_READ  6
+#define SUN4I_HDMI_DDC_CMD_IMPLICIT_WRITE  3
+#define SUN4I_HDMI_DDC_CMD_IMPLICIT_READ   5
 
 #define SUN4I_HDMI_DDC_CLK_REG 0x528
 #define SUN4I_HDMI_DDC_CLK_M(m)(((m) & 0x7) << 3)
@@ -181,6 +187,8 @@ struct sun4i_hdmi {
struct clk  *ddc_clk;
struct clk  *tmds_clk;
 
+   struct i2c_adapter  *i2c;
+
struct sun4i_drv*drv;
 
boolhdmi_monitor;
@@ -192,5 +200,6 @@ int sun4i_ddc_create(struct sun4i_hdmi *hdmi, struct clk 
*clk);
 int sun6i_ddc_create(struct sun4i_hdmi *hdmi, struct clk *clk);
 int sun4i_tmds_create(struct sun4i_hdmi *hdmi);
 int sun6i_tmds_create(struct sun4i_hdmi *hdmi);
+int sun4i_hdmi_i2c_create(struct sun4i_hdmi *hdmi);
 
 #endif /* _SUN4I_HDMI_H_ */
diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c 
b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
index e9abf93eb41c..6c9b11c4cf68 100644
--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
+++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
@@ -186,93 +186,13 @@ static const struct drm_encoder_funcs sun4i_hdmi_funcs = {
.destroy= drm_encoder_cleanup,
 };
 
-static int sun4i_hdmi_read_sub_block(struct sun4i_hdmi *hdmi,
-unsigned int blk, unsigned int offset,
-u8 *buf, unsigned int count)
-{
-   unsigned long reg;
-   int i;
-
-   reg = readl(hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
-   reg &= ~SUN4I_HDMI_DDC_CTRL_FIFO_DIR_MASK;
-   writel(reg | SUN4I_HDMI_DDC_CTRL_FIFO_DIR_READ,
-  hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
-
-   writel(SUN4I_HDMI_DDC_ADDR_SEGMENT(offset >> 8) |
-  SUN4I_HDMI_DDC_ADDR_EDDC(DDC_SEGMENT_ADDR << 1) |
-  SUN4I_HDMI_DDC_ADDR_OFFSET(offset) |
-  SUN4I_HDMI_DDC_ADDR_SLAVE(DDC_ADDR),
-  hdmi->base + SUN4I_HDMI_DDC_ADDR_REG);
-
-   reg = readl(hdmi->base + SUN4I_HDMI_DDC_FIFO_CTRL_REG);
-   writel(reg | SUN4I_HDMI_DDC_FIFO_CTRL_CLEAR,
-  hdmi->base + SUN4I_HDMI_DDC_FIFO_CTRL_REG);
-
-   writel(count, hdmi->base + SUN4I_HDMI_DDC_BYTE_COUNT_REG);
-   writel(SUN4I_HDMI_DDC_CMD_EXPLICIT_EDDC_READ,
-  hdmi->base + SUN4I_HDMI_DDC_CMD_REG);
-
-   reg = readl(hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
-   writel(reg | SUN4I_HDMI_DDC_CTRL_START_CMD,
-  hdmi->base + SUN4I_HDMI_DDC_CTRL_REG);
-
-   if (readl_poll_timeout(hdmi->base + SUN4I_HDMI_DDC_CTRL_REG, reg,
-  !(reg & SUN4I_HDMI_DDC_CTRL_START_CMD),
-  100, 10))
-   return -EIO;
-
-   for (i = 0; i < count; i++)
-   buf[i] = readb(hdmi->base + SUN4I_HDMI_DDC_FIFO_DATA_REG);
-
-   return 0;
-}
-
-static int sun4i_hdmi_read_edid_block(vo

[PATCH] pci: endpoint: fix endpoint test build error

2017-06-11 Thread Randy Dunlap
From: Randy Dunlap 

PCI endpoint test driver uses crc32_le() so it should select
CRC32. Fixes this build error (when CRC32=m):

  drivers/built-in.o: In function `pci_epf_test_cmd_handler':
  pci-epf-test.c:(.text+0x2d98d): undefined reference to `crc32_le'

Fixes 349e7a85b25f (PCI: endpoint: functions: Add an EP function to test PCI).

Reported-by: kbuild test robot 
Signed-off-by: Randy Dunlap 
Cc: Kishon Vijay Abraham I 
Cc: Bjorn Helgaas 
---
 drivers/pci/endpoint/functions/Kconfig |1 +
 1 file changed, 1 insertion(+)

--- lnx-412-rc4.orig/drivers/pci/endpoint/functions/Kconfig
+++ lnx-412-rc4/drivers/pci/endpoint/functions/Kconfig
@@ -5,6 +5,7 @@
 config PCI_EPF_TEST
tristate "PCI Endpoint Test driver"
depends on PCI_ENDPOINT
+   select CRC32
help
   Enable this configuration option to enable the test driver
   for PCI Endpoint.




Re: [PATCH v2] arm: eBPF JIT compiler

2017-06-11 Thread Kees Cook
On Tue, Jun 6, 2017 at 12:47 PM, Shubham Bansal
 wrote:
> Hi Russell, Alexei, David, Daniel, kees,
>
> Any update on this patch moving forward?

Since this has gotten testing by various people and passes the
existing self-tests, I think this can probably go in via the ARM patch
tracker? Russell does that sound okay to you?

-Kees

-- 
Kees Cook
Pixel Security


Re: [PATCH v1] zram: Use __sysfs_match_string() helper

2017-06-11 Thread Sergey Senozhatsky
(Cc Andrew)

Link: lkml.kernel.org/r/20170609120835.22156-1-andriy.shevche...@linux.intel.com


On (06/09/17 15:08), Andy Shevchenko wrote:
> Use __sysfs_match_string() helper instead of open coded variant.
> 
> Cc: Minchan Kim 
> Cc: Nitin Gupta 
> Cc: Sergey Senozhatsky 
> Signed-off-by: Andy Shevchenko 

Reviewed-by: Sergey Senozhatsky 

-ss


[PATCH] arm:lpae: build TTB control register value from scratch in v7_ttb_setup

2017-06-11 Thread Hoeun Ryu
 Reading TTBCR in early boot stage might return the value of the previous
kernel's configuration, especially in case of kexec. For example, if
normal kernel (first kernel) had run on a configuration of PHYS_OFFSET <=
PAGE_OFFSET and crash kernel (second kernel) is running on a configuration
PHYS_OFFSET > PAGE_OFFSET, which can happen because it depends on the
reserved area for crash kernel, reading TTBCR and using the value to OR
other bit fields might be risky because it doesn't have a reset value for
TTBCR.

Acked-by: Russell King 
Suggested-by: Robin Murphy 
Signed-off-by: Hoeun Ryu 

---

 * add Acked-by: Russell King 
 * v1: amended based on
 - "[PATCHv2] arm: LPAE: kexec: clear TTBCR.T1SZ explicitly when
PHYS_OFFSET > PAGE_OFFSET"
 - https://lkml.org/lkml/2017/6/5/239

 arch/arm/mm/proc-v7-3level.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 5e5720e..7d16bbc 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -129,8 +129,7 @@ ENDPROC(cpu_v7_set_pte_ext)
.macro  v7_ttb_setup, zero, ttbr0l, ttbr0h, ttbr1, tmp
ldr \tmp, =swapper_pg_dir   @ swapper_pg_dir virtual address
cmp \ttbr1, \tmp, lsr #12   @ PHYS_OFFSET > PAGE_OFFSET?
-   mrc p15, 0, \tmp, c2, c0, 2 @ TTB control egister
-   orr \tmp, \tmp, #TTB_EAE
+   mov \tmp, #TTB_EAE  @ for TTB control egister
ALT_SMP(orr \tmp, \tmp, #TTB_FLAGS_SMP)
ALT_UP(orr  \tmp, \tmp, #TTB_FLAGS_UP)
ALT_SMP(orr \tmp, \tmp, #TTB_FLAGS_SMP << 16)
-- 
2.7.4



[PATCH 2/4] f2fs: fix to document fault injection option and sysfs file

2017-06-11 Thread Chao Yu
Commit 73faec4d9935 ("f2fs: add mount option to select fault injection
ratio") and Commit 087968974fcd ("f2fs: add fault injection to sysfs")
forget to document mount option and sysfs file.

This patch fixes to document them.

Signed-off-by: Chao Yu 
---
 Documentation/ABI/testing/sysfs-fs-f2fs | 12 
 Documentation/filesystems/f2fs.txt  |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs 
b/Documentation/ABI/testing/sysfs-fs-f2fs
index a809f6005f14..ae59451865a6 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -112,3 +112,15 @@ Date:  January 2016
 Contact:   "Shuoran Liu" 
 Description:
 Shows total written kbytes issued to disk.
+
+What:  /sys/fs/f2fs//injection_rate
+Date:  May 2016
+Contact:   "Sheng Yong" 
+Description:
+Contrils the injection rate.
+
+What:  /sys/fs/f2fs//injection_type
+Date:  May 2016
+Contact:   "Sheng Yong" 
+Description:
+Contrils the injection type.
diff --git a/Documentation/filesystems/f2fs.txt 
b/Documentation/filesystems/f2fs.txt
index 4f6531a4701b..8b04a6359530 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -155,6 +155,8 @@ noinline_data  Disable the inline data feature, 
inline data feature is
enabled by default.
 data_flush Enable data flushing before checkpoint in order to
persist data of regular and symlink.
+fault_injection=%d Enable fault injection in all supported types with
+   specified injection rate.
 mode=%sControl block allocation mode which supports "adaptive"
and "lfs". In "lfs" mode, there should be no random
writes towards main area.
-- 
2.13.1.388.g69e6b9b4f4a9



[PATCH 1/4] f2fs: fix to show injection rate in ->show_options

2017-06-11 Thread Chao Yu
If fault injection functionality is enabled, show additional injection
rate in ->show_options.

Signed-off-by: Chao Yu 
---
 fs/f2fs/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 02cda00284e1..1c05763616b2 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -995,7 +995,8 @@ static int f2fs_show_options(struct seq_file *seq, struct 
dentry *root)
seq_printf(seq, ",io_size=%uKB", F2FS_IO_SIZE_KB(sbi));
 #ifdef CONFIG_F2FS_FAULT_INJECTION
if (test_opt(sbi, FAULT_INJECTION))
-   seq_puts(seq, ",fault_injection");
+   seq_printf(seq, ",fault_injection=%u",
+   sbi->fault_info.inject_rate);
 #endif
 #ifdef CONFIG_FS_DAX
if (test_opt(sbi, DAX))
-- 
2.13.1.388.g69e6b9b4f4a9



[PATCH] ubifs : fix oops when remounting with no_bulk_read.

2017-06-11 Thread karam . lee
From: "karam.lee" 

When remounting with the no_bulk_read option,
there is a problem accessing the "bulk_read buffer(bu.buf)"
which has already been freed.

If the bulk_read option is enabled,
ubifs_tnc_bulk_read uses the pre-allocated bu.buf.

While bu.buf is being used by ubifs_tnc_bulk_read,
remounting with no_bulk_read frees bu.buf.

So I added code to check the use of "bu.buf" to avoid this situation.

--
I tested as follows(kernel v3.18) :

Use the script to repeat "no_bulk_read <-> bulk_read"
remount.sh
#!/bin/sh
while true do;
mount -o remount,no_bulk_read ${MOUNT_POINT};
sleep 1;
mount -o remount,bulk_read ${MOUNT_POINT};
sleep 1;
done

Perform read operation
cat ${MOUNT_POINT}/* > /dev/null

The problem is reproduced immediately.

[  234.256845][kernel.0]Internal error: Oops: 17 [#1] PREEMPT ARM
[  234.258557][kernel.0]CPU: 0 PID: 2752 Comm: cat Tainted: GW  O   
3.18.31+ #51
[  234.259531][kernel.0]task: cbff8580 ti: cbd66000 task.ti: cbd66000
[  234.260306][kernel.0]PC is at validate_data_node+0x10/0x264
[  234.260994][kernel.0]LR is at ubifs_tnc_bulk_read+0x388/0x3ec
[  234.261712][kernel.0]pc : []lr : []psr: 8013
[  234.261712][kernel.0]sp : cbd67ba0  ip : 0001  fp : 
[  234.263337][kernel.0]r10: cd3e0260  r9 : c0df2008  r8 : 
[  234.264087][kernel.0]r7 : cd3e  r6 :   r5 : cd3e0278  r4 : 
cd3e
[  234.264999][kernel.0]r3 : 0003  r2 : cd3e0280  r1 :   r0 : 
cd3e
[  234.265910][kernel.0]Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  
Segment user
[  234.266896][kernel.0]Control: 10c53c7d  Table: 8c40c059  DAC: 0015
[  234.267711][kernel.0]Process cat (pid: 2752, stack limit = 0xcbd66400)
[  234.268525][kernel.0]Stack: (0xcbd67ba0 to 0xcbd68000)
[  234.269169][kernel.0]7ba0: cd7c3940 c03d8650 0001bfe0 2ab2  
cbd67c5c cbd67c58 0001bfe0
[  234.270287][kernel.0]7bc0: cd3e 2ab2 0001bfe0 0014 cbd66000 
cd3e0260  c01d6660
[  234.271403][kernel.0]7be0: 2ab2  c82a5800  cd3e0298 
cd3e0278  cd3e
[  234.272520][kernel.0]7c00:   cd3e0260 c01dc300 2ab2 
 6013 d663affa
[  234.273639][kernel.0]7c20: cd3e01f0 cd3e01f0 6013 c09397ec  
cd3e0278 2ab2 
[  234.274755][kernel.0]7c40: cd3e c01dbf48 0014 0003 0160 
0015 0004 d663affa
[  234.275874][kernel.0]7c60: ccdaa978 cd3e0278 cd3e cf32a5f4 ccdaa820 
0044 cbd66000 cd3e0260
[  234.276992][kernel.0]7c80: 0003 c01cec84 ccdaa8dc cbd67cc4 cbd67ec0 
0010 ccdaa978 
[  234.278108][kernel.0]7ca0: 015e ccdaa8dc   cf32a5d0 
 015f ccdaa8dc
[  234.279228][kernel.0]7cc0:  c8488300 0009e5a4 000e cbd66000 
015e cf32a5f4 c0113c04
[  234.280346][kernel.0]7ce0: 009f 003c c00098c4  1000 
 00ad 0010
[  234.281463][kernel.0]7d00: 0038 cd68f580 0150 c8488360  
cbd67d30 cbd67d70 000e
[  234.282579][kernel.0]7d20: 0010  c0951874 c0112a9c cf379b60 
cf379b84 cf379890 cf3798b4
[  234.283699][kernel.0]7d40: cf379578 cf37959c cf379380 cf3793a4 cf3790b0 
cf3790d4 cf378fd8 cf378ffc
[  234.284814][kernel.0]7d60: cf378f48 cf378f6c cf32a5f4 cf32a5d0  
1000 0018 
[  234.285932][kernel.0]7d80: 1000 c0050da4  1000 cec04c00 
 1000 c0e11328
[  234.287049][kernel.0]7da0:  1000 cbd66000  1000 
c0012a60  1000
[  234.288166][kernel.0]7dc0: cbd67dd4  1000 8013  
1000 cd68f580 
[  234.289285][kernel.0]7de0: 1000 c915d600  1000 cbd67e48 
 1000 0018
[  234.290402][kernel.0]7e00:  1000   1000 
c915d768 c915d768 c0113550
[  234.291522][kernel.0]7e20: cd68f580 cbd67e48 cd68f580 cb6713c0 0001 
000ac5a4  001fc5a4
[  234.292637][kernel.0]7e40:  c8488300 cbd67ec0 00eb cd68f580 
c0113ee4  cbd67ec0
[  234.293754][kernel.0]7e60: cd68f580 c8488300 cbd67ec0 00eb cd68f580 
0015 c8488300 00eb
[  234.294874][kernel.0]7e80: 0001 c0112fd0  cbd67ec0 cd68f580 
0015  cd68f580
[  234.295991][kernel.0]7ea0: cbd67ef0 c011308c  0002 cd768850 
0001  c01133fc
[  234.297110][kernel.0]7ec0: 0015  cbd67f50   
cb6713c0 0100 cbd67f48
[  234.298226][kernel.0]7ee0: cbd67f50 c8488300  c0113204 0001 
0100  cb6713c0
[  234.299342][kernel.0]7f00: 0015  cbd67f50   
  
[  234.300462][kernel.0]7f20: cbd67f50 0100 0100 cb6713c0 c8488300 
c00ebba8 0100 
[  234.301577][kernel.0]7f40: c8488300 cb6713c0    
 ccdaa820 
[  234.302697][kernel.0]7f60: 0

[PATCH 4/4] f2fs: fix wrong error number of fill_super

2017-06-11 Thread Chao Yu
This patch fixes incorrect error number in error path of fill_super.

Signed-off-by: Chao Yu 
---
 fs/f2fs/super.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 1c05763616b2..b26ae4d648cb 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1945,6 +1945,7 @@ static int f2fs_fill_super(struct super_block *sb, void 
*data, int silent)
if (f2fs_sb_mounted_blkzoned(sb)) {
f2fs_msg(sb, KERN_ERR,
 "Zoned block device support is not enabled\n");
+   err = -EOPNOTSUPP;
goto free_sb_buf;
}
 #endif
@@ -2016,8 +2017,10 @@ static int f2fs_fill_super(struct super_block *sb, void 
*data, int silent)
if (F2FS_IO_SIZE(sbi) > 1) {
sbi->write_io_dummy =
mempool_create_page_pool(2 * (F2FS_IO_SIZE(sbi) - 1), 
0);
-   if (!sbi->write_io_dummy)
+   if (!sbi->write_io_dummy) {
+   err = -ENOMEM;
goto free_options;
+   }
}
 
/* get an inode for meta space */
-- 
2.13.1.388.g69e6b9b4f4a9



[PATCH 3/4] f2fs: fix incorrect document of batched_trim_sections

2017-06-11 Thread Chao Yu
Signed-off-by: Chao Yu 
---
 Documentation/ABI/testing/sysfs-fs-f2fs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs 
b/Documentation/ABI/testing/sysfs-fs-f2fs
index ae59451865a6..ffe97abd080a 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -75,7 +75,7 @@ Contact:  "Jaegeuk Kim" 
 Description:
 Controls the memory footprint used by f2fs.
 
-What:  /sys/fs/f2fs//trim_sections
+What:  /sys/fs/f2fs//batched_trim_sections
 Date:  February 2015
 Contact:   "Jaegeuk Kim" 
 Description:
-- 
2.13.1.388.g69e6b9b4f4a9



Re: [PATCH 2/2] sched/deadline: Don't return invalid cpu in cpudl_maximum_cpu()

2017-06-11 Thread Byungchul Park
On Fri, Jun 09, 2017 at 12:42:06PM +0100, Juri Lelli wrote:
> > 
> > This would also work and avoid unnecessary warning. I missed the check
> > to avoid it. https://lkml.org/lkml/2017/3/23/175 was an original patch
> > doing it.
> > 
> > By the way, frankly speaking, I don't like accessing the cpudl instant
> > several times without protection. I rather prefer the following..
> > 
> > But whatever. I like both.
> > 
> > Thnaks,
> > Byungchul
> > 
> > ->8-
> > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
> > index 9b314a9..1d369cf 100644
> > --- a/kernel/sched/cpudeadline.c
> > +++ b/kernel/sched/cpudeadline.c
> > @@ -137,11 +137,17 @@ int cpudl_find(struct cpudl *cp, struct task_struct 
> > *p,
> > cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed)) {
> > best_cpu = cpumask_any(later_mask);
> > goto out;
> > -   } else if (cpumask_test_cpu(cpudl_maximum_cpu(cp), &p->cpus_allowed) &&
> > -   dl_time_before(dl_se->deadline, cpudl_maximum_dl(cp))) {
> > -   best_cpu = cpudl_maximum_cpu(cp);
> > -   if (later_mask)
> > -   cpumask_set_cpu(best_cpu, later_mask);
> > +   } else {
> > +   int max_cpu = cpudl_maximum_cpu(cp);
> > +   u64 max_dl = cpudl_maximum_dl(cp);
> > +
> > +   if (max_cpu != -1 &&
> > +   cpumask_test_cpu(max_cpu, &p->cpus_allowed) &&
> > +   dl_time_before(dl_se->deadline, max_dl)) {
> 
> Don't we access cp 3 times both ways?

I wonder if I miss something.. As you said, in most cases it will, but
I am not sure if we can guarentee that, regardless of arches or
compile optimization level. Sorry if I am wrong.


Re: [lkp-robot] [EDAC, sb_edac] e2f747b1f4: kmsg.EDAC_sbridge:Failed_to_register_device_with_error

2017-06-11 Thread Ye Xiaolong
On 06/10, Zhuo, Qiuxu wrote:
>> From: Borislav Petkov [mailto:b...@alien8.de] 
>>
>> Xiaolong,
>>
>> can you please run Qiuxu's patch to verify it fixes your issue?
>
>
>Hi Boris,
>I manually verified the fix patch on the Broadwell-DE server on which the 
> bug was found by Xiaolong: 
>the sb_edac can be loaded successfully, and it identified which size and 
> type of DIMMs were installed
>in each slot correctly (see attached dmesg.sb_edac.on.Broadwell-DE.log).
>
>Hi Xiaolong,
>   Would you please also test the patch by your LKP method by which the issue 
> was found last time.
>

Got it, I've queued test jobs for your fix patch, will let you know the result
once I get the it.

Thanks,
Xiaolong


>Thanks!
>
>BR
>Qiuxu 
>
>
>




[PATCH v3 2/2] spi: mediatek: add spi support for mt7622 IC

2017-06-11 Thread Leilk Liu
this patch add support for mt7622 IC.

Signed-off-by: Leilk Liu 
---
 drivers/spi/spi-mt65xx.c |9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index eae73b5..ec7755b 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -104,6 +104,12 @@ struct mtk_spi {
 };
 
 static const struct mtk_spi_compatible mtk_common_compat;
+
+static const struct mtk_spi_compatible mt7622_compat = {
+   .must_tx = true,
+   .enhance_timing = true,
+};
+
 static const struct mtk_spi_compatible mt8173_compat = {
.need_pad_sel = true,
.must_tx = true,
@@ -127,6 +133,9 @@ struct mtk_spi {
{ .compatible = "mediatek,mt6589-spi",
.data = (void *)&mtk_common_compat,
},
+   { .compatible = "mediatek,mt7622-spi",
+   .data = (void *)&mt7622_compat,
+   },
{ .compatible = "mediatek,mt8135-spi",
.data = (void *)&mtk_common_compat,
},
-- 
1.7.9.5



[PATCH v3 1/2] spi: mediatek: adjust register to enhance time accuracy

2017-06-11 Thread Leilk Liu
this patch adjust register to enhance time accuracy.

Signed-off-by: Leilk Liu 
---
 drivers/spi/spi-mt65xx.c |   45 ++
 include/linux/platform_data/spi-mt65xx.h |2 ++
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index 278867a..eae73b5 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -35,11 +35,15 @@
 #define SPI_CMD_REG   0x0018
 #define SPI_STATUS0_REG   0x001c
 #define SPI_PAD_SEL_REG   0x0024
+#define SPI_CFG2_REG  0x0028
 
 #define SPI_CFG0_SCK_HIGH_OFFSET  0
 #define SPI_CFG0_SCK_LOW_OFFSET   8
 #define SPI_CFG0_CS_HOLD_OFFSET   16
 #define SPI_CFG0_CS_SETUP_OFFSET  24
+#define SPI_ADJUST_CFG0_SCK_LOW_OFFSET16
+#define SPI_ADJUST_CFG0_CS_HOLD_OFFSET0
+#define SPI_ADJUST_CFG0_CS_SETUP_OFFSET   16
 
 #define SPI_CFG1_CS_IDLE_OFFSET   0
 #define SPI_CFG1_PACKET_LOOP_OFFSET   8
@@ -55,6 +59,8 @@
 #define SPI_CMD_RST  BIT(2)
 #define SPI_CMD_PAUSE_EN BIT(4)
 #define SPI_CMD_DEASSERT BIT(5)
+#define SPI_CMD_SAMPLE_SEL   BIT(6)
+#define SPI_CMD_CS_POL   BIT(7)
 #define SPI_CMD_CPHA BIT(8)
 #define SPI_CMD_CPOL BIT(9)
 #define SPI_CMD_RX_DMA   BIT(10)
@@ -80,6 +86,8 @@ struct mtk_spi_compatible {
bool need_pad_sel;
/* Must explicitly send dummy Tx bytes to do Rx only transfer */
bool must_tx;
+   /* some IC design adjust cfg register to enhance time accuracy */
+   bool enhance_timing;
 };
 
 struct mtk_spi {
@@ -108,6 +116,8 @@ struct mtk_spi {
 static const struct mtk_chip_config mtk_default_chip_info = {
.rx_mlsb = 1,
.tx_mlsb = 1,
+   .cs_pol = 0,
+   .sample_sel = 0,
 };
 
 static const struct of_device_id mtk_spi_of_match[] = {
@@ -182,6 +192,17 @@ static int mtk_spi_prepare_message(struct spi_master 
*master,
reg_val |= SPI_CMD_RX_ENDIAN;
 #endif
 
+   if (mdata->dev_comp->enhance_timing) {
+   if (chip_config->cs_pol)
+   reg_val |= SPI_CMD_CS_POL;
+   else
+   reg_val &= ~SPI_CMD_CS_POL;
+   if (chip_config->sample_sel)
+   reg_val |= SPI_CMD_SAMPLE_SEL;
+   else
+   reg_val &= ~SPI_CMD_SAMPLE_SEL;
+   }
+
/* set finish and pause interrupt always enable */
reg_val |= SPI_CMD_FINISH_IE | SPI_CMD_PAUSE_IE;
 
@@ -233,11 +254,25 @@ static void mtk_spi_prepare_transfer(struct spi_master 
*master,
sck_time = (div + 1) / 2;
cs_time = sck_time * 2;
 
-   reg_val |= (((sck_time - 1) & 0xff) << SPI_CFG0_SCK_HIGH_OFFSET);
-   reg_val |= (((sck_time - 1) & 0xff) << SPI_CFG0_SCK_LOW_OFFSET);
-   reg_val |= (((cs_time - 1) & 0xff) << SPI_CFG0_CS_HOLD_OFFSET);
-   reg_val |= (((cs_time - 1) & 0xff) << SPI_CFG0_CS_SETUP_OFFSET);
-   writel(reg_val, mdata->base + SPI_CFG0_REG);
+   if (mdata->dev_comp->enhance_timing) {
+   reg_val |= (((sck_time - 1) & 0x)
+  << SPI_CFG0_SCK_HIGH_OFFSET);
+   reg_val |= (((sck_time - 1) & 0x)
+  << SPI_ADJUST_CFG0_SCK_LOW_OFFSET);
+   writel(reg_val, mdata->base + SPI_CFG2_REG);
+   reg_val |= (((cs_time - 1) & 0x)
+  << SPI_ADJUST_CFG0_CS_HOLD_OFFSET);
+   reg_val |= (((cs_time - 1) & 0x)
+  << SPI_ADJUST_CFG0_CS_SETUP_OFFSET);
+   writel(reg_val, mdata->base + SPI_CFG0_REG);
+   } else {
+   reg_val |= (((sck_time - 1) & 0xff)
+  << SPI_CFG0_SCK_HIGH_OFFSET);
+   reg_val |= (((sck_time - 1) & 0xff) << SPI_CFG0_SCK_LOW_OFFSET);
+   reg_val |= (((cs_time - 1) & 0xff) << SPI_CFG0_CS_HOLD_OFFSET);
+   reg_val |= (((cs_time - 1) & 0xff) << SPI_CFG0_CS_SETUP_OFFSET);
+   writel(reg_val, mdata->base + SPI_CFG0_REG);
+   }
 
reg_val = readl(mdata->base + SPI_CFG1_REG);
reg_val &= ~SPI_CFG1_CS_IDLE_MASK;
diff --git a/include/linux/platform_data/spi-mt65xx.h 
b/include/linux/platform_data/spi-mt65xx.h
index 54b0448..ba4e4bb 100644
--- a/include/linux/platform_data/spi-mt65xx.h
+++ b/include/linux/platform_data/spi-mt65xx.h
@@ -16,5 +16,7 @@
 struct mtk_chip_config {
u32 tx_mlsb;
u32 rx_mlsb;
+   u32 cs_pol;
+   u32 sample_sel;
 };
 #endif
-- 
1.7.9.5



[PATCH v3 0/2] add mt7622 spi support

2017-06-11 Thread Leilk Liu
This series are based on 4.12-rc1 and provide 2 patches to support mt7622 IC.

Change in v3:
fix build error.

Change in v2:
1. rename patch title;
2. use enhance_timing to instead of adjust_reg.

Change in v1:
1. update document to add mt7622;
2. add adjust register define support;
3. add mt7622_compat.

Leilk Liu (2):
  spi: mediatek: adjust register to enhance time accuracy
  spi: mediatek: add spi support for mt7622 IC

 drivers/spi/spi-mt65xx.c |   54 +++---
 include/linux/platform_data/spi-mt65xx.h |2 ++
 2 files changed, 51 insertions(+), 5 deletions(-)

--
1.7.9.5



Re: [PATCH v2 1/2] tcp: md5: add an address prefix for key lookup

2017-06-11 Thread kbuild test robot
Hi Ivan,

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

url:
https://github.com/0day-ci/linux/commits/Ivan-Delalande/tcp-md5-add-an-address-prefix-for-key-lookup/20170611-184237
config: x86_64-randconfig-s2-06120830 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   net//ipv4/tcp_ipv4.c: In function 'tcp_md5_do_lookup':
>> net//ipv4/tcp_ipv4.c:908: warning: unused variable 'size'

vim +/size +908 net//ipv4/tcp_ipv4.c

^1da177e4 Linus Torvalds   2005-04-16  892  }
^1da177e4 Linus Torvalds   2005-04-16  893  
cfb6eeb4c YOSHIFUJI Hideaki2006-11-14  894  #ifdef CONFIG_TCP_MD5SIG
cfb6eeb4c YOSHIFUJI Hideaki2006-11-14  895  /*
cfb6eeb4c YOSHIFUJI Hideaki2006-11-14  896   * RFC2385 MD5 checksumming 
requires a mapping of
cfb6eeb4c YOSHIFUJI Hideaki2006-11-14  897   * IP address->MD5 Key.
cfb6eeb4c YOSHIFUJI Hideaki2006-11-14  898   * We need to maintain these in 
the sk structure.
cfb6eeb4c YOSHIFUJI Hideaki2006-11-14  899   */
cfb6eeb4c YOSHIFUJI Hideaki2006-11-14  900  
cfb6eeb4c YOSHIFUJI Hideaki2006-11-14  901  /* Find the Key structure for 
an address.  */
b83e3deb9 Eric Dumazet 2015-09-25  902  struct tcp_md5sig_key 
*tcp_md5_do_lookup(const struct sock *sk,
a915da9b6 Eric Dumazet 2012-01-31  903  
 const union tcp_md5_addr *addr,
a915da9b6 Eric Dumazet 2012-01-31  904  
 int family)
cfb6eeb4c YOSHIFUJI Hideaki2006-11-14  905  {
fd3a154a0 Eric Dumazet 2015-03-24  906  const struct tcp_sock 
*tp = tcp_sk(sk);
a915da9b6 Eric Dumazet 2012-01-31  907  struct tcp_md5sig_key 
*key;
a915da9b6 Eric Dumazet 2012-01-31 @908  unsigned int size = 
sizeof(struct in_addr);
fd3a154a0 Eric Dumazet 2015-03-24  909  const struct 
tcp_md5sig_info *md5sig;
4b9e1d2ec Ivan Delalande   2017-06-09  910  __be32 mask;
4b9e1d2ec Ivan Delalande   2017-06-09  911  struct tcp_md5sig_key 
*best_match = NULL;
4b9e1d2ec Ivan Delalande   2017-06-09  912  bool match;
cfb6eeb4c YOSHIFUJI Hideaki2006-11-14  913  
a8afca032 Eric Dumazet 2012-01-31  914  /* caller either holds 
rcu_read_lock() or socket lock */
a8afca032 Eric Dumazet 2012-01-31  915  md5sig = 
rcu_dereference_check(tp->md5sig_info,
1e1d04e67 Hannes Frederic Sowa 2016-04-05  916  
   lockdep_sock_is_held(sk));

:: The code at line 908 was first introduced by commit
:: a915da9b69273815527ccb3789421cb7027b545b tcp: md5: rcu conversion

:: TO: Eric Dumazet 
:: CC: David S. Miller 

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


.config.gz
Description: application/gzip


  1   2   3   >