All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 7/8] x86: efi: Add a hello world test program
From: Simon Glass @ 2016-11-14 20:58 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <44437559-36e5-1551-27f5-4f47edf71246@suse.de>

Hi Alex,

On 14 November 2016 at 13:46, Alexander Graf <agraf@suse.de> wrote:
>
>
> On 14/11/2016 21:44, Simon Glass wrote:
>>
>> Hi Alex,
>>
>> On 11 November 2016 at 23:23, Alexander Graf <agraf@suse.de> wrote:
>>>
>>>
>>>
>>>> Am 11.11.2016 um 17:17 schrieb Simon Glass <sjg@chromium.org>:
>>>>
>>>> Hi Alex,
>>>>
>>>>> On 7 November 2016 at 09:32, Alexander Graf <agraf@suse.de> wrote:
>>>>>
>>>>>
>>>>>> On 07/11/2016 10:46, Simon Glass wrote:
>>>>>>
>>>>>> Hi Alex,
>>>>>>
>>>>>>> On 19 October 2016 at 01:09, Alexander Graf <agraf@suse.de> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> On 18/10/2016 22:37, Simon Glass wrote:
>>>>>>>>
>>>>>>>> Hi Alex,
>>>>>>>>
>>>>>>>>> On 18 October 2016 at 01:14, Alexander Graf <agraf@suse.de> wrote:
>>>>>>>>>
>>>>>>>>>> On 10/18/2016 04:29 AM, Simon Glass wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> It is useful to have a basic sanity check for EFI loader support.
>>>>>>>>>> Add
>>>>>>>>>> a
>>>>>>>>>> 'bootefi hello' command which loads HelloWord.efi and runs it
>>>>>>>>>> under
>>>>>>>>>> U-Boot.
>>>>>>>>>>
>>>>>>>>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>>>>>>>>> ---
>>>>>>>>>>
>>>>>>>>>> Changes in v3:
>>>>>>>>>> - Include a link to the program instead of adding it to the tree
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> So, uh, where is the link?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> I put it in the README (see the arm patch).
>>>>>>>>
>>>>>>>>>
>>>>>>>>> I'm really not convinced this command buys us anything yet. I do
>>>>>>>>> agree
>>>>>>>>> that
>>>>>>>>> we want automated testing - but can't we get that using QEMU and a
>>>>>>>>> downloadable image file that we pass in as disk and have the distro
>>>>>>>>> boot do
>>>>>>>>> its magic?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> That seems very heavyweight as a sanity check, although I agree it
>>>>>>>> is
>>>>>>>> useful.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> It's not really much more heavy weight. The "image file" could simply
>>>>>>> contain your hello world binary. But with this we don't just verify
>>>>>>> whether "bootefi" works, but also whether the default boot path works
>>>>>>> ok.
>>>>>>
>>>>>>
>>>>>>
>>>>>> I don't think I understand what you mean by 'image file'. Is it
>>>>>> something other than the .efi file? Do you mean a disk image?
>>>>>
>>>>>
>>>>>
>>>>> Yes. For reasonable test coverage, we should also verify that the
>>>>> distro
>>>>> defaults wrote a sane boot script that automatically searches for a
>>>>> default
>>>>> EFI binary in /efi/boot/bootx86.efi on the first partition of all
>>>>> devices
>>>>> and runs it.
>>>>>
>>>>> So if we just provide an SD card image or hard disk image to QEMU which
>>>>> contains a hello world .efi binary as that default boot file, we don't
>>>>> only
>>>>> test whether the "bootefi" command works, but also whether the distro
>>>>> boot
>>>>> script works.
>>>>
>>>>
>>>> That's right.
>>>>
>>>>>
>>>>>>
>>>>>>>
>>>>>>>> Here I am just making sure that EFI programs can start, print output
>>>>>>>> and exit. It is a test that we can easily run without a lot of
>>>>>>>> overhead, much less than a full distro boot.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Again, I don't think it's much more overhead and I do believe it
>>>>>>> gives
>>>>>>> us much cleaner separation between responsibilities of code (tests go
>>>>>>> where tests are).
>>>>>>
>>>>>>
>>>>>>
>>>>>> You are talking about a functional test, something that tests things
>>>>>> end to end. I prefer to at least start with a smaller test. Granted it
>>>>>> takes a little more work but it means there are fewer things to hunt
>>>>>> through when something goes wrong.
>>>>>
>>>>>
>>>>>
>>>>> Yes, I personally find unit tests terribly annoying and unproductive
>>>>> and
>>>>> functional tests very helpful :). And in this case, the effort to write
>>>>> it
>>>>> is about the same for both, just that the functional test actually
>>>>> tells you
>>>>> that things work or don't work at the end of the day.
>>>>>
>>>>> With a code base like U-Boot, a simple functional test like the above
>>>>> plus
>>>>> git bisect should get you to an offending patch very quickly.
>>>>
>>>>
>>>> This is not a unit test - in fact the EFI stuff has no unit tests. I
>>>> suppose if we are trying to find a name this is a small functional
>>>> test since it exercises the general functionality.
>>>>
>>>> I am much keener on small tests than large ones for finding simple
>>>> bugs. Of course you can generally bisect to find a bug, but the more
>>>> layers of software you need to look for the harder this is.
>>>>
>>>> We could definitely use a pytest which checks an EFI boot into an
>>>> image, but I don't think this obviates the need for a smaller targeted
>>>> test like this one.
>>>
>>>
>>> I think arguing over this is moot :). More tests is usually a good thing,
>>> so whoever gets to write them gets to push them ;). As long as the licenses
>>> are sound at least.
>>
>>
>> OK good, well please can you review this at some point?
>
>
> Review what exactly?

I mean the patches. There should be ~14 in your queue.

>
>> Also, are you
>> planning to write the 'larger' test? How do you test this all in suse?
>
>
> Planning yes, but I'm very good at not writing tests :).
>
> Currently I'm testing this all in suse by running systems which rely on the
> code to work.

OK I see.

Regards,
Simon

^ permalink raw reply

* Re: [PATCH kvm-unit-tests v2 15/17] pci: add msi support for 32/64bit address
From: Peter Xu @ 2016-11-14 20:58 UTC (permalink / raw)
  To: Andrew Jones; +Cc: kvm, rkrcmar, agordeev, jan.kiszka, pbonzini
In-Reply-To: <20161110201014.kmoj4mhncxwlvigh@hawk.localdomain>

On Thu, Nov 10, 2016 at 09:10:14PM +0100, Andrew Jones wrote:

[...]

> > +bool pci_setup_msi(struct pci_dev *dev, uint64_t msi_addr, uint32_t msi_data)
> > +{
> > +	uint16_t msi_control;
> > +	uint16_t offset;
> > +	pcidevaddr_t addr = dev->bdf;
> > +
> > +	assert(dev);
> 
> If you're worried that dev might be null then you can't dereference
> it the line above.

Right. Fixing up.

Thanks,

-- peterx

^ permalink raw reply

* Re: Connection problems with Qualcomm Atheros QCA6174
From: Henrý Þór Baldursson @ 2016-11-14 20:56 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k@lists.infradead.org
In-Reply-To: <CA+BoTQk9znROEy4o958DVuBkv1cpY6eG=-wCof1fahuh93PObw@mail.gmail.com>

Hi

Thanks for your reply. :-)

The BIOS didn't display options related to S0x or S0ix ACPI modes. But
then, it's a Lenovo BIOS and they disable alot of features and don't
offer any expert mode.

I applied your patch, and will see if it keeps my network from failing.


It's been a while since I've done this, is this a problem?:
Nov 14 20:47:58 tempest kernel: ath10k_core: loading out-of-tree
module taints kernel.



- Henry.

On Mon, Nov 14, 2016 at 1:13 PM, Michal Kazior <michal.kazior@tieto.com> wrote:
> On 13 November 2016 at 06:57, Henrý Þór Baldursson
> <henry.baldursson@gmail.com> wrote:
>> Hello
>>
>> I have a Lenovo Ideapad Yoga 910 running Athergos, kernel version 4.8.7.
>>
>> My problem is that intermittently my wifi will just grind to a halt
>> and even stop working.
>>
>> The driver reports the firmware as being WLAN.RM.2.0-00180-QCARMSWPZ-1
>>
>> Here's the initialization in dmesg:
>>
>> [    1.900033] ath10k_pci 0000:01:00.0: pci irq msi oper_irq_mode 2
>> irq_mode 0 reset_mode 0
>> [    2.173039] ath10k_pci 0000:01:00.0: Direct firmware load for
>> ath10k/pre-cal-pci-0000:01:00.0.bin failed with error -2
>> [    2.173054] ath10k_pci 0000:01:00.0: Direct firmware load for
>> ath10k/cal-pci-0000:01:00.0.bin failed with error -2
>> [    2.174217] ath10k_pci 0000:01:00.0: Direct firmware load for
>> ath10k/QCA6174/hw3.0/firmware-5.bin failed with error -2
>> [    2.174218] ath10k_pci 0000:01:00.0: could not fetch firmware file
>> 'ath10k/QCA6174/hw3.0/firmware-5.bin': -2
>> [    2.175485] ath10k_pci 0000:01:00.0: qca6174 hw3.2 target
>> 0x05030000 chip_id 0x00340aff sub 17aa:0827
>> [    2.175487] ath10k_pci 0000:01:00.0: kconfig debug 0 debugfs 1
>> tracing 0 dfs 0 testmode 0
>> [    2.175876] ath10k_pci 0000:01:00.0: firmware ver
>> WLAN.RM.2.0-00180-QCARMSWPZ-1 api 4 features
>> wowlan,ignore-otp,no-4addr-pad crc32 75dee6c5
>> [    2.240312] ath10k_pci 0000:01:00.0: board_file api 2 bmi_id N/A
>> crc32 6fc88fe7
>> [    4.405741] ath10k_pci 0000:01:00.0: htt-ver 3.26 wmi-op 4 htt-op 3
>> cal otp max-sta 32 raw 0 hwcrypto 1
>> [    4.485362] ath10k_pci 0000:01:00.0 wlp1s0: renamed from wlan0
>>
>>
>> Here's what dmesg shows during the errors:
>>
>> [ 1238.710899] pcieport 0000:00:1c.0: AER: Corrected error received: id=00e0
>> [ 1238.710920] pcieport 0000:00:1c.0: PCIe Bus Error:
>> severity=Corrected, type=Data Link Layer, id=00e0(Transmitter ID)
>> [ 1238.710935] pcieport 0000:00:1c.0:   device [8086:9d14] error
>> status/mask=00001000/00000000
>> [ 1238.710945] pcieport 0000:00:1c.0:    [12] Replay Timer Timeout
>> [ 1243.855456] pcieport 0000:00:1c.0: AER: Corrected error received: id=00e0
>> [ 1243.855472] pcieport 0000:00:1c.0: PCIe Bus Error:
>> severity=Corrected, type=Data Link Layer, id=00e0(Transmitter ID)
>> [ 1243.855484] pcieport 0000:00:1c.0:   device [8086:9d14] error
>> status/mask=00001000/00000000
>> [ 1243.855491] pcieport 0000:00:1c.0:    [12] Replay Timer Timeout
>> [ 1296.095437] pcieport 0000:00:1c.0: AER: Corrected error received: id=00e0
>> [ 1296.095452] pcieport 0000:00:1c.0: PCIe Bus Error:
>> severity=Corrected, type=Data Link Layer, id=00e0(Transmitter ID)
>> [ 1296.095464] pcieport 0000:00:1c.0:   device [8086:9d14] error
>> status/mask=00001000/00000000
>> [ 1296.095472] pcieport 0000:00:1c.0:    [12] Replay Timer Timeout
>> [ 1305.877547] pcieport 0000:00:1c.0: AER: Corrected error received: id=00e0
>> [ 1305.877562] pcieport 0000:00:1c.0: PCIe Bus Error:
>> severity=Corrected, type=Data Link Layer, id=00e0(Transmitter ID)
>> [ 1305.877574] pcieport 0000:00:1c.0:   device [8086:9d14] error
>> status/mask=00001000/00000000
>> [ 1305.877581] pcieport 0000:00:1c.0:    [12] Replay Timer Timeout
>> [ 1556.596092] pcieport 0000:00:1c.0: AER: Corrected error received: id=00e0
>> [ 1556.596107] pcieport 0000:00:1c.0: PCIe Bus Error:
>> severity=Corrected, type=Data Link Layer, id=00e0(Transmitter ID)
>> [ 1556.596115] pcieport 0000:00:1c.0:   device [8086:9d14] error
>> status/mask=00001000/00000000
>> [ 1556.596122] pcieport 0000:00:1c.0:    [12] Replay Timer Timeout
>> [ 1612.764108] pcieport 0000:00:1c.0: AER: Corrected error received: id=00e0
>> [ 1612.764124] pcieport 0000:00:1c.0: PCIe Bus Error:
>> severity=Corrected, type=Data Link Layer, id=00e0(Transmitter ID)
>> [ 1612.764135] pcieport 0000:00:1c.0:   device [8086:9d14] error
>> status/mask=00001000/00000000
>> [ 1612.764143] pcieport 0000:00:1c.0:    [12] Replay Timer Timeout
>
> Can you try to override ar_pci->pci_ps to false in ath10k_pci_probe()
> and see if it helps? Something along the diff:
>
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -3236,7 +3236,7 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
>         ar_pci->dev = &pdev->dev;
>         ar_pci->ar = ar;
>         ar->dev_id = pci_dev->device;
> -       ar_pci->pci_ps = pci_ps;
> +       ar_pci->pci_ps = false;
>         ar_pci->bus_ops = &ath10k_pci_bus_ops;
>         ar_pci->pci_soft_reset = pci_soft_reset;
>         ar_pci->pci_hard_reset = pci_hard_reset;
>
> Another thing which could be happening is ACPI S0ix states which - to
> the best of my knowledge - Linux does not support. I've seen at least
> i915 not being able to wake-up DSI displays properly when S0ix states
> are enabled on some 10 inch 2-in-1 devices. I wouldn't be surprised if
> other PCI-E (such as wifi/network devices) can be affected adversely
> as well.
>
> Therefore, can you check UEFI/BIOS (you may need to enable "expert
> settings") if there are any mentions about S0x or S0ix ACPI modes
> there and - if found - try disabling them and checking back if you
> still get AER/bus errors, please?
>
>
> Michał

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply

* Re: [Bug 186671] New: OOM on system with just rsync running 32GB of ram 30GB of pagecache
From: E V @ 2016-11-14 20:56 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, bugzilla-daemon, linux-mm, Michal Hocko,
	linux-btrfs, Kirill A. Shutemov
In-Reply-To: <bbcd6cb7-3b73-02e9-0409-4601a6f573f5@suse.cz>

Pretty sure it was the system after the OOM just did a history search
to check, though it is 3 days afterwards and several OOMs killed
several processes in somewhat rapid succession, I just listed the 1st.
I'll turn on CONFIG_DEBUG_VM and reboot again.

On Mon, Nov 14, 2016 at 12:04 PM, Vlastimil Babka <vbabka@suse.cz> wrote:
> On 11/14/2016 02:27 PM, E V wrote:
>> System is an intel dual socket Xeon E5620, 7500/5520/5500/X58 ICH10
>> family according to lspci. Anyways 4.8.4 OOM'd while I was gone. I'll
>> download the current 4.9rc and reboot, but in the mean time here's
>> xxd, vmstat & kern.log output:
>> 8532039 0000000000000000
>
> Hmm this would suggest that the memory is mostly free. But not according
> to vmstat. Is it possible you mistakenly provided the xxd from a fresh
> boot, but vmstat from after the OOM?
>
> But sure, a page_count() of zero is a reason why __isolate_lru_page()
> would fail due to its get_page_unless_zero(). The question is then how
> could it drop to zero without being freed at the same time, as
> put_page() does.
>
> I was going to suspect commit 83929372f6 and a page_ref_sub() it adds to
> delete_from_page_cache(), but that's since 4.8 and you mention problems
> since 4.7.
>
> Anyway it might be worth enabling CONFIG_DEBUG_VM as the relevant code
> usually has VM_BUG_ONs.
>
> Vlastimil
>
>>    9324 0100000000000000
>>    2226 0200000000000000
>>     405 0300000000000000
>>      80 0400000000000000
>>      34 0500000000000000
>>      48 0600000000000000
>>      17 0700000000000000
>>      17 0800000000000000
>>      32 0900000000000000
>>      19 0a00000000000000
>>       1 0c00000000000000
>>       1 0d00000000000000
>>       1 0e00000000000000
>>      12 1000000000000000
>>       8 1100000000000000
>>      32 1200000000000000
>>      10 1300000000000000
>>       2 1400000000000000
>>      11 1500000000000000
>>      12 1600000000000000
>>       7 1700000000000000
>>       3 1800000000000000
>>       5 1900000000000000
>>       6 1a00000000000000
>>      11 1b00000000000000
>>      22 1c00000000000000
>>       3 1d00000000000000
>>      19 1e00000000000000
>>      21 1f00000000000000
>>      18 2000000000000000
>>      28 2100000000000000
>>      40 2200000000000000
>>      38 2300000000000000
>>      85 2400000000000000
>>      59 2500000000000000
>>   40520 81ffffffffffffff
>>
>> /proc/vmstat:
>> nr_free_pages 60965
>> nr_zone_inactive_anon 4646
>> nr_zone_active_anon 3265
>> nr_zone_inactive_file 633882
>> nr_zone_active_file 7017458
>> nr_zone_unevictable 0
>> nr_zone_write_pending 0
>> nr_mlock 0
>> nr_slab_reclaimable 299205
>> nr_slab_unreclaimable 195497
>> nr_page_table_pages 935
>> nr_kernel_stack 4976
>> nr_bounce 0
>> numa_hit 3577063288
>> numa_miss 541393191
>> numa_foreign 541393191
>> numa_interleave 19415
>> numa_local 3577063288
>> numa_other 0
>> nr_free_cma 0
>> nr_inactive_anon 4646
>> nr_active_anon 3265
>> nr_inactive_file 633882
>> nr_active_file 7017458
>> nr_unevictable 0
>> nr_isolated_anon 0
>> nr_isolated_file 0
>> nr_pages_scanned 0
>> workingset_refault 42685891
>> workingset_activate 15247281
>> workingset_nodereclaim 26375216
>> nr_anon_pages 5067
>> nr_mapped 5630
>> nr_file_pages 7654746
>> nr_dirty 0
>> nr_writeback 0
>> nr_writeback_temp 0
>> nr_shmem 2504
>> nr_shmem_hugepages 0
>> nr_shmem_pmdmapped 0
>> nr_anon_transparent_hugepages 0
>> nr_unstable 0
>> nr_vmscan_write 5243750485
>> nr_vmscan_immediate_reclaim 4207633857
>> nr_dirtied 1839143430
>> nr_written 1832626107
>> nr_dirty_threshold 1147728
>> nr_dirty_background_threshold 151410
>> pgpgin 166731189
>> pgpgout 7328142335
>> pswpin 98608
>> pswpout 117794
>> pgalloc_dma 29504
>> pgalloc_dma32 1006726216
>> pgalloc_normal 5275218188
>> pgalloc_movable 0
>> allocstall_dma 0
>> allocstall_dma32 0
>> allocstall_normal 36461
>> allocstall_movable 5867
>> pgskip_dma 0
>> pgskip_dma32 0
>> pgskip_normal 6417890
>> pgskip_movable 0
>> pgfree 6309223401
>> pgactivate 35076483
>> pgdeactivate 63556974
>> pgfault 35753842
>> pgmajfault 69126
>> pglazyfreed 0
>> pgrefill 70008598
>> pgsteal_kswapd 3567289713
>> pgsteal_direct 5878057
>> pgscan_kswapd 9059309872
>> pgscan_direct 4239367903
>> pgscan_direct_throttle 0
>> zone_reclaim_failed 0
>> pginodesteal 102916
>> slabs_scanned 460790262
>> kswapd_inodesteal 9130243
>> kswapd_low_wmark_hit_quickly 10634373
>> kswapd_high_wmark_hit_quickly 7348173
>> pageoutrun 18349115
>> pgrotated 16291322
>> drop_pagecache 0
>> drop_slab 0
>> pgmigrate_success 18912908
>> pgmigrate_fail 63382146
>> compact_migrate_scanned 2986269789
>> compact_free_scanned 190451505123
>> compact_isolated 109549437
>> compact_stall 3544
>> compact_fail 8
>> compact_success 3536
>> compact_daemon_wake 1403515
>> htlb_buddy_alloc_success 0
>> htlb_buddy_alloc_fail 0
>> unevictable_pgs_culled 12473
>> unevictable_pgs_scanned 0
>> unevictable_pgs_rescued 11979
>> unevictable_pgs_mlocked 14556
>> unevictable_pgs_munlocked 14556
>> unevictable_pgs_cleared 0
>> unevictable_pgs_stranded 0
>> thp_fault_alloc 0
>> thp_fault_fallback 0
>> thp_collapse_alloc 0
>> thp_collapse_alloc_failed 0
>> thp_file_alloc 0
>> thp_file_mapped 0
>> thp_split_page 0
>> thp_split_page_failed 0
>> thp_deferred_split_page 0
>> thp_split_pmd 0
>> thp_zero_page_alloc 0
>> thp_zero_page_alloc_failed 0
>>
>> kern.log OOM message:
>> [737778.724194] snmpd invoked oom-killer:
>> gfp_mask=0x24200ca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=0
>> [737778.724246] snmpd cpuset=/ mems_allowed=0-1
>> [737778.724278] CPU: 15 PID: 2976 Comm: snmpd Tainted: G        W I     4.8.4 #1
>> [737778.724352]  0000000000000000 ffffffff81292069 ffff88041e043c48
>> ffff88041e043c48
>> [737778.724403]  ffffffff8118d1f6 ffff88041dd70fc0 ffff88041e043c48
>> 000000000136236f
>> [737778.724454]  ffffffff8170e11e 0000000000000001 ffffffff8112a700
>> 000000000000030f
>> [737778.724505] Call Trace:
>> [737778.724533]  [<ffffffff81292069>] ? dump_stack+0x46/0x5d
>> [737778.727077]  [<ffffffff8118d1f6>] ? dump_header.isra.16+0x56/0x185
>> [737778.727108]  [<ffffffff8112a700>] ? oom_kill_process+0x210/0x3c0
>> [737778.727136]  [<ffffffff8112ac4b>] ? out_of_memory+0x34b/0x420
>> [737778.727165]  [<ffffffff8112fcca>] ? __alloc_pages_nodemask+0xd9a/0xde0
>> [737778.727195]  [<ffffffff811768e1>] ? alloc_pages_vma+0xc1/0x240
>> [737778.727223]  [<ffffffff81126512>] ? pagecache_get_page+0x22/0x230
>> [737778.727253]  [<ffffffff81169f44>] ? __read_swap_cache_async+0x104/0x180
>> [737778.727282]  [<ffffffff81169fcf>] ? read_swap_cache_async+0xf/0x30
>> [737778.727311]  [<ffffffff8116a0dc>] ? swapin_readahead+0xec/0x1a0
>> [737778.727340]  [<ffffffff81156270>] ? do_swap_page+0x420/0x5c0
>> [737778.727369]  [<ffffffff813f36d8>] ? SYSC_recvfrom+0xa8/0x110
>> [737778.727397]  [<ffffffff81157a39>] ? handle_mm_fault+0x629/0xe30
>> [737778.727426]  [<ffffffff81048fc5>] ? __do_page_fault+0x1b5/0x480
>> [737778.727456]  [<ffffffff814fbaa2>] ? page_fault+0x22/0x30
>> [737778.727497] Mem-Info:
>> [737778.727524] active_anon:24 inactive_anon:49 isolated_anon:0
>> [737778.727524]  active_file:6920154 inactive_file:798043 isolated_file:576
>> [737778.727524]  unevictable:0 dirty:800528 writeback:1307 unstable:0
>> [737778.727524]  slab_reclaimable:264367 slab_unreclaimable:193348
>> [737778.727524]  mapped:4063 shmem:0 pagetables:1719 bounce:0
>> [737778.727524]  free:39225 free_pcp:47 free_cma:0
>> [737778.727677] Node 0 active_anon:16kB inactive_anon:76kB
>> active_file:14249324kB inactive_file:1296908kB unevictable:0kB
>> isolated(anon):0kB isolated(file):1920kB mapped:10432kB
>> dirty:1308528kB writeback:0kB shmem:0kB shmem_thp: 0kB
>> shmem_pmdmapped: 0kB anon_thp: 0kB writeback_tmp:0kB unstable:0kB
>> pages_scanned:23557303 all_unreclaimable? yes
>> [737778.727806] Node 1 active_anon:80kB inactive_anon:120kB
>> active_file:13431292kB inactive_file:1895264kB unevictable:0kB
>> isolated(anon):0kB isolated(file):384kB mapped:5820kB dirty:1893584kB
>> writeback:5228kB shmem:0kB shmem_thp: 0kB shmem_pmdmapped: 0kB
>> anon_thp: 0kB writeback_tmp:0kB unstable:0kB pages_scanned:25598673
>> all_unreclaimable? yes
>> [737778.727930] Node 0 Normal free:44864kB min:45192kB low:61736kB
>> high:78280kB active_anon:16kB inactive_anon:76kB
>> active_file:14249324kB inactive_file:1296908kB unevictable:0kB
>> writepending:1308528kB present:16777216kB managed:16544856kB
>> mlocked:0kB slab_reclaimable:562644kB slab_unreclaimable:317504kB
>> kernel_stack:3840kB pagetables:3672kB bounce:0kB free_pcp:20kB
>> local_pcp:0kB free_cma:0kB
>> [737778.728066] lowmem_reserve[]: 0 0 0 0
>> [737778.728100] Node 1 DMA free:15896kB min:40kB low:52kB high:64kB
>> active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB
>> unevictable:0kB writepending:0kB present:15996kB managed:15896kB
>> mlocked:0kB slab_reclaimable:0kB slab_unreclaimable:0kB
>> kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB
>> free_cma:0kB
>> [737778.728228] lowmem_reserve[]: 0 3216 16044 16044
>> [737778.728263] Node 1 DMA32 free:60300kB min:8996kB low:12288kB
>> high:15580kB active_anon:4kB inactive_anon:4kB active_file:2660988kB
>> inactive_file:474956kB unevictable:0kB writepending:475116kB
>> present:3378660kB managed:3304720kB mlocked:0kB
>> slab_reclaimable:83612kB slab_unreclaimable:16668kB kernel_stack:320kB
>> pagetables:16kB bounce:0kB free_pcp:4kB local_pcp:4kB free_cma:0kB
>> [737778.728397] lowmem_reserve[]: 0 0 12827 12827
>> [737778.728431] Node 1 Normal free:35840kB min:35876kB low:49008kB
>> high:62140kB active_anon:76kB inactive_anon:116kB
>> active_file:10770304kB inactive_file:1420308kB unevictable:0kB
>> writepending:1423696kB present:13369344kB managed:13135424kB
>> mlocked:0kB slab_reclaimable:411212kB slab_unreclaimable:439220kB
>> kernel_stack:2864kB pagetables:3188kB bounce:0kB free_pcp:164kB
>> local_pcp:36kB free_cma:0kB
>> [737778.728568] lowmem_reserve[]: 0 0 0 0
>> [737778.728601] Node 0 Normal: 11208*4kB (UME) 4*8kB (U) 0*16kB 0*32kB
>> 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 44864kB
>> [737778.728686] Node 1 DMA: 0*4kB 1*8kB (U) 1*16kB (U) 0*32kB 2*64kB
>> (U) 1*128kB (U) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (M) 3*4096kB
>> (M) = 15896kB
>> [737778.728786] Node 1 DMA32: 11759*4kB (UME) 1658*8kB (UM) 0*16kB
>> 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB =
>> 60300kB
>> [737778.728875] Node 1 Normal: 7984*4kB (UME) 470*8kB (UME) 3*16kB (U)
>> 3*32kB (UM) 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB
>> = 35840kB
>> [737778.728973] Node 0 hugepages_total=0 hugepages_free=0
>> hugepages_surp=0 hugepages_size=1048576kB
>> [737778.729019] Node 0 hugepages_total=0 hugepages_free=0
>> hugepages_surp=0 hugepages_size=2048kB
>> [737778.729065] Node 1 hugepages_total=0 hugepages_free=0
>> hugepages_surp=0 hugepages_size=1048576kB
>> [737778.729111] Node 1 hugepages_total=0 hugepages_free=0
>> hugepages_surp=0 hugepages_size=2048kB
>> [737778.729156] 7718841 total pagecache pages
>> [737778.729179] 68 pages in swap cache
>> [737778.729202] Swap cache stats: add 193888, delete 193820, find 160188/213014
>> [737778.729231] Free swap  = 48045076kB
>> [737778.729254] Total swap = 48300028kB
>> [737778.729277] 8385304 pages RAM
>> [737778.729299] 0 pages HighMem/MovableOnly
>> [737778.729322] 135080 pages reserved
>> [737778.729344] 0 pages hwpoisoned
>> [737778.729365] [ pid ]   uid  tgid total_vm      rss nr_ptes nr_pmds
>> swapents oom_score_adj name
>> [737778.729417] [ 1927]     0  1927     9941      447      22       3
>>     299         -1000 systemd-udevd
>> [737778.729465] [ 2812]     0  2812     9289      412      23       4
>>     161             0 rpcbind
>> [737778.729512] [ 2836]   102  2836     9320      414      23       3
>>     151             0 rpc.statd
>> [737778.729560] [ 2851]   104  2851   162257      276      75       3
>>    7489             0 apt-cacher-ng
>> [737778.729608] [ 2856]     0  2856    13796      345      31       3
>>     167         -1000 sshd
>> [737778.729655] [ 2857]     0  2857    64668      504      27       4
>>     355             0 rsyslogd
>> [737778.729702] [ 2858]     0  2858     6876      518      18       3
>>      83             0 cron
>> [737778.729748] [ 2859]     0  2859     4756      360      14       3
>>      44             0 atd
>> [737778.729795] [ 2860]     0  2860     7059      523      18       3
>>     591             0 smartd
>> [737778.729842] [ 2864]     0  2864     7082      559      19       4
>>      96             0 systemd-logind
>> [737778.729890] [ 2865]   106  2865    10563      528      24       3
>>     110          -900 dbus-daemon
>> [737778.729938] [ 2925]     0  2925     3604      421      12       3
>>      38             0 agetty
>> [737778.729985] [ 2974]     0  2974     4852      365      13       3
>>      73             0 irqbalance
>> [737778.730032] [ 2976]   105  2976    14299      496      29       3
>>    1534             0 snmpd
>> [737778.730078] [ 2992]     0  2992     3180      227      11       3
>>      38             0 mcelog
>> [737778.730125] [ 3095]     0  3095    26571      344      43       3
>>     259             0 sfcbd
>> [737778.730172] [ 3172]     0  3172    20392      261      40       3
>>     236             0 sfcbd
>> [737778.730219] [ 3248]     0  3248    22441        0      41       3
>>     238             0 sfcbd
>> [737778.730265] [ 3249]     0  3249    39376      155      44       3
>>     357             0 sfcbd
>> [737778.730312] [ 3450]     0  3450    39377      104      44       3
>>     244             0 sfcbd
>> [737778.730359] [ 3467]     0  3467    58324      301      46       3
>>     284             0 sfcbd
>> [737778.730405] [ 3548]     0  3548   262686      643      66       4
>>    4097             0 dsm_sa_datamgrd
>> [737778.730453] [ 3563]   101  3563    13312      403      29       3
>>     162             0 exim4
>> [737778.730499] [ 3576]   107  3576     7293      493      19       3
>>     148             0 ntpd
>> [737778.730546] [ 3585]     0  3585    61531      577     117       3
>>     496             0 winbindd
>> [737778.730593] [ 3586]     0  3586    61531      578     118       3
>>     512             0 winbindd
>> [737778.730640] [ 3651]     0  3651    48584      566      36       3
>>     487             0 dsm_sa_eventmgr
>> [737778.730688] [ 3674]     0  3674    99593      576      47       3
>>    1402             0 dsm_sa_snmpd
>> [737778.730736] [ 3717]     0  3717     7923      285      18       3
>>     115             0 dsm_om_connsvcd
>> [737778.730784] [ 3718]     0  3718   740234     1744     202       7
>>   30685             0 dsm_om_connsvcd
>> [737778.730832] [ 3736]     0  3736   178651        0      55       3
>>    3789             0 dsm_sa_datamgrd
>> [737778.730880] [ 4056]     0  4056    26472      498      57       3
>>     252             0 sshd
>> [737778.730926] [ 4060]  1000  4060     8973      501      23       3
>>     184             0 systemd
>> [737778.730973] [ 4061]  1000  4061    15702        0      34       4
>>     612             0 (sd-pam)
>> [737778.731020] [ 4063]  1000  4063    26472      158      54       3
>>     260             0 sshd
>> [737778.731067] [ 4064]  1000  4064     6041      739      16       3
>>     686             0 bash
>> [737778.731113] [ 4083]  1000  4083    16853      493      37       3
>>     128             0 su
>> [737778.731160] [ 4084]     0  4084     5501      756      15       3
>>     160             0 bash
>> [737778.731207] [15150]     0 15150     3309      678      10       3
>>      57             0 run_mirror.sh
>> [737778.731256] [24296]     0 24296     1450      139       8       3
>>      23             0 flock
>> [737778.731302] [24297]     0 24297     9576      622      22       3
>>    3990             0 rsync
>> [737778.731349] [24298]     0 24298     7552      541      18       3
>>    1073             0 rsync
>> [737778.731395] [24299]     0 24299     9522      401      22       3
>>    2416             0 rsync
>> [737778.731445] [25910]     0 25910    10257      522      23       3
>>      81             0 systemd-journal
>> [737778.731494] [25940]     0 25940    16365      617      37       3
>>     126             0 cron
>> [737778.731540] Out of memory: Kill process 3718 (dsm_om_connsvcd)
>> score 1 or sacrifice child
>> [737778.731644] Killed process 3718 (dsm_om_connsvcd)
>> total-vm:2960936kB, anon-rss:0kB, file-rss:6976kB, shmem-rss:0kB
>> [737778.768375] oom_reaper: reaped process 3718 (dsm_om_connsvcd), now
>> anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
>>
>> On Fri, Nov 4, 2016 at 5:00 PM, Vlastimil Babka <vbabka@suse.cz> wrote:
>>> On 11/04/2016 03:13 PM, E V wrote:
>>>> After the system panic'd yesterday I booted back into 4.8.4 and
>>>> restarted the rsync's. I'm away on vacation next week, so when I get
>>>> back I'll get rc4 or rc5 and try again. In the mean time here's data
>>>> from the system running 4.8.4 without problems for about a day. I'm
>>>> not familiar with xxd and didn't see a -e option, so used -E:
>>>> xxd -E -g8 -c8 /proc/kpagecount | cut -d" " -f2 | sort | uniq -c
>>>> 8258633 0000000000000000
>>>>  216440 0100000000000000
>>>
>>> The lack of -e means it's big endian, which is not a big issue. So here
>>> most of memory is free, some pages have just one pin, and only
>>> relatively few have more. The vmstats also doesn't show anything bad, so
>>> we'll have to wait if something appears within the week, or after you
>>> try 4.9 again. Thanks.
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply

* Re: [Bug 186671] New: OOM on system with just rsync running 32GB of ram 30GB of pagecache
From: E V @ 2016-11-14 20:56 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, bugzilla-daemon, linux-mm, Michal Hocko,
	linux-btrfs, Kirill A. Shutemov
In-Reply-To: <bbcd6cb7-3b73-02e9-0409-4601a6f573f5@suse.cz>

Pretty sure it was the system after the OOM just did a history search
to check, though it is 3 days afterwards and several OOMs killed
several processes in somewhat rapid succession, I just listed the 1st.
I'll turn on CONFIG_DEBUG_VM and reboot again.

On Mon, Nov 14, 2016 at 12:04 PM, Vlastimil Babka <vbabka@suse.cz> wrote:
> On 11/14/2016 02:27 PM, E V wrote:
>> System is an intel dual socket Xeon E5620, 7500/5520/5500/X58 ICH10
>> family according to lspci. Anyways 4.8.4 OOM'd while I was gone. I'll
>> download the current 4.9rc and reboot, but in the mean time here's
>> xxd, vmstat & kern.log output:
>> 8532039 0000000000000000
>
> Hmm this would suggest that the memory is mostly free. But not according
> to vmstat. Is it possible you mistakenly provided the xxd from a fresh
> boot, but vmstat from after the OOM?
>
> But sure, a page_count() of zero is a reason why __isolate_lru_page()
> would fail due to its get_page_unless_zero(). The question is then how
> could it drop to zero without being freed at the same time, as
> put_page() does.
>
> I was going to suspect commit 83929372f6 and a page_ref_sub() it adds to
> delete_from_page_cache(), but that's since 4.8 and you mention problems
> since 4.7.
>
> Anyway it might be worth enabling CONFIG_DEBUG_VM as the relevant code
> usually has VM_BUG_ONs.
>
> Vlastimil
>
>>    9324 0100000000000000
>>    2226 0200000000000000
>>     405 0300000000000000
>>      80 0400000000000000
>>      34 0500000000000000
>>      48 0600000000000000
>>      17 0700000000000000
>>      17 0800000000000000
>>      32 0900000000000000
>>      19 0a00000000000000
>>       1 0c00000000000000
>>       1 0d00000000000000
>>       1 0e00000000000000
>>      12 1000000000000000
>>       8 1100000000000000
>>      32 1200000000000000
>>      10 1300000000000000
>>       2 1400000000000000
>>      11 1500000000000000
>>      12 1600000000000000
>>       7 1700000000000000
>>       3 1800000000000000
>>       5 1900000000000000
>>       6 1a00000000000000
>>      11 1b00000000000000
>>      22 1c00000000000000
>>       3 1d00000000000000
>>      19 1e00000000000000
>>      21 1f00000000000000
>>      18 2000000000000000
>>      28 2100000000000000
>>      40 2200000000000000
>>      38 2300000000000000
>>      85 2400000000000000
>>      59 2500000000000000
>>   40520 81ffffffffffffff
>>
>> /proc/vmstat:
>> nr_free_pages 60965
>> nr_zone_inactive_anon 4646
>> nr_zone_active_anon 3265
>> nr_zone_inactive_file 633882
>> nr_zone_active_file 7017458
>> nr_zone_unevictable 0
>> nr_zone_write_pending 0
>> nr_mlock 0
>> nr_slab_reclaimable 299205
>> nr_slab_unreclaimable 195497
>> nr_page_table_pages 935
>> nr_kernel_stack 4976
>> nr_bounce 0
>> numa_hit 3577063288
>> numa_miss 541393191
>> numa_foreign 541393191
>> numa_interleave 19415
>> numa_local 3577063288
>> numa_other 0
>> nr_free_cma 0
>> nr_inactive_anon 4646
>> nr_active_anon 3265
>> nr_inactive_file 633882
>> nr_active_file 7017458
>> nr_unevictable 0
>> nr_isolated_anon 0
>> nr_isolated_file 0
>> nr_pages_scanned 0
>> workingset_refault 42685891
>> workingset_activate 15247281
>> workingset_nodereclaim 26375216
>> nr_anon_pages 5067
>> nr_mapped 5630
>> nr_file_pages 7654746
>> nr_dirty 0
>> nr_writeback 0
>> nr_writeback_temp 0
>> nr_shmem 2504
>> nr_shmem_hugepages 0
>> nr_shmem_pmdmapped 0
>> nr_anon_transparent_hugepages 0
>> nr_unstable 0
>> nr_vmscan_write 5243750485
>> nr_vmscan_immediate_reclaim 4207633857
>> nr_dirtied 1839143430
>> nr_written 1832626107
>> nr_dirty_threshold 1147728
>> nr_dirty_background_threshold 151410
>> pgpgin 166731189
>> pgpgout 7328142335
>> pswpin 98608
>> pswpout 117794
>> pgalloc_dma 29504
>> pgalloc_dma32 1006726216
>> pgalloc_normal 5275218188
>> pgalloc_movable 0
>> allocstall_dma 0
>> allocstall_dma32 0
>> allocstall_normal 36461
>> allocstall_movable 5867
>> pgskip_dma 0
>> pgskip_dma32 0
>> pgskip_normal 6417890
>> pgskip_movable 0
>> pgfree 6309223401
>> pgactivate 35076483
>> pgdeactivate 63556974
>> pgfault 35753842
>> pgmajfault 69126
>> pglazyfreed 0
>> pgrefill 70008598
>> pgsteal_kswapd 3567289713
>> pgsteal_direct 5878057
>> pgscan_kswapd 9059309872
>> pgscan_direct 4239367903
>> pgscan_direct_throttle 0
>> zone_reclaim_failed 0
>> pginodesteal 102916
>> slabs_scanned 460790262
>> kswapd_inodesteal 9130243
>> kswapd_low_wmark_hit_quickly 10634373
>> kswapd_high_wmark_hit_quickly 7348173
>> pageoutrun 18349115
>> pgrotated 16291322
>> drop_pagecache 0
>> drop_slab 0
>> pgmigrate_success 18912908
>> pgmigrate_fail 63382146
>> compact_migrate_scanned 2986269789
>> compact_free_scanned 190451505123
>> compact_isolated 109549437
>> compact_stall 3544
>> compact_fail 8
>> compact_success 3536
>> compact_daemon_wake 1403515
>> htlb_buddy_alloc_success 0
>> htlb_buddy_alloc_fail 0
>> unevictable_pgs_culled 12473
>> unevictable_pgs_scanned 0
>> unevictable_pgs_rescued 11979
>> unevictable_pgs_mlocked 14556
>> unevictable_pgs_munlocked 14556
>> unevictable_pgs_cleared 0
>> unevictable_pgs_stranded 0
>> thp_fault_alloc 0
>> thp_fault_fallback 0
>> thp_collapse_alloc 0
>> thp_collapse_alloc_failed 0
>> thp_file_alloc 0
>> thp_file_mapped 0
>> thp_split_page 0
>> thp_split_page_failed 0
>> thp_deferred_split_page 0
>> thp_split_pmd 0
>> thp_zero_page_alloc 0
>> thp_zero_page_alloc_failed 0
>>
>> kern.log OOM message:
>> [737778.724194] snmpd invoked oom-killer:
>> gfp_mask=0x24200ca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=0
>> [737778.724246] snmpd cpuset=/ mems_allowed=0-1
>> [737778.724278] CPU: 15 PID: 2976 Comm: snmpd Tainted: G        W I     4.8.4 #1
>> [737778.724352]  0000000000000000 ffffffff81292069 ffff88041e043c48
>> ffff88041e043c48
>> [737778.724403]  ffffffff8118d1f6 ffff88041dd70fc0 ffff88041e043c48
>> 000000000136236f
>> [737778.724454]  ffffffff8170e11e 0000000000000001 ffffffff8112a700
>> 000000000000030f
>> [737778.724505] Call Trace:
>> [737778.724533]  [<ffffffff81292069>] ? dump_stack+0x46/0x5d
>> [737778.727077]  [<ffffffff8118d1f6>] ? dump_header.isra.16+0x56/0x185
>> [737778.727108]  [<ffffffff8112a700>] ? oom_kill_process+0x210/0x3c0
>> [737778.727136]  [<ffffffff8112ac4b>] ? out_of_memory+0x34b/0x420
>> [737778.727165]  [<ffffffff8112fcca>] ? __alloc_pages_nodemask+0xd9a/0xde0
>> [737778.727195]  [<ffffffff811768e1>] ? alloc_pages_vma+0xc1/0x240
>> [737778.727223]  [<ffffffff81126512>] ? pagecache_get_page+0x22/0x230
>> [737778.727253]  [<ffffffff81169f44>] ? __read_swap_cache_async+0x104/0x180
>> [737778.727282]  [<ffffffff81169fcf>] ? read_swap_cache_async+0xf/0x30
>> [737778.727311]  [<ffffffff8116a0dc>] ? swapin_readahead+0xec/0x1a0
>> [737778.727340]  [<ffffffff81156270>] ? do_swap_page+0x420/0x5c0
>> [737778.727369]  [<ffffffff813f36d8>] ? SYSC_recvfrom+0xa8/0x110
>> [737778.727397]  [<ffffffff81157a39>] ? handle_mm_fault+0x629/0xe30
>> [737778.727426]  [<ffffffff81048fc5>] ? __do_page_fault+0x1b5/0x480
>> [737778.727456]  [<ffffffff814fbaa2>] ? page_fault+0x22/0x30
>> [737778.727497] Mem-Info:
>> [737778.727524] active_anon:24 inactive_anon:49 isolated_anon:0
>> [737778.727524]  active_file:6920154 inactive_file:798043 isolated_file:576
>> [737778.727524]  unevictable:0 dirty:800528 writeback:1307 unstable:0
>> [737778.727524]  slab_reclaimable:264367 slab_unreclaimable:193348
>> [737778.727524]  mapped:4063 shmem:0 pagetables:1719 bounce:0
>> [737778.727524]  free:39225 free_pcp:47 free_cma:0
>> [737778.727677] Node 0 active_anon:16kB inactive_anon:76kB
>> active_file:14249324kB inactive_file:1296908kB unevictable:0kB
>> isolated(anon):0kB isolated(file):1920kB mapped:10432kB
>> dirty:1308528kB writeback:0kB shmem:0kB shmem_thp: 0kB
>> shmem_pmdmapped: 0kB anon_thp: 0kB writeback_tmp:0kB unstable:0kB
>> pages_scanned:23557303 all_unreclaimable? yes
>> [737778.727806] Node 1 active_anon:80kB inactive_anon:120kB
>> active_file:13431292kB inactive_file:1895264kB unevictable:0kB
>> isolated(anon):0kB isolated(file):384kB mapped:5820kB dirty:1893584kB
>> writeback:5228kB shmem:0kB shmem_thp: 0kB shmem_pmdmapped: 0kB
>> anon_thp: 0kB writeback_tmp:0kB unstable:0kB pages_scanned:25598673
>> all_unreclaimable? yes
>> [737778.727930] Node 0 Normal free:44864kB min:45192kB low:61736kB
>> high:78280kB active_anon:16kB inactive_anon:76kB
>> active_file:14249324kB inactive_file:1296908kB unevictable:0kB
>> writepending:1308528kB present:16777216kB managed:16544856kB
>> mlocked:0kB slab_reclaimable:562644kB slab_unreclaimable:317504kB
>> kernel_stack:3840kB pagetables:3672kB bounce:0kB free_pcp:20kB
>> local_pcp:0kB free_cma:0kB
>> [737778.728066] lowmem_reserve[]: 0 0 0 0
>> [737778.728100] Node 1 DMA free:15896kB min:40kB low:52kB high:64kB
>> active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB
>> unevictable:0kB writepending:0kB present:15996kB managed:15896kB
>> mlocked:0kB slab_reclaimable:0kB slab_unreclaimable:0kB
>> kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB
>> free_cma:0kB
>> [737778.728228] lowmem_reserve[]: 0 3216 16044 16044
>> [737778.728263] Node 1 DMA32 free:60300kB min:8996kB low:12288kB
>> high:15580kB active_anon:4kB inactive_anon:4kB active_file:2660988kB
>> inactive_file:474956kB unevictable:0kB writepending:475116kB
>> present:3378660kB managed:3304720kB mlocked:0kB
>> slab_reclaimable:83612kB slab_unreclaimable:16668kB kernel_stack:320kB
>> pagetables:16kB bounce:0kB free_pcp:4kB local_pcp:4kB free_cma:0kB
>> [737778.728397] lowmem_reserve[]: 0 0 12827 12827
>> [737778.728431] Node 1 Normal free:35840kB min:35876kB low:49008kB
>> high:62140kB active_anon:76kB inactive_anon:116kB
>> active_file:10770304kB inactive_file:1420308kB unevictable:0kB
>> writepending:1423696kB present:13369344kB managed:13135424kB
>> mlocked:0kB slab_reclaimable:411212kB slab_unreclaimable:439220kB
>> kernel_stack:2864kB pagetables:3188kB bounce:0kB free_pcp:164kB
>> local_pcp:36kB free_cma:0kB
>> [737778.728568] lowmem_reserve[]: 0 0 0 0
>> [737778.728601] Node 0 Normal: 11208*4kB (UME) 4*8kB (U) 0*16kB 0*32kB
>> 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 44864kB
>> [737778.728686] Node 1 DMA: 0*4kB 1*8kB (U) 1*16kB (U) 0*32kB 2*64kB
>> (U) 1*128kB (U) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (M) 3*4096kB
>> (M) = 15896kB
>> [737778.728786] Node 1 DMA32: 11759*4kB (UME) 1658*8kB (UM) 0*16kB
>> 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB =
>> 60300kB
>> [737778.728875] Node 1 Normal: 7984*4kB (UME) 470*8kB (UME) 3*16kB (U)
>> 3*32kB (UM) 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB
>> = 35840kB
>> [737778.728973] Node 0 hugepages_total=0 hugepages_free=0
>> hugepages_surp=0 hugepages_size=1048576kB
>> [737778.729019] Node 0 hugepages_total=0 hugepages_free=0
>> hugepages_surp=0 hugepages_size=2048kB
>> [737778.729065] Node 1 hugepages_total=0 hugepages_free=0
>> hugepages_surp=0 hugepages_size=1048576kB
>> [737778.729111] Node 1 hugepages_total=0 hugepages_free=0
>> hugepages_surp=0 hugepages_size=2048kB
>> [737778.729156] 7718841 total pagecache pages
>> [737778.729179] 68 pages in swap cache
>> [737778.729202] Swap cache stats: add 193888, delete 193820, find 160188/213014
>> [737778.729231] Free swap  = 48045076kB
>> [737778.729254] Total swap = 48300028kB
>> [737778.729277] 8385304 pages RAM
>> [737778.729299] 0 pages HighMem/MovableOnly
>> [737778.729322] 135080 pages reserved
>> [737778.729344] 0 pages hwpoisoned
>> [737778.729365] [ pid ]   uid  tgid total_vm      rss nr_ptes nr_pmds
>> swapents oom_score_adj name
>> [737778.729417] [ 1927]     0  1927     9941      447      22       3
>>     299         -1000 systemd-udevd
>> [737778.729465] [ 2812]     0  2812     9289      412      23       4
>>     161             0 rpcbind
>> [737778.729512] [ 2836]   102  2836     9320      414      23       3
>>     151             0 rpc.statd
>> [737778.729560] [ 2851]   104  2851   162257      276      75       3
>>    7489             0 apt-cacher-ng
>> [737778.729608] [ 2856]     0  2856    13796      345      31       3
>>     167         -1000 sshd
>> [737778.729655] [ 2857]     0  2857    64668      504      27       4
>>     355             0 rsyslogd
>> [737778.729702] [ 2858]     0  2858     6876      518      18       3
>>      83             0 cron
>> [737778.729748] [ 2859]     0  2859     4756      360      14       3
>>      44             0 atd
>> [737778.729795] [ 2860]     0  2860     7059      523      18       3
>>     591             0 smartd
>> [737778.729842] [ 2864]     0  2864     7082      559      19       4
>>      96             0 systemd-logind
>> [737778.729890] [ 2865]   106  2865    10563      528      24       3
>>     110          -900 dbus-daemon
>> [737778.729938] [ 2925]     0  2925     3604      421      12       3
>>      38             0 agetty
>> [737778.729985] [ 2974]     0  2974     4852      365      13       3
>>      73             0 irqbalance
>> [737778.730032] [ 2976]   105  2976    14299      496      29       3
>>    1534             0 snmpd
>> [737778.730078] [ 2992]     0  2992     3180      227      11       3
>>      38             0 mcelog
>> [737778.730125] [ 3095]     0  3095    26571      344      43       3
>>     259             0 sfcbd
>> [737778.730172] [ 3172]     0  3172    20392      261      40       3
>>     236             0 sfcbd
>> [737778.730219] [ 3248]     0  3248    22441        0      41       3
>>     238             0 sfcbd
>> [737778.730265] [ 3249]     0  3249    39376      155      44       3
>>     357             0 sfcbd
>> [737778.730312] [ 3450]     0  3450    39377      104      44       3
>>     244             0 sfcbd
>> [737778.730359] [ 3467]     0  3467    58324      301      46       3
>>     284             0 sfcbd
>> [737778.730405] [ 3548]     0  3548   262686      643      66       4
>>    4097             0 dsm_sa_datamgrd
>> [737778.730453] [ 3563]   101  3563    13312      403      29       3
>>     162             0 exim4
>> [737778.730499] [ 3576]   107  3576     7293      493      19       3
>>     148             0 ntpd
>> [737778.730546] [ 3585]     0  3585    61531      577     117       3
>>     496             0 winbindd
>> [737778.730593] [ 3586]     0  3586    61531      578     118       3
>>     512             0 winbindd
>> [737778.730640] [ 3651]     0  3651    48584      566      36       3
>>     487             0 dsm_sa_eventmgr
>> [737778.730688] [ 3674]     0  3674    99593      576      47       3
>>    1402             0 dsm_sa_snmpd
>> [737778.730736] [ 3717]     0  3717     7923      285      18       3
>>     115             0 dsm_om_connsvcd
>> [737778.730784] [ 3718]     0  3718   740234     1744     202       7
>>   30685             0 dsm_om_connsvcd
>> [737778.730832] [ 3736]     0  3736   178651        0      55       3
>>    3789             0 dsm_sa_datamgrd
>> [737778.730880] [ 4056]     0  4056    26472      498      57       3
>>     252             0 sshd
>> [737778.730926] [ 4060]  1000  4060     8973      501      23       3
>>     184             0 systemd
>> [737778.730973] [ 4061]  1000  4061    15702        0      34       4
>>     612             0 (sd-pam)
>> [737778.731020] [ 4063]  1000  4063    26472      158      54       3
>>     260             0 sshd
>> [737778.731067] [ 4064]  1000  4064     6041      739      16       3
>>     686             0 bash
>> [737778.731113] [ 4083]  1000  4083    16853      493      37       3
>>     128             0 su
>> [737778.731160] [ 4084]     0  4084     5501      756      15       3
>>     160             0 bash
>> [737778.731207] [15150]     0 15150     3309      678      10       3
>>      57             0 run_mirror.sh
>> [737778.731256] [24296]     0 24296     1450      139       8       3
>>      23             0 flock
>> [737778.731302] [24297]     0 24297     9576      622      22       3
>>    3990             0 rsync
>> [737778.731349] [24298]     0 24298     7552      541      18       3
>>    1073             0 rsync
>> [737778.731395] [24299]     0 24299     9522      401      22       3
>>    2416             0 rsync
>> [737778.731445] [25910]     0 25910    10257      522      23       3
>>      81             0 systemd-journal
>> [737778.731494] [25940]     0 25940    16365      617      37       3
>>     126             0 cron
>> [737778.731540] Out of memory: Kill process 3718 (dsm_om_connsvcd)
>> score 1 or sacrifice child
>> [737778.731644] Killed process 3718 (dsm_om_connsvcd)
>> total-vm:2960936kB, anon-rss:0kB, file-rss:6976kB, shmem-rss:0kB
>> [737778.768375] oom_reaper: reaped process 3718 (dsm_om_connsvcd), now
>> anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
>>
>> On Fri, Nov 4, 2016 at 5:00 PM, Vlastimil Babka <vbabka@suse.cz> wrote:
>>> On 11/04/2016 03:13 PM, E V wrote:
>>>> After the system panic'd yesterday I booted back into 4.8.4 and
>>>> restarted the rsync's. I'm away on vacation next week, so when I get
>>>> back I'll get rc4 or rc5 and try again. In the mean time here's data
>>>> from the system running 4.8.4 without problems for about a day. I'm
>>>> not familiar with xxd and didn't see a -e option, so used -E:
>>>> xxd -E -g8 -c8 /proc/kpagecount | cut -d" " -f2 | sort | uniq -c
>>>> 8258633 0000000000000000
>>>>  216440 0100000000000000
>>>
>>> The lack of -e means it's big endian, which is not a big issue. So here
>>> most of memory is free, some pages have just one pin, and only
>>> relatively few have more. The vmstats also doesn't show anything bad, so
>>> we'll have to wait if something appears within the week, or after you
>>> try 4.9 again. Thanks.
>

^ permalink raw reply

* Re: [PATCH RFC] xfs: drop SYNC_WAIT from xfs_reclaim_inodes_ag during slab reclaim
From: Chris Mason @ 2016-11-14 20:56 UTC (permalink / raw)
  To: Dave Chinner; +Cc: linux-xfs
In-Reply-To: <20161114072708.GN28922@dastard>

On 11/14/2016 02:27 AM, Dave Chinner wrote:
> On Sun, Nov 13, 2016 at 08:00:04PM -0500, Chris Mason wrote:
>> On Tue, Oct 18, 2016 at 01:03:24PM +1100, Dave Chinner wrote:
>>
>> [ Long stalls from xfs_reclaim_inodes_ag ]
>>
>>> XFS has *1* tunable that can change the behaviour of metadata
>>> writeback. Please try it.
>>
>> [ weeks go by, so this email is insanely long ]
>>
>> Testing all of this was slow going because two of the three test
>> boxes I had with the hadoop configuration starting having hardware
>> problems.  The good news is that while I was adjusting the
>> benchmark, we lined up access to a bunch of duplicate boxes, so I
>> can now try ~20 different configurations in parallel.
>>
>> My rough benchmark is here:
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/mason/simoop.git
>>
>> The command line I ended up using was:
>>
>> simoop -t 512 -m 190 -M 128 -C 28 -r 60000 -f 70 -T 20 -R1 -W 1 -i
>> 60 -w 300 -D 2 /hammer/*
>
> There's a lightly tested patch below that should do the trick.
>
> After 5 minutes on a modified simoop cli on a single filesystem,
> 4.9-rc4+for-next:
>
> $ ./simoop -t 128 -m 50 -M 128 -C 14 -r 60000 -f 2 -T 20 -R1 -W 1 -i 60 -w 300 -D 2 /mnt/scratch
> ....
> Run time: 300 seconds
> Read latency (p50: 3,174,400) (p95: 4,530,176) (p99: 18,055,168)
> Write latency (p50: 14,991,360) (p95: 28,672,000) (p99: 33,325,056)
> Allocation latency (p50: 1,771,520) (p95: 17,530,880) (p99: 23,756,800)
> work rate = 4.75/sec (avg 5.24/sec) (p50: 5.79) (p95: 6.99) (p99: 6.99)
> alloc stall rate = 94.42/sec (avg: 51.63) (p50: 51.60) (p95: 59.12) (p99: 59.12)
>
> With the patch below:
>
> Run time: 300 seconds
> Read latency (p50: 3,043,328) (p95: 3,649,536) (p99: 4,710,400)
> Write latency (p50: 21,004,288) (p95: 27,557,888) (p99: 29,130,752)
> Allocation latency (p50: 280,064) (p95: 680,960) (p99: 863,232)
> work rate = 4.08/sec (avg 4.76/sec) (p50: 5.39) (p95: 6.93) (p99: 6.93)
> alloc stall rate = 0.08/sec (avg: 0.02) (p50: 0.00) (p95: 0.01) (p99: 0.01)
>
> Stall rate went to zero and stayed there at the 120s mark of the
> warmup. Note the p99 difference for read and allocation latency,
> too.
>
> I'll post some graphs tomorrow from my live PCP telemetry that
> demonstrate the difference in behaviour better than any words...

Thanks Dave, this is definitely better.  But at least for the multi-disk 
setup, it's not quite there yet.

Your patch:
___
Run time: 15535 seconds
Read latency (p50: 22,708,224) (p95: 34,668,544) (p99: 41,746,432)
Write latency (p50: 21,200,896) (p95: 34,799,616) (p99: 41,877,504)
Allocation latency (p50: 11,550,720) (p95: 31,424,512) (p99: 39,518,208)
work rate = 7.48/sec (avg 8.41/sec) (p50: 8.69) (p95: 9.57) (p99: 9.87)
alloc stall rate = 14.08/sec (avg: 14.85) (p50: 15.74) (p95: 19.74) 
(p99: 22.04)

Original patch:
___
Run time: 15474 seconds
Read latency (p50: 20,414,464) (p95: 29,786,112) (p99: 34,275,328)
Write latency (p50: 15,155,200) (p95: 25,591,808) (p99: 31,621,120)
Allocation latency (p50: 7,675,904) (p95: 22,970,368) (p99: 29,523,968)
work rate = 8.33/sec (avg 10.54/sec) (p50: 10.54) (p95: 10.58) (p99: 10.58)
alloc stall rate = 37.08/sec (avg: 21.73) (p50: 23.16) (p95: 24.68) 
(p99: 25.00)

v4.8
___
Run time: 15492 seconds
Read latency (p50: 22,642,688) (p95: 35,848,192) (p99: 43,712,512)
Write latency (p50: 21,200,896) (p95: 35,454,976) (p99: 43,450,368)
Allocation latency (p50: 12,599,296) (p95: 34,144,256) (p99: 41,615,360)
work rate = 9.77/sec (avg 8.15/sec) (p50: 8.37) (p95: 9.29) (p99: 9.55)
alloc stall rate = 8.33/sec (avg: 33.65) (p50: 34.52) (p95: 37.40) (p99: 
37.96)

One thing that might have been too far buried in my email yesterday. 
The read/write latencies include the time to start threads, that's not 
just IO in there.

I've had this running all day, but the differences stabilized after 5-10 
minutes.  Everyone's p99s trend higher as the day goes on, but the 
percentage difference stays about the same.

I think the difference between mine and yours is we didn't quite get the 
allocation stalls down to zero, so making tasks wait for the shrinker 
shows up in the end numbers.

For your patch, the stalls from xfs_reclaim_inodes_ag() were about the 
same as the unpatched kernel yesterday.  We still had long tails in the 
30 second+ category.

I did a trace on vmscan:mm_vmscan_direct_reclaim_begin, and 91% of the 
allocation stalls were:

order=0 may_writepage=1 gfp_flags=GFP_HIGHUSER_MOVABLE|__GFP_ZERO 
classzone_idx=3

These are all page faults, either during read() syscalls or when simoop 
was touching all the pages in its mmap()'d area (-M from the cmdline)

One detail I didn't give yesterday was these are all using deadline as 
the IO scheduler.

-chris

^ permalink raw reply

* Re: [PATCH 3/4] selinux: Clean up initialization of isec->sclass
From: Paul Moore @ 2016-11-14 20:56 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: Stephen Smalley, Eric Paris, selinux
In-Reply-To: <1478812710-17190-4-git-send-email-agruenba@redhat.com>

On Thu, Nov 10, 2016 at 4:18 PM, Andreas Gruenbacher
<agruenba@redhat.com> wrote:
> Now that isec->initialized == LABEL_INITIALIZED implies that
> isec->sclass is valid, skip such inodes immediately in
> inode_doinit_with_dentry.
>
> For the remaining inodes, initialize isec->sclass at the beginning of
> inode_doinit_with_dentry to simplify the code.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> ---
>  security/selinux/hooks.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)

Merged, thanks.

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index e4527d9..cf5067e 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -1389,12 +1389,15 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
>         int rc = 0;
>
>         if (isec->initialized == LABEL_INITIALIZED)
> -               goto out;
> +               return 0;
>
>         mutex_lock(&isec->lock);
>         if (isec->initialized == LABEL_INITIALIZED)
>                 goto out_unlock;
>
> +       if (isec->sclass == SECCLASS_FILE)
> +               isec->sclass = inode_mode_to_security_class(inode->i_mode);
> +
>         sbsec = inode->i_sb->s_security;
>         if (!(sbsec->flags & SE_SBINITIALIZED)) {
>                 /* Defer initialization until selinux_complete_init,
> @@ -1512,7 +1515,6 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
>                 isec->sid = sbsec->sid;
>
>                 /* Try to obtain a transition SID. */
> -               isec->sclass = inode_mode_to_security_class(inode->i_mode);
>                 rc = security_transition_sid(isec->task_sid, sbsec->sid,
>                                              isec->sclass, NULL, &sid);
>                 if (rc)
> @@ -1548,7 +1550,6 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
>                          */
>                         if (!dentry)
>                                 goto out_unlock;
> -                       isec->sclass = inode_mode_to_security_class(inode->i_mode);
>                         rc = selinux_genfs_get_sid(dentry, isec->sclass,
>                                                    sbsec->flags, &sid);
>                         dput(dentry);
> @@ -1563,9 +1564,6 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
>
>  out_unlock:
>         mutex_unlock(&isec->lock);
> -out:
> -       if (isec->sclass == SECCLASS_FILE)
> -               isec->sclass = inode_mode_to_security_class(inode->i_mode);
>         return rc;
>  }
>
> --
> 2.7.4
>



-- 
paul moore
www.paul-moore.com

^ permalink raw reply

* [Qemu-devel] [PATCH 3/3] migration: Don't create decompression threads if not enabled
From: Juan Quintela @ 2016-11-14 20:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, dgilbert
In-Reply-To: <1479156950-2517-1-git-send-email-quintela@redhat.com>

Signed-off-by: Juan Quintela <quintela@redhat.com>

--

I removed the [HACK] part because previous patch just check that
compression pages are not received.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/ram.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/migration/ram.c b/migration/ram.c
index 4bb707c..24e2591 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2260,6 +2260,9 @@ void migrate_decompress_threads_create(void)
 {
     int i, thread_count;

+    if (!migrate_use_compression()) {
+        return;
+    }
     thread_count = migrate_decompress_threads();
     decompress_threads = g_new0(QemuThread, thread_count);
     decomp_param = g_new0(DecompressParam, thread_count);
@@ -2281,6 +2284,9 @@ void migrate_decompress_threads_join(void)
 {
     int i, thread_count;

+    if (!migrate_use_compression()) {
+        return;
+    }
     thread_count = migrate_decompress_threads();
     for (i = 0; i < thread_count; i++) {
         qemu_mutex_lock(&decomp_param[i].mutex);
-- 
2.7.4

^ permalink raw reply related

* [Qemu-devel] [PATCH 1/3] migration: create Migration Incoming State at init time
From: Juan Quintela @ 2016-11-14 20:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, dgilbert
In-Reply-To: <1479156950-2517-1-git-send-email-quintela@redhat.com>

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h |  1 -
 migration/migration.c         | 38 +++++++++++++++++---------------------
 migration/savevm.c            |  4 ++--
 3 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index c309d23..a184509 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -119,7 +119,6 @@ struct MigrationIncomingState {
 };

 MigrationIncomingState *migration_incoming_get_current(void);
-MigrationIncomingState *migration_incoming_state_new(QEMUFile *f);
 void migration_incoming_state_destroy(void);

 /*
diff --git a/migration/migration.c b/migration/migration.c
index e331f28..51ca9b4 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -111,32 +111,28 @@ MigrationState *migrate_get_current(void)
     return &current_migration;
 }

-/* For incoming */
-static MigrationIncomingState *mis_current;
-
 MigrationIncomingState *migration_incoming_get_current(void)
 {
-    return mis_current;
-}
+    static bool once;
+    static MigrationIncomingState mis_current;

-MigrationIncomingState *migration_incoming_state_new(QEMUFile* f)
-{
-    mis_current = g_new0(MigrationIncomingState, 1);
-    mis_current->from_src_file = f;
-    mis_current->state = MIGRATION_STATUS_NONE;
-    QLIST_INIT(&mis_current->loadvm_handlers);
-    qemu_mutex_init(&mis_current->rp_mutex);
-    qemu_event_init(&mis_current->main_thread_load_event, false);
-
-    return mis_current;
+    if (!once) {
+        mis_current.state = MIGRATION_STATUS_NONE;
+        memset(&mis_current, 0, sizeof(MigrationIncomingState));
+        QLIST_INIT(&mis_current.loadvm_handlers);
+        qemu_mutex_init(&mis_current.rp_mutex);
+        qemu_event_init(&mis_current.main_thread_load_event, false);
+        once = true;
+    }
+    return &mis_current;
 }

 void migration_incoming_state_destroy(void)
 {
-    qemu_event_destroy(&mis_current->main_thread_load_event);
-    loadvm_free_handlers(mis_current);
-    g_free(mis_current);
-    mis_current = NULL;
+    struct MigrationIncomingState *mis = migration_incoming_get_current();
+
+    qemu_event_destroy(&mis->main_thread_load_event);
+    loadvm_free_handlers(mis);
 }


@@ -382,11 +378,11 @@ static void process_incoming_migration_bh(void *opaque)
 static void process_incoming_migration_co(void *opaque)
 {
     QEMUFile *f = opaque;
-    MigrationIncomingState *mis;
+    MigrationIncomingState *mis = migration_incoming_get_current();
     PostcopyState ps;
     int ret;

-    mis = migration_incoming_state_new(f);
+    mis->from_src_file = f;
     postcopy_state_set(POSTCOPY_INCOMING_NONE);
     migrate_set_state(&mis->state, MIGRATION_STATUS_NONE,
                       MIGRATION_STATUS_ACTIVE);
diff --git a/migration/savevm.c b/migration/savevm.c
index 0363372..d44a38c 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2159,7 +2159,6 @@ void qmp_xen_load_devices_state(const char *filename, Error **errp)
     qio_channel_set_name(QIO_CHANNEL(ioc), "migration-xen-load-state");
     f = qemu_fopen_channel_input(QIO_CHANNEL(ioc));

-    migration_incoming_state_new(f);
     ret = qemu_loadvm_state(f);
     qemu_fclose(f);
     if (ret < 0) {
@@ -2175,6 +2174,7 @@ int load_vmstate(const char *name)
     QEMUFile *f;
     int ret;
     AioContext *aio_context;
+    MigrationIncomingState *mis = migration_incoming_get_current();

     if (!bdrv_all_can_snapshot(&bs)) {
         error_report("Device '%s' is writable but does not support snapshots.",
@@ -2225,7 +2225,7 @@ int load_vmstate(const char *name)
     }

     qemu_system_reset(VMRESET_SILENT);
-    migration_incoming_state_new(f);
+    mis->from_src_file = f;

     aio_context_acquire(aio_context);
     ret = qemu_loadvm_state(f);
-- 
2.7.4

^ permalink raw reply related

* [Qemu-devel] [PATCH 2/3] migration: Test for disabled features on reception
From: Juan Quintela @ 2016-11-14 20:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, dgilbert
In-Reply-To: <1479156950-2517-1-git-send-email-quintela@redhat.com>

Right now, if we receive a compressed page or a xbzrle page while this
features are disabled, Bad Things (TM) can happen.  Just add a test for
them.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/ram.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/migration/ram.c b/migration/ram.c
index fb9252d..4bb707c 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2464,7 +2464,7 @@ static int ram_load_postcopy(QEMUFile *f)

 static int ram_load(QEMUFile *f, void *opaque, int version_id)
 {
-    int flags = 0, ret = 0;
+    int flags = 0, ret = 0, invalid_flags;
     static uint64_t seq_iter;
     int len = 0;
     /*
@@ -2479,6 +2479,15 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
         ret = -EINVAL;
     }

+    invalid_flags = 0;
+
+    if (!migrate_use_xbzrle()) {
+        invalid_flags |= RAM_SAVE_FLAG_XBZRLE;
+    }
+
+    if (!migrate_use_compression()) {
+        invalid_flags |= RAM_SAVE_FLAG_COMPRESS_PAGE;
+    }
     /* This RCU critical section can be very long running.
      * When RCU reclaims in the code start to become numerous,
      * it will be necessary to reduce the granularity of this
@@ -2499,6 +2508,18 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
         flags = addr & ~TARGET_PAGE_MASK;
         addr &= TARGET_PAGE_MASK;

+        if (flags & invalid_flags) {
+            if (flags & invalid_flags  & RAM_SAVE_FLAG_XBZRLE) {
+                error_report("Received an unexpected XBRLE page");
+            }
+            if (flags & invalid_flags  & RAM_SAVE_FLAG_COMPRESS_PAGE) {
+                error_report("Received an unexpected compressed page");
+            }
+
+            ret = -EINVAL;
+            break;
+        }
+
         if (flags & (RAM_SAVE_FLAG_COMPRESS | RAM_SAVE_FLAG_PAGE |
                      RAM_SAVE_FLAG_COMPRESS_PAGE | RAM_SAVE_FLAG_XBZRLE)) {
             RAMBlock *block = ram_block_from_stream(f, flags);
-- 
2.7.4

^ permalink raw reply related

* [Qemu-devel] [PATCH 0/3] Migration fixes
From: Juan Quintela @ 2016-11-14 20:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, dgilbert


Hi

This are the fixes that were of the multifd patches.

The most important one is the second patch, that one that checks for valid flags on reception.

Please, review.

Juan Quintela (3):
  migration: create Migration Incoming State at init time
  migration: Test for disabled features on reception
  migration: Don't create decompression threads if not enabled

 include/migration/migration.h |  1 -
 migration/migration.c         | 38 +++++++++++++++++---------------------
 migration/ram.c               | 29 ++++++++++++++++++++++++++++-
 migration/savevm.c            |  4 ++--
 4 files changed, 47 insertions(+), 25 deletions(-)

-- 
2.7.4

^ permalink raw reply

* [PATCH v2 5/5] NFSv4: Optimise away forced revalidation when we know the attributes are OK
From: Trond Myklebust @ 2016-11-14 20:55 UTC (permalink / raw)
  To: linux-nfs
In-Reply-To: <1479156935-34479-5-git-send-email-trond.myklebust@primarydata.com>

The NFS_INO_REVAL_FORCED flag needs to be set if we just got a delegation,
and we see that there might still be some ambiguity as to whether or not
our attribute or data cache are valid.
In practice, this means that a call to nfs_check_inode_attributes() will
have noticed a discrepancy between cached attributes and measured ones,
so let's move the setting of NFS_INO_REVAL_FORCED to there.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/delegation.c | 4 ----
 fs/nfs/inode.c      | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index dff600ae0d74..d7df5e67b0c1 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -391,10 +391,6 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
 	rcu_assign_pointer(nfsi->delegation, delegation);
 	delegation = NULL;
 
-	/* Ensure we revalidate the attributes and page cache! */
-	spin_lock(&inode->i_lock);
-	nfsi->cache_validity |= NFS_INO_REVAL_FORCED;
-	spin_unlock(&inode->i_lock);
 	trace_nfs4_set_delegation(inode, res->delegation_type);
 
 out:
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index bf4ec5ecc97e..3575e3408bd7 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1317,7 +1317,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
 		invalid |= NFS_INO_INVALID_ATIME;
 
 	if (invalid != 0)
-		nfs_set_cache_invalid(inode, invalid);
+		nfs_set_cache_invalid(inode, invalid | NFS_INO_REVAL_FORCED);
 
 	nfsi->read_cache_jiffies = fattr->time_start;
 	return 0;
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 4/5] NFSv4: Don't request close-to-open attribute when holding a delegation
From: Trond Myklebust @ 2016-11-14 20:55 UTC (permalink / raw)
  To: linux-nfs
In-Reply-To: <1479156935-34479-4-git-send-email-trond.myklebust@primarydata.com>

If holding a delegation, we do not need to ask the server to return
close-to-open cache consistency attributes as part of the CLOSE
compound.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/nfs4proc.c | 10 ++++++++--
 fs/nfs/nfs4xdr.c  |  3 ++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1897591689f6..a21b3cb87453 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3144,8 +3144,15 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
 		goto out_wait;
 	}
 
-	if (calldata->arg.fmode == 0)
+	if (calldata->arg.fmode == 0) {
 		task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE];
+
+		/* Close-to-open cache consistency revalidation */
+		if (!nfs4_have_delegation(inode, FMODE_READ))
+			calldata->arg.bitmask = NFS_SERVER(inode)->cache_consistency_bitmask;
+		else
+			calldata->arg.bitmask = NULL;
+	}
 	if (calldata->roc)
 		pnfs_roc_get_barrier(inode, &calldata->roc_barrier);
 
@@ -3228,7 +3235,6 @@ int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait)
 	if (IS_ERR(calldata->arg.seqid))
 		goto out_free_calldata;
 	calldata->arg.fmode = 0;
-	calldata->arg.bitmask = server->cache_consistency_bitmask;
 	calldata->res.fattr = &calldata->fattr;
 	calldata->res.seqid = calldata->arg.seqid;
 	calldata->res.server = server;
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 43cc989b5c06..a8bebb52df78 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2250,7 +2250,8 @@ static void nfs4_xdr_enc_close(struct rpc_rqst *req, struct xdr_stream *xdr,
 	encode_sequence(xdr, &args->seq_args, &hdr);
 	encode_putfh(xdr, args->fh, &hdr);
 	encode_close(xdr, args, &hdr);
-	encode_getfattr(xdr, args->bitmask, &hdr);
+	if (args->bitmask != NULL)
+		encode_getfattr(xdr, args->bitmask, &hdr);
 	encode_nops(&hdr);
 }
 
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 3/5] NFSv4: Don't request a GETATTR on open_downgrade.
From: Trond Myklebust @ 2016-11-14 20:55 UTC (permalink / raw)
  To: linux-nfs
In-Reply-To: <1479156935-34479-3-git-send-email-trond.myklebust@primarydata.com>

If we're not closing the file completely, there is no need to request
close-to-open attributes.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/nfs4xdr.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index fc89e5ed07ee..43cc989b5c06 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -2328,7 +2328,6 @@ static void nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req,
 	encode_sequence(xdr, &args->seq_args, &hdr);
 	encode_putfh(xdr, args->fh, &hdr);
 	encode_open_downgrade(xdr, args, &hdr);
-	encode_getfattr(xdr, args->bitmask, &hdr);
 	encode_nops(&hdr);
 }
 
@@ -6115,9 +6114,6 @@ static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp,
 	if (status)
 		goto out;
 	status = decode_open_downgrade(xdr, res);
-	if (status != 0)
-		goto out;
-	decode_getfattr(xdr, res->fattr, res->server);
 out:
 	return status;
 }
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 2/5] NFSv4: Don't ask for the change attribute when reclaiming state
From: Trond Myklebust @ 2016-11-14 20:55 UTC (permalink / raw)
  To: linux-nfs
In-Reply-To: <1479156935-34479-2-git-send-email-trond.myklebust@primarydata.com>

We don't need to ask for the change attribute when returning a delegation
or recovering from a server reboot, and it could actually cause us to
obtain an incorrect value if we're using a pNFS flavour that requires
LAYOUTCOMMIT.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/nfs4proc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 03109b69c036..1897591689f6 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -226,7 +226,6 @@ static const u32 nfs4_pnfs_open_bitmap[3] = {
 
 static const u32 nfs4_open_noattr_bitmap[3] = {
 	FATTR4_WORD0_TYPE
-	| FATTR4_WORD0_CHANGE
 	| FATTR4_WORD0_FILEID,
 };
 
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 1/5] NFSv4: Don't check file access when reclaiming state
From: Trond Myklebust @ 2016-11-14 20:55 UTC (permalink / raw)
  To: linux-nfs
In-Reply-To: <1479156935-34479-1-git-send-email-trond.myklebust@primarydata.com>

If we're reclaiming state after a reboot, or as part of returning a
delegation, we don't need to check access modes again.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/nfs4proc.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 61d751005907..03109b69c036 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1221,6 +1221,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
 	atomic_inc(&sp->so_count);
 	p->o_arg.open_flags = flags;
 	p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE);
+	p->o_arg.claim = nfs4_map_atomic_open_claim(server, claim);
 	p->o_arg.share_access = nfs4_map_atomic_open_share(server,
 			fmode, flags);
 	/* don't put an ACCESS op in OPEN compound if O_EXCL, because ACCESS
@@ -1228,8 +1229,16 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
 	if (!(flags & O_EXCL)) {
 		/* ask server to check for all possible rights as results
 		 * are cached */
-		p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY |
-				  NFS4_ACCESS_EXTEND | NFS4_ACCESS_EXECUTE;
+		switch (p->o_arg.claim) {
+		default:
+			break;
+		case NFS4_OPEN_CLAIM_NULL:
+		case NFS4_OPEN_CLAIM_FH:
+			p->o_arg.access = NFS4_ACCESS_READ |
+				NFS4_ACCESS_MODIFY |
+				NFS4_ACCESS_EXTEND |
+				NFS4_ACCESS_EXECUTE;
+		}
 	}
 	p->o_arg.clientid = server->nfs_client->cl_clientid;
 	p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time);
@@ -1239,7 +1248,6 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
 	p->o_arg.bitmask = nfs4_bitmask(server, label);
 	p->o_arg.open_bitmap = &nfs4_fattr_bitmap[0];
 	p->o_arg.label = nfs4_label_copy(p->a_label, label);
-	p->o_arg.claim = nfs4_map_atomic_open_claim(server, claim);
 	switch (p->o_arg.claim) {
 	case NFS4_OPEN_CLAIM_NULL:
 	case NFS4_OPEN_CLAIM_DELEGATE_CUR:
-- 
2.7.4


^ permalink raw reply related

* [PATCH v2 0/5] Optimisations for state management
From: Trond Myklebust @ 2016-11-14 20:55 UTC (permalink / raw)
  To: linux-nfs

The following patches constitute a grab bag of minor optimisations when
the NFS client is managing its state.

v2: Fix "enumeration value 'NFS4_OPEN_CLAIM_PREVIOUS' not handled in switch"

Trond Myklebust (5):
  NFSv4: Don't check file access when reclaiming state
  NFSv4: Don't ask for the change attribute when reclaiming state
  NFSv4: Don't request a GETATTR on open_downgrade.
  NFSv4: Don't request close-to-open attribute when holding a delegation
  NFSv4: Optimise away forced revalidation when we know the attributes
    are OK

 fs/nfs/delegation.c |  4 ----
 fs/nfs/inode.c      |  2 +-
 fs/nfs/nfs4proc.c   | 25 +++++++++++++++++++------
 fs/nfs/nfs4xdr.c    |  7 ++-----
 4 files changed, 22 insertions(+), 16 deletions(-)

-- 
2.7.4


^ permalink raw reply

* [Buildroot] [PATCH] dtv-scan-tables: rename file to have only ASCII characters
From: Thomas Petazzoni @ 2016-11-14 20:55 UTC (permalink / raw)
  To: buildroot

Since the bump of dtv-scan-tables to version
ceb11833b35f05813b1f0397a60e0f3b99430aab in commit
b1c8794d8ac0eb3895d13ae91d8e912ec469a105, one file contains non-ASCII
characters, which causes encoding issues tvheadend. Since no other
file in the dtv-scan-tables code base contains files with non-ASCII
characters (despite having files named after cities in various
countries that definitely do have non-ASCII characters), we rename
this file so that it is named with only ASCII characters.

This fixes the build of tvheadend, which was failing when the host
Python interpreter was python3, due to a file name encoding issue.

Fixes:

  http://autobuild.buildroot.net/results/1ae8bee297edb089535a2fb6ec724ebf7976888d/
  (tvheadend)

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Note: we will separately submit a patch to the upstream
dtv-scan-tables project to rename the problematic file.
---
 package/dtv-scan-tables/dtv-scan-tables.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/dtv-scan-tables/dtv-scan-tables.mk b/package/dtv-scan-tables/dtv-scan-tables.mk
index 8ef42b9..2be0eb5 100644
--- a/package/dtv-scan-tables/dtv-scan-tables.mk
+++ b/package/dtv-scan-tables/dtv-scan-tables.mk
@@ -17,11 +17,16 @@ DTV_SCAN_TABLES_SITE_METHOD = git
 DTV_SCAN_TABLES_LICENSE = GPLv2, LGPLv2.1
 DTV_SCAN_TABLES_LICENSE_FILES = COPYING COPYING.LGPL
 
+# In order to avoid issues with file name encodings, we rename the
+# only dtv-scan-tables file that has non-ASCII characters to have a
+# name using only ASCII characters (pl-Krosno_Sucha_Gora)
 define DTV_SCAN_TABLES_INSTALL_TARGET_CMDS
 	for f in atsc dvb-c dvb-s dvb-t; do \
 		$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/share/dvb/$$f; \
 		$(INSTALL) $(@D)/$$f/* $(TARGET_DIR)/usr/share/dvb/$$f; \
 	done
+	mv $(TARGET_DIR)/usr/share/dvb/dvb-t/pl-Krosno_Sucha* \
+		$(TARGET_DIR)/usr/share/dvb/dvb-t/pl-Krosno_Sucha_Gora
 endef
 
 $(eval $(generic-package))
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH kvm-unit-tests v2 14/17] x86: intel-iommu: add dmar test
From: Peter Xu @ 2016-11-14 20:54 UTC (permalink / raw)
  To: Andrew Jones; +Cc: kvm, rkrcmar, agordeev, jan.kiszka, pbonzini
In-Reply-To: <20161110195302.ga42nzxy5iauiqcl@hawk.localdomain>

On Thu, Nov 10, 2016 at 08:53:02PM +0100, Andrew Jones wrote:

[...]

> > +/* Supported Adjusted Guest Address Widths */
> > +#define VTD_CAP_SAGAW_SHIFT         8
> > + /* 39-bit AGAW, 3-level page-table */
> > +#define VTD_CAP_SAGAW_39bit         (0x2ULL << VTD_CAP_SAGAW_SHIFT)
> > + /* 48-bit AGAW, 4-level page-table */
> 
> The leading space in the above comments is a bit strange

Yes, they are. :)

[...]

> > +	/*
> > +	 * DMA the first 4 bytes of the page to EDU device buffer
> > +	 * offset 0.
> > +	 */
> > +	edu_dma(dev, 0, 4, 0, false);
> 
> missing blank line here

Will fix both. Thanks,

-- peterx

^ permalink raw reply

* [PATCH] ARM: sun8i: sina33: Enable USB gadget
From: Maxime Ripard @ 2016-11-14 20:53 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20161104144439.4469-1-maxime.ripard@free-electrons.com>

On Fri, Nov 04, 2016 at 03:44:39PM +0100, Maxime Ripard wrote:
> The micro-USB on the SinA33 has a somewhat interesting design in the sense
> that it has a micro USB connector, but the VBUS is (supposed to be)
> controlled through an (unpopulated) jumper.
> 
> Obviously, that doesn't work really well, and only the peripheral mode
> really works. Still enable it.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Applied.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161114/9b9d417b/attachment-0001.sig>

^ permalink raw reply

* [PATCH v3 1/2] pinctrl: sunxi: Add support for interrupt debouncing
From: Maxime Ripard @ 2016-11-14 20:53 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot
  Cc: linux-gpio, devicetree, Rob Herring, Chen-Yu Tsai, Maxime Ripard
In-Reply-To: <cover.fa554eb1146d18ec75bf44863543fec4fa4fd3ae.1479156725.git-series.maxime.ripard@free-electrons.com>

The pin controller found in the Allwinner SoCs has support for interrupts
debouncing.

However, this is not done per-pin, preventing us from using the generic
pinconf binding for that, but per irq bank, which, depending on the SoC,
ranges from one to five.

Introduce a device-wide property to deal with this using a microsecond
resolution. We can re-use the per-pin input-debounce property for that, so
let's do it!

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt | 14 ++++++++++++-
 drivers/pinctrl/sunxi/pinctrl-sunxi.c                                 | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 drivers/pinctrl/sunxi/pinctrl-sunxi.h                                 |  7 ++++++-
 3 files changed, 105 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
index 1685821eea41..56debe1db4e8 100644
--- a/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
@@ -28,6 +28,20 @@ Required properties:
 - reg: Should contain the register physical address and length for the
   pin controller.
 
+- clocks: phandle to the clocks feeding the pin controller:
+  - "apb": the gated APB parent clock
+  - "hosc": the high frequency oscillator in the system
+  - "losc": the low frequency oscillator in the system
+
+Note: For backward compatibility reasons, the hosc and losc clocks are only
+required if you need to use the optional input-debounce property. Any new
+device tree should set them.
+
+Optional properties:
+  - input-debounce: Array of debouncing periods in microseconds. One period per
+    irq bank found in the controller. 0 if no setup required.
+
+
 Please refer to pinctrl-bindings.txt in this directory for details of the
 common pinctrl bindings used by client devices.
 
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 0facbea5f465..b425be2875d4 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -870,6 +870,88 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev)
 	return 0;
 }
 
+static int sunxi_pinctrl_get_debounce_div(struct clk *clk, int freq, int *diff)
+{
+	unsigned long clock = clk_get_rate(clk);
+	unsigned int best_diff = ~0, best_div;
+	int i;
+
+	for (i = 0; i < 8; i++) {
+		int cur_diff = abs(freq - (clock >> i));
+
+		if (cur_diff < best_diff) {
+			best_diff = cur_diff;
+			best_div = i;
+		}
+	}
+
+	*diff = best_diff;
+	return best_div;
+}
+
+static int sunxi_pinctrl_setup_debounce(struct sunxi_pinctrl *pctl,
+					struct device_node *node)
+{
+	unsigned int hosc_diff, losc_diff;
+	unsigned int hosc_div, losc_div;
+	struct clk *hosc, *losc;
+	u8 div, src;
+	int i, ret;
+
+	/* Deal with old DTs that didn't have the oscillators */
+	if (of_count_phandle_with_args(node, "clocks", "#clock-cells") != 3)
+		return 0;
+
+	/* If we don't have any setup, bail out */
+	if (!of_find_property(node, "input-debounce", NULL))
+		return 0;
+
+	losc = devm_clk_get(pctl->dev, "losc");
+	if (IS_ERR(losc))
+		return PTR_ERR(losc);
+
+	hosc = devm_clk_get(pctl->dev, "hosc");
+	if (IS_ERR(hosc))
+		return PTR_ERR(hosc);
+
+	for (i = 0; i < pctl->desc->irq_banks; i++) {
+		unsigned long debounce_freq;
+		u32 debounce;
+
+		ret = of_property_read_u32_index(node, "input-debounce",
+						 i, &debounce);
+		if (ret)
+			return ret;
+
+		if (!debounce)
+			continue;
+
+		debounce_freq = DIV_ROUND_CLOSEST(USEC_PER_SEC, debounce);
+		losc_div = sunxi_pinctrl_get_debounce_div(losc,
+							  debounce_freq,
+							  &losc_diff);
+
+		hosc_div = sunxi_pinctrl_get_debounce_div(hosc,
+							  debounce_freq,
+							  &hosc_diff);
+
+		if (hosc_diff < losc_diff) {
+			div = hosc_div;
+			src = 1;
+		} else {
+			div = losc_div;
+			src = 0;
+		}
+
+		writel(src | div << 4,
+		       pctl->membase +
+		       sunxi_irq_debounce_reg_from_bank(i,
+							pctl->desc->irq_bank_base));
+	}
+
+	return 0;
+}
+
 int sunxi_pinctrl_init(struct platform_device *pdev,
 		       const struct sunxi_pinctrl_desc *desc)
 {
@@ -1032,6 +1114,8 @@ int sunxi_pinctrl_init(struct platform_device *pdev,
 						 pctl);
 	}
 
+	sunxi_pinctrl_setup_debounce(pctl, node);
+
 	dev_info(&pdev->dev, "initialized sunXi PIO driver\n");
 
 	return 0;
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
index 0afce1ab12d0..c0d97fe58e84 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
@@ -69,6 +69,8 @@
 #define IRQ_STATUS_IRQ_BITS		1
 #define IRQ_STATUS_IRQ_MASK		((1 << IRQ_STATUS_IRQ_BITS) - 1)
 
+#define IRQ_DEBOUNCE_REG	0x218
+
 #define IRQ_MEM_SIZE		0x20
 
 #define IRQ_EDGE_RISING		0x00
@@ -266,6 +268,11 @@ static inline u32 sunxi_irq_ctrl_offset(u16 irq)
 	return irq_num * IRQ_CTRL_IRQ_BITS;
 }
 
+static inline u32 sunxi_irq_debounce_reg_from_bank(u8 bank, unsigned bank_base)
+{
+	return IRQ_DEBOUNCE_REG + (bank_base + bank) * IRQ_MEM_SIZE;
+}
+
 static inline u32 sunxi_irq_status_reg_from_bank(u8 bank, unsigned bank_base)
 {
 	return IRQ_STATUS_REG + (bank_base + bank) * IRQ_MEM_SIZE;
-- 
git-series 0.8.11

^ permalink raw reply related

* [PATCH v3 2/2] ARM: sunxi: Add the missing clocks to the pinctrl nodes
From: Maxime Ripard @ 2016-11-14 20:53 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot
  Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Chen-Yu Tsai,
	Maxime Ripard
In-Reply-To: <cover.fa554eb1146d18ec75bf44863543fec4fa4fd3ae.1479156725.git-series.maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

The pin controllers also use the two oscillators for debouncing. Add them
to the DTs.

Signed-off-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Acked-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
 arch/arm/boot/dts/sun4i-a10.dtsi     | 3 ++-
 arch/arm/boot/dts/sun5i.dtsi         | 3 ++-
 arch/arm/boot/dts/sun6i-a31.dtsi     | 6 ++++--
 arch/arm/boot/dts/sun7i-a20.dtsi     | 3 ++-
 arch/arm/boot/dts/sun8i-a23-a33.dtsi | 6 ++++--
 arch/arm/boot/dts/sun8i-h3.dtsi      | 6 ++++--
 arch/arm/boot/dts/sun9i-a80.dtsi     | 6 ++++--
 7 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 7e7dfc2b43db..b14a4281058d 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -967,7 +967,8 @@
 			compatible = "allwinner,sun4i-a10-pinctrl";
 			reg = <0x01c20800 0x400>;
 			interrupts = <28>;
-			clocks = <&apb0_gates 5>;
+			clocks = <&apb0_gates 5>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			interrupt-controller;
 			#interrupt-cells = <3>;
diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
index b4ccee8cfb02..b0fca4ef4dae 100644
--- a/arch/arm/boot/dts/sun5i.dtsi
+++ b/arch/arm/boot/dts/sun5i.dtsi
@@ -547,7 +547,8 @@
 		pio: pinctrl@01c20800 {
 			reg = <0x01c20800 0x400>;
 			interrupts = <28>;
-			clocks = <&apb0_gates 5>;
+			clocks = <&apb0_gates 5>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			interrupt-controller;
 			#interrupt-cells = <3>;
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index 2e8bf93dcfb2..c941662383ee 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -471,7 +471,8 @@
 				     <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu CLK_APB1_PIO>;
+			clocks = <&ccu CLK_APB1_PIO>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			interrupt-controller;
 			#interrupt-cells = <3>;
@@ -1051,7 +1052,8 @@
 			reg = <0x01f02c00 0x400>;
 			interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&apb0_gates 0>;
+			clocks = <&apb0_gates 0>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			resets = <&apb0_rst 0>;
 			gpio-controller;
 			interrupt-controller;
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 94cf5a1c7172..f7db067b0de0 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -1085,7 +1085,8 @@
 			compatible = "allwinner,sun7i-a20-pinctrl";
 			reg = <0x01c20800 0x400>;
 			interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&apb0_gates 5>;
+			clocks = <&apb0_gates 5>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			interrupt-controller;
 			#interrupt-cells = <3>;
diff --git a/arch/arm/boot/dts/sun8i-a23-a33.dtsi b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
index 300a1bd5a6ec..e4991a78ad73 100644
--- a/arch/arm/boot/dts/sun8i-a23-a33.dtsi
+++ b/arch/arm/boot/dts/sun8i-a23-a33.dtsi
@@ -266,7 +266,8 @@
 			/* compatible gets set in SoC specific dtsi file */
 			reg = <0x01c20800 0x400>;
 			/* interrupts get set in SoC specific dtsi file */
-			clocks = <&ccu CLK_BUS_PIO>;
+			clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			interrupt-controller;
 			#interrupt-cells = <3>;
@@ -575,7 +576,8 @@
 			compatible = "allwinner,sun8i-a23-r-pinctrl";
 			reg = <0x01f02c00 0x400>;
 			interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&apb0_gates 0>;
+			clocks = <&apb0_gates 0>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			resets = <&apb0_rst 0>;
 			gpio-controller;
 			interrupt-controller;
diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index c38b028cac83..3c6596f06ebc 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -321,7 +321,8 @@
 			reg = <0x01c20800 0x400>;
 			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu CLK_BUS_PIO>;
+			clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			#gpio-cells = <3>;
 			interrupt-controller;
@@ -614,7 +615,8 @@
 			compatible = "allwinner,sun8i-h3-r-pinctrl";
 			reg = <0x01f02c00 0x400>;
 			interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&apb0_gates 0>;
+			clocks = <&apb0_gates 0>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			resets = <&apb0_reset 0>;
 			gpio-controller;
 			#gpio-cells = <3>;
diff --git a/arch/arm/boot/dts/sun9i-a80.dtsi b/arch/arm/boot/dts/sun9i-a80.dtsi
index ab6a221027ef..979ad1aacfb1 100644
--- a/arch/arm/boot/dts/sun9i-a80.dtsi
+++ b/arch/arm/boot/dts/sun9i-a80.dtsi
@@ -678,7 +678,8 @@
 				     <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&apb0_gates 5>;
+			clocks = <&apb0_gates 5>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			interrupt-controller;
 			#interrupt-cells = <3>;
@@ -902,7 +903,8 @@
 			reg = <0x08002c00 0x400>;
 			interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&apbs_gates 0>;
+			clocks = <&apbs_gates 0>, <&osc24M>, <&osc32k>;
+			clock-names = "apb", "hosc", "losc";
 			resets = <&apbs_rst 0>;
 			gpio-controller;
 			interrupt-controller;
-- 
git-series 0.8.11
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH v3 0/2] pinctrl: sunxi: Support the interrupt debouncing
From: Maxime Ripard @ 2016-11-14 20:53 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot
  Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Chen-Yu Tsai,
	Maxime Ripard

Hi,

The Allwinner pin controllers can setup a different debouncing period based
on two clocks and a prescaler.

This debouncing is applied to the whole IRQ bank, which prevents us from
using the per-pin property that is usually used.

Let me know what you think,
Maxime

Changes from v2:
  - Deal with a debounce set to 0
  - Change debounce divider function name
  - Used DIV_ROUND_CLOSEST instead of manual division
  - Convert the R_PIO too
  - Added the Acked-by

Changes from v1:
  - Changed the resolution of the debouncing property to microseconds, and
    switched to the input-debounce instead of a custom one.

Maxime Ripard (2):
  pinctrl: sunxi: Add support for interrupt debouncing
  ARM: sunxi: Add the missing clocks to the pinctrl nodes

 Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt | 14 ++++++++++++-
 arch/arm/boot/dts/sun4i-a10.dtsi                                      |  3 ++-
 arch/arm/boot/dts/sun5i.dtsi                                          |  3 ++-
 arch/arm/boot/dts/sun6i-a31.dtsi                                      |  6 +++--
 arch/arm/boot/dts/sun7i-a20.dtsi                                      |  3 ++-
 arch/arm/boot/dts/sun8i-a23-a33.dtsi                                  |  6 +++--
 arch/arm/boot/dts/sun8i-h3.dtsi                                       |  6 +++--
 arch/arm/boot/dts/sun9i-a80.dtsi                                      |  6 +++--
 drivers/pinctrl/sunxi/pinctrl-sunxi.c                                 | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 drivers/pinctrl/sunxi/pinctrl-sunxi.h                                 |  7 ++++++-
 10 files changed, 127 insertions(+), 11 deletions(-)

base-commit: bc5952be2d424b75ed11ff599b70bc9604e98d42
-- 
git-series 0.8.11
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [Qemu-devel] QEMU postcopy-test failing on ppc64
From: Stefan Hajnoczi @ 2016-11-14 20:52 UTC (permalink / raw)
  To: Dave Gilbert; +Cc: qemu-devel, Andrea Arcangeli

I hit a failure running "make check" on ppc64 for the first time.  Ideas?

Stefan

commit 682df581c65ed2c1b9e77093e332214ecaa1ee93

  GTESTER check-qtest-ppc64
Memory content inconsistency at 5af4000 first_byte = 1b last_byte = 1a
current = 7c hit_edge = 1
Memory content inconsistency at 5af5000 first_byte = 1b last_byte = 7c
current = 1b hit_edge = 1
Memory content inconsistency at 5e59000 first_byte = 1b last_byte = 1b
current = 1a hit_edge = 1
**
ERROR:tests/postcopy-test.c:345:check_guests_ram: 'bad' should be FALSE
GTester: last random seed: R02S9d79166a1ca7e21940a0f4b0b1255d5b

^ permalink raw reply

* Re: [PATCH 1/5] pinctrl: core: Use delayed work for hogs
From: Tony Lindgren @ 2016-11-14 20:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Haojian Zhuang, Masahiro Yamada, Grygorii Strashko,
	Nishanth Menon, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linux-OMAP
In-Reply-To: <20161111202650.GI7138@atomide.com>

* Tony Lindgren <tony@atomide.com> [161111 12:27]:
> * Linus Walleij <linus.walleij@linaro.org> [161111 12:17]:
> > On Tue, Oct 25, 2016 at 11:02 PM, Tony Lindgren <tony@atomide.com> wrote:
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > 
> > I don't see why this is necessary?
> 
> It's needed because the pin controller driver has not yet
> finished it's probe at this point. We end up calling functions
> in the device driver where no struct pinctrl_dev is yet known
> to the driver. Asking a device driver to do something before
> it's probe is done does not quite follow the Linux driver model :)
> 
> > The hogging was placed inside pinctrl_register() so that any hogs
> > would be taken before it returns, so nothing else can take it
> > before the controller itself has the first chance. This semantic
> > needs to be preserved I think.
> > 
> > > +       schedule_delayed_work(&pctldev->hog_work,
> > > +                                     msecs_to_jiffies(100));
> > 
> > If we arbitrarily delay, something else can go in and take the
> > pins used by the hogs before the pinctrl core? That is what
> > we want to avoid.
> > 
> > Hm, 100ms seems arbitrarily chosen BTW. Can it be 1 ms?
> > 1 ns?
> 
> Yeah well seems like it should not matter but the race we need
> to remove somehow.
> 
> > I'm pretty sure that whatever it is that needs to happen before
> > the hog work runs can race with this delayed work under
> > some circumstances (such as slow external expanders
> > on i2c). It should be impossible for that to happen
> > and I don't think it is?
> 
> Yes it's totally possible even with delay set to 0.
> 
> Maybe we could add some trigger on the first consumer request
> and if that does not happen use the timer?

Below is what I came up with for removing the race for hogs. We
can do it by not registering the pctldev until in the deferred
work, does that seem OK to you?

Regards,

Tony

8<-----------------------
>From tony Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Tue, 25 Oct 2016 08:33:35 -0700
Subject: [PATCH] pinctrl: core: Use delayed work for hogs

Having the pin control framework call pin controller functions
before it's probe has finished is not nice as the pin controller
device driver does not yet have struct pinctrl_dev handle.

Let's fix this issue by adding deferred work for late init. This is
needed to be able to add pinctrl generic helper functions that expect
to know struct pinctrl_dev handle. Note that we now need to call
create_pinctrl() directly as we don't want to add the pin controller
to the list of controllers until the hogs are claimed.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/pinctrl/core.c | 66 ++++++++++++++++++++++++++++++--------------------
 drivers/pinctrl/core.h |  2 ++
 2 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1911,6 +1911,43 @@ static int pinctrl_check_ops(struct pinctrl_dev *pctldev)
 }
 
 /**
+ * pinctrl_late_init() - finish pin controller device registration
+ * @work: work struct
+ */
+static void pinctrl_late_init(struct work_struct *work)
+{
+	struct pinctrl_dev *pctldev;
+
+	pctldev = container_of(work, struct pinctrl_dev, late_init.work);
+
+	pctldev->p = create_pinctrl(pctldev->dev);
+	if (IS_ERR(pctldev->p))
+		return;
+
+	kref_get(&pctldev->p->users);
+
+	pctldev->hog_default =
+		pinctrl_lookup_state(pctldev->p, PINCTRL_STATE_DEFAULT);
+	if (IS_ERR(pctldev->hog_default)) {
+		dev_dbg(pctldev->dev, "failed to lookup the default state\n");
+	} else {
+		if (pinctrl_select_state(pctldev->p, pctldev->hog_default))
+			dev_err(pctldev->dev, "failed to select default state\n");
+	}
+
+	pctldev->hog_sleep = pinctrl_lookup_state(pctldev->p,
+						  PINCTRL_STATE_SLEEP);
+	if (IS_ERR(pctldev->hog_sleep))
+		dev_dbg(pctldev->dev, "failed to lookup the sleep state\n");
+
+	mutex_lock(&pinctrldev_list_mutex);
+	list_add_tail(&pctldev->node, &pinctrldev_list);
+	mutex_unlock(&pinctrldev_list_mutex);
+
+	pinctrl_init_device_debugfs(pctldev);
+}
+
+/**
  * pinctrl_register() - register a pin controller device
  * @pctldesc: descriptor for this pin controller
  * @dev: parent device for this pin controller
@@ -1941,6 +1978,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
 	INIT_RADIX_TREE(&pctldev->pin_group_tree, GFP_KERNEL);
 	INIT_RADIX_TREE(&pctldev->pin_function_tree, GFP_KERNEL);
 	INIT_LIST_HEAD(&pctldev->gpio_ranges);
+	INIT_DELAYED_WORK(&pctldev->late_init, pinctrl_late_init);
 	pctldev->dev = dev;
 	mutex_init(&pctldev->mutex);
 
@@ -1975,32 +2013,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
 		goto out_err;
 	}
 
-	mutex_lock(&pinctrldev_list_mutex);
-	list_add_tail(&pctldev->node, &pinctrldev_list);
-	mutex_unlock(&pinctrldev_list_mutex);
-
-	pctldev->p = pinctrl_get(pctldev->dev);
-
-	if (!IS_ERR(pctldev->p)) {
-		pctldev->hog_default =
-			pinctrl_lookup_state(pctldev->p, PINCTRL_STATE_DEFAULT);
-		if (IS_ERR(pctldev->hog_default)) {
-			dev_dbg(dev, "failed to lookup the default state\n");
-		} else {
-			if (pinctrl_select_state(pctldev->p,
-						pctldev->hog_default))
-				dev_err(dev,
-					"failed to select default state\n");
-		}
-
-		pctldev->hog_sleep =
-			pinctrl_lookup_state(pctldev->p,
-						    PINCTRL_STATE_SLEEP);
-		if (IS_ERR(pctldev->hog_sleep))
-			dev_dbg(dev, "failed to lookup the sleep state\n");
-	}
-
-	pinctrl_init_device_debugfs(pctldev);
+	schedule_delayed_work(&pctldev->late_init, 0);
 
 	return pctldev;
 
@@ -2023,6 +2036,7 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev)
 	if (pctldev == NULL)
 		return;
 
+	cancel_delayed_work_sync(&pctldev->late_init);
 	mutex_lock(&pctldev->mutex);
 	pinctrl_remove_device_debugfs(pctldev);
 	mutex_unlock(&pctldev->mutex);
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -37,6 +37,7 @@ struct pinctrl_gpio_range;
  * @p: result of pinctrl_get() for this device
  * @hog_default: default state for pins hogged by this device
  * @hog_sleep: sleep state for pins hogged by this device
+ * @late_init: delayed work for pin controller to finish registration
  * @mutex: mutex taken on each pin controller specific action
  * @device_root: debugfs root for this device
  */
@@ -55,6 +56,7 @@ struct pinctrl_dev {
 	struct pinctrl *p;
 	struct pinctrl_state *hog_default;
 	struct pinctrl_state *hog_sleep;
+	struct delayed_work late_init;
 	struct mutex mutex;
 #ifdef CONFIG_DEBUG_FS
 	struct dentry *device_root;
-- 
2.10.2

^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.