]> Git Repo - linux.git/log
linux.git
6 years agomm/swapfile.c: unify normal/huge code path in put_swap_page()
Huang Ying [Wed, 22 Aug 2018 04:52:17 +0000 (21:52 -0700)]
mm/swapfile.c: unify normal/huge code path in put_swap_page()

In this patch, the normal/huge code path in put_swap_page() and several
helper functions are unified to avoid duplicated code, bugs, etc.  and
make it easier to review the code.

The removed lines are more than added lines.  And the binary size is
kept exactly same when CONFIG_TRANSPARENT_HUGEPAGE=n.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: "Huang, Ying" <[email protected]>
Suggested-by: Dave Hansen <[email protected]>
Acked-by: Dave Hansen <[email protected]>
Reviewed-by: Daniel Jordan <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Shaohua Li <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
6 years agomm/swapfile.c: unify normal/huge code path in swap_page_trans_huge_swapped()
Huang Ying [Wed, 22 Aug 2018 04:52:13 +0000 (21:52 -0700)]
mm/swapfile.c: unify normal/huge code path in swap_page_trans_huge_swapped()

As suggested by Dave, we should unify the code path for normal and huge
swap support if possible to avoid duplicated code, bugs, etc.  and make
it easier to review code.

In this patch, the normal/huge code path in
swap_page_trans_huge_swapped() is unified, the added and removed lines
are same.  And the binary size is kept almost same when
CONFIG_TRANSPARENT_HUGEPAGE=n.

 text    data     bss     dec     hex filename
base: 24179    2028     340   26547    67b3 mm/swapfile.o
unified: 24215    2028     340   26583    67d7 mm/swapfile.o

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: "Huang, Ying" <[email protected]>
Suggested-and-acked-by: Dave Hansen <[email protected]>
Reviewed-by: Daniel Jordan <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Shaohua Li <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
6 years agomm/swapfile.c: use swap_count() in swap_page_trans_huge_swapped()
Huang Ying [Wed, 22 Aug 2018 04:52:09 +0000 (21:52 -0700)]
mm/swapfile.c: use swap_count() in swap_page_trans_huge_swapped()

In swap_page_trans_huge_swapped(), to identify whether there's any page
table mapping for a 4k sized swap entry, "si->swap_map[i] !=
SWAP_HAS_CACHE" is used.  This works correctly now, because all users of
the function will only call it after checking SWAP_HAS_CACHE.  But as
pointed out by Daniel, it is better to use "swap_count(map[i])" here,
because it works for "map[i] == 0" case too.

And this makes the implementation more consistent between normal and
huge swap entry.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: "Huang, Ying" <[email protected]>
Suggested-and-reviewed-by: Daniel Jordan <[email protected]>
Acked-by: Dave Hansen <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Shaohua Li <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
6 years agomm/swapfile.c: replace some #ifdef with IS_ENABLED()
Huang Ying [Wed, 22 Aug 2018 04:52:05 +0000 (21:52 -0700)]
mm/swapfile.c: replace some #ifdef with IS_ENABLED()

In mm/swapfile.c, THP (Transparent Huge Page) swap specific code is
enclosed by #ifdef CONFIG_THP_SWAP/#endif to avoid code dilating when
THP isn't enabled.  But #ifdef/#endif in .c file hurt the code
readability, so Dave suggested to use IS_ENABLED(CONFIG_THP_SWAP)
instead and let compiler to do the dirty job for us.  This has potential
to remove some duplicated code too.  From output of `size`,

text    data     bss     dec     hex filename
THP=y:         26269    2076     340   28685    700d mm/swapfile.o
ifdef/endif:   24115    2028     340   26483    6773 mm/swapfile.o
IS_ENABLED:    24179    2028     340   26547    67b3 mm/swapfile.o

IS_ENABLED() based solution works quite well, almost as good as that of
#ifdef/#endif.  And from the diffstat, the removed lines are more than
added lines.

One #ifdef for split_swap_cluster() is kept.  Because it is a public
function with a stub implementation for CONFIG_THP_SWAP=n in swap.h.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: "Huang, Ying" <[email protected]>
Suggested-and-acked-by: Dave Hansen <[email protected]>
Reviewed-by: Daniel Jordan <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Shaohua Li <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
6 years agomm: swap: add comments to lock_cluster_or_swap_info()
Huang Ying [Wed, 22 Aug 2018 04:52:01 +0000 (21:52 -0700)]
mm: swap: add comments to lock_cluster_or_swap_info()

Patch series "swap: THP optimizing refactoring", v4.

Now the THP (Transparent Huge Page) swap optimizing is implemented in the
way like below,

  #ifdef CONFIG_THP_SWAP
  huge_function(...)
  {
  }
  #else
  normal_function(...)
  {
  }
  #endif

  general_function(...)
  {
   if (huge)
   return thp_function(...);
else
   return normal_function(...);
  }

As pointed out by Dave Hansen, this will,

1. Create a new, wholly untested code path for huge page
2. Create two places to patch bugs
3. Are not reusing code when possible

This patchset is to address these problems via merging huge/normal code
path/functions if possible.

One concern is that this may cause code size to dilate when
!CONFIG_TRANSPARENT_HUGEPAGE.  The data shows that most refactoring will
only cause quite slight code size increase.

This patch (of 8):

To improve code readability.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: "Huang, Ying" <[email protected]>
Suggested-and-acked-by: Dave Hansen <[email protected]>
Reviewed-by: Daniel Jordan <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Shaohua Li <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
6 years agomm: struct shrinker: make flags of unsigned type
Kirill Tkhai [Wed, 22 Aug 2018 04:51:57 +0000 (21:51 -0700)]
mm: struct shrinker: make flags of unsigned type

Currently, there are two flags only, so unsigned is more then enough.
Also, move int seeks to keep these fields together.

Link: http://lkml.kernel.org/r/153199748720.21131.6476256940113102483.stgit@localhost.localdomain
Signed-off-by: Kirill Tkhai <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Cc: Tetsuo Handa <[email protected]>
Cc: Chris Wilson <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
6 years agomm: struct shrink_control: keep int fields together
Kirill Tkhai [Wed, 22 Aug 2018 04:51:53 +0000 (21:51 -0700)]
mm: struct shrink_control: keep int fields together

Patch series "Reorderings in struct shrinker and struct shrink_control".

These structures are intensively used during reclaim and, displace other
data in cache, so there is no a reason they have int fields not grouped
together.

This patch (of 2):

gfp_t is of unsigned type, so let's move nid to keep them together.

Link: http://lkml.kernel.org/r/153199747930.21131.861043607301997810.stgit@localhost.localdomain
Signed-off-by: Kirill Tkhai <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Cc: Tetsuo Handa <[email protected]>
Cc: Chris Wilson <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
6 years agomm: check shrinker is memcg-aware in register_shrinker_prepared()
Kirill Tkhai [Wed, 22 Aug 2018 04:51:49 +0000 (21:51 -0700)]
mm: check shrinker is memcg-aware in register_shrinker_prepared()

There is a sad BUG introduced in patch adding SHRINKER_REGISTERING.
shrinker_idr business is only for memcg-aware shrinkers.  Only such type
of shrinkers have id and they must be finaly installed via idr_replace()
in this function.  For !memcg-aware shrinkers we never initialize
shrinker->id field.

But there are all types of shrinkers passed to idr_replace(), and every
!memcg-aware shrinker with random ID (most probably, its id is 0)
replaces memcg-aware shrinker pointed by the ID in IDR.

This patch fixes the problem.

Link: http://lkml.kernel.org/r/[email protected]
Fixes: 7e010df53c80 "mm: use special value SHRINKER_REGISTERING instead of list_empty() check"
Signed-off-by: Kirill Tkhai <[email protected]>
Reported-by: <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Josef Bacik <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Tetsuo Handa <[email protected]>
Cc: Shakeel Butt <[email protected]>
Cc: <[email protected]>
Cc: Huang Ying <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
6 years agoautofs: fix autofs_sbi() does not check super block type
Ian Kent [Wed, 22 Aug 2018 04:51:45 +0000 (21:51 -0700)]
autofs: fix autofs_sbi() does not check super block type

autofs_sbi() does not check the superblock magic number to verify it has
been given an autofs super block.

Link: http://lkml.kernel.org/r/[email protected]
Reported-by: <[email protected]>
Signed-off-by: Ian Kent <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
6 years agoworkqueue: re-add lockdep dependencies for flushing
Johannes Berg [Wed, 22 Aug 2018 09:49:04 +0000 (11:49 +0200)]
workqueue: re-add lockdep dependencies for flushing

In flush_work(), we need to create a lockdep dependency so that
the following scenario is appropriately tagged as a problem:

  work_function()
  {
    mutex_lock(&mutex);
    ...
  }

  other_function()
  {
    mutex_lock(&mutex);
    flush_work(&work); // or cancel_work_sync(&work);
  }

This is a problem since the work might be running and be blocked
on trying to acquire the mutex.

Similarly, in flush_workqueue().

These were removed after cross-release partially caught these
problems, but now cross-release was reverted anyway. IMHO the
removal was erroneous anyway though, since lockdep should be
able to catch potential problems, not just actual ones, and
cross-release would only have caught the problem when actually
invoking wait_for_completion().

Fixes: fd1a5b04dfb8 ("workqueue: Remove now redundant lock acquisitions wrt. workqueue flushes")
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
6 years agoworkqueue: skip lockdep wq dependency in cancel_work_sync()
Johannes Berg [Wed, 22 Aug 2018 09:49:03 +0000 (11:49 +0200)]
workqueue: skip lockdep wq dependency in cancel_work_sync()

In cancel_work_sync(), we can only have one of two cases, even
with an ordered workqueue:
 * the work isn't running, just cancelled before it started
 * the work is running, but then nothing else can be on the
   workqueue before it

Thus, we need to skip the lockdep workqueue dependency handling,
otherwise we get false positive reports from lockdep saying that
we have a potential deadlock when the workqueue also has other
work items with locking, e.g.

  work1_function() { mutex_lock(&mutex); ... }
  work2_function() { /* nothing */ }

  other_function() {
    queue_work(ordered_wq, &work1);
    queue_work(ordered_wq, &work2);
    mutex_lock(&mutex);
    cancel_work_sync(&work2);
  }

As described above, this isn't a problem, but lockdep will
currently flag it as if cancel_work_sync() was flush_work(),
which *is* a problem.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
6 years agoata: ahci_platform: enable to get and control reset
Kunihiko Hayashi [Wed, 22 Aug 2018 12:13:03 +0000 (21:13 +0900)]
ata: ahci_platform: enable to get and control reset

Unlike SoC-specific driver, generic ahci_platform driver doesn't
have any chances to control resets.

This adds AHCI_PLATFORM_GET_RESETS to ahci_platform_get_resources()
on the generic driver to enable reset control support.

Suggested-by: Hans de Goede <[email protected]>
Cc: Thierry Reding <[email protected]>
Signed-off-by: Kunihiko Hayashi <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
6 years agoata: libahci_platform: add reset control support
Kunihiko Hayashi [Wed, 22 Aug 2018 12:13:02 +0000 (21:13 +0900)]
ata: libahci_platform: add reset control support

Add support to get and control a list of resets for the device
as optional and shared. These resets must be kept de-asserted until
the device is enabled.

This is specified as shared because some SoCs like UniPhier series
have common reset controls with all ahci controller instances.

However, according to Thierry's view,
https://www.spinics.net/lists/linux-ide/msg55357.html
some hardware-specific drivers already use their own resets,
and the common reset make a path to occur double controls of resets.

The ahci_platform_get_resources() can get and control the reset
only when the second argument includes AHCI_PLATFORM_GET_RESETS bit.

Suggested-by: Hans de Goede <[email protected]>
Cc: Thierry Reding <[email protected]>
Signed-off-by: Kunihiko Hayashi <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
6 years agoata: add an extra argument to ahci_platform_get_resources()
Kunihiko Hayashi [Wed, 22 Aug 2018 12:13:01 +0000 (21:13 +0900)]
ata: add an extra argument to ahci_platform_get_resources()

Add an extra argument to ahci_platform_get_resources(), that is
for the bitmap representing the resource to get in this function.

Currently there is no resources to be defined, so all the callers set
'0' to the argument.

Suggested-by: Hans de Goede <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Maxime Ripard <[email protected]>
Signed-off-by: Kunihiko Hayashi <[email protected]>
Reviewed-by: Hans de Goede <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
6 years agoKVM: VMX: fixes for vmentry_l1d_flush module parameter
Paolo Bonzini [Wed, 22 Aug 2018 14:43:39 +0000 (16:43 +0200)]
KVM: VMX: fixes for vmentry_l1d_flush module parameter

Two bug fixes:

1) missing entries in the l1d_param array; this can cause a host crash
if an access attempts to reach the missing entry. Future-proof the get
function against any overflows as well.  However, the two entries
VMENTER_L1D_FLUSH_EPT_DISABLED and VMENTER_L1D_FLUSH_NOT_REQUIRED must
not be accepted by the parse function, so disable them there.

2) invalid values must be rejected even if the CPU does not have the
bug, so test for them before checking boot_cpu_has(X86_BUG_L1TF)

... and a small refactoring, since the .cmd field is redundant with
the index in the array.

Reported-by: Bandan Das <[email protected]>
Cc: [email protected]
Fixes: a7b9020b06ec6d7c3f3b0d4ef1a9eba12654f4f7
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agokvm: selftest: add dirty logging test
Peter Xu [Wed, 22 Aug 2018 07:20:00 +0000 (15:20 +0800)]
kvm: selftest: add dirty logging test

Test KVM dirty logging functionality.

The test creates a standalone memory slot to test tracking the dirty
pages since we can't really write to the default memory slot which still
contains the guest ELF image.

We have two threads running during the test:

(1) the vcpu thread continuously dirties random guest pages by writting
    a iteration number to the first 8 bytes of the page

(2) the host thread continuously fetches dirty logs for the testing
    memory region and verify each single bit of the dirty bitmap by
    checking against the values written onto the page

Note that since the guest cannot calls the general userspace APIs like
random(), it depends on the host to provide random numbers for the
page indexes to dirty.

Signed-off-by: Peter Xu <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agokvm: selftest: pass in extra memory when create vm
Peter Xu [Wed, 22 Aug 2018 07:19:59 +0000 (15:19 +0800)]
kvm: selftest: pass in extra memory when create vm

This information can be used to decide the size of the default memory
slot, which will need to cover the extra pages with page tables.

Signed-off-by: Peter Xu <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agokvm: selftest: include the tools headers
Peter Xu [Wed, 22 Aug 2018 07:19:58 +0000 (15:19 +0800)]
kvm: selftest: include the tools headers

Let the kvm selftest include the tools headers, then we can start to use
things there like bitmap operations.

Signed-off-by: Peter Xu <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agokvm: selftest: unify the guest port macros
Peter Xu [Wed, 22 Aug 2018 07:19:57 +0000 (15:19 +0800)]
kvm: selftest: unify the guest port macros

Most of the tests are using the same way to do guest to host sync but
the code is mostly duplicated.  Generalize the guest port macros into
the common header file and use it in different tests.

Meanwhile provide "struct guest_args" and a helper "guest_args_read()"
to hide the register details when playing with these port operations on
RDI and RSI.

Signed-off-by: Peter Xu <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agotools: introduce test_and_clear_bit
Peter Xu [Wed, 22 Aug 2018 07:19:56 +0000 (15:19 +0800)]
tools: introduce test_and_clear_bit

We have test_and_set_bit but not test_and_clear_bit.  Add it.

Signed-off-by: Peter Xu <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoKVM: x86: SVM: Call x86_spec_ctrl_set_guest/host() with interrupts disabled
Thomas Gleixner [Sun, 12 Aug 2018 18:41:45 +0000 (20:41 +0200)]
KVM: x86: SVM: Call x86_spec_ctrl_set_guest/host() with interrupts disabled

Mikhail reported the following lockdep splat:

WARNING: possible irq lock inversion dependency detected
CPU 0/KVM/10284 just changed the state of lock:
  000000000d538a88 (&st->lock){+...}, at:
  speculative_store_bypass_update+0x10b/0x170

but this lock was taken by another, HARDIRQ-safe lock
in the past:

(&(&sighand->siglock)->rlock){-.-.}

   and interrupts could create inverse lock ordering between them.

Possible interrupt unsafe locking scenario:

    CPU0                    CPU1
    ----                    ----
   lock(&st->lock);
                           local_irq_disable();
                           lock(&(&sighand->siglock)->rlock);
                           lock(&st->lock);
    <Interrupt>
     lock(&(&sighand->siglock)->rlock);
     *** DEADLOCK ***

The code path which connects those locks is:

   speculative_store_bypass_update()
   ssb_prctl_set()
   do_seccomp()
   do_syscall_64()

In svm_vcpu_run() speculative_store_bypass_update() is called with
interupts enabled via x86_virt_spec_ctrl_set_guest/host().

This is actually a false positive, because GIF=0 so interrupts are
disabled even if IF=1; however, we can easily move the invocations of
x86_virt_spec_ctrl_set_guest/host() into the interrupt disabled region to
cure it, and it's a good idea to keep the GIF=0/IF=1 area as small
and self-contained as possible.

Fixes: 1f50ddb4f418 ("x86/speculation: Handle HT correctly on AMD")
Reported-by: Mikhail Gavrilov <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Tested-by: Mikhail Gavrilov <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Radim Krčmář <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Tom Lendacky <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoKVM: vmx: Inject #UD for SGX ENCLS instruction in guest
Sean Christopherson [Tue, 14 Aug 2018 16:33:34 +0000 (09:33 -0700)]
KVM: vmx: Inject #UD for SGX ENCLS instruction in guest

Virtualization of Intel SGX depends on Enclave Page Cache (EPC)
management that is not yet available in the kernel, i.e. KVM support
for exposing SGX to a guest cannot be added until basic support
for SGX is upstreamed, which is a WIP[1].

Until SGX is properly supported in KVM, ensure a guest sees expected
behavior for ENCLS, i.e. all ENCLS #UD.  Because SGX does not have a
true software enable bit, e.g. there is no CR4.SGXE bit, the ENCLS
instruction can be executed[1] by the guest if SGX is supported by the
system.  Intercept all ENCLS leafs (via the ENCLS- exiting control and
field) and unconditionally inject #UD.

[1] https://www.spinics.net/lists/kvm/msg171333.html or
    https://lkml.org/lkml/2018/7/3/879

[2] A guest can execute ENCLS in the sense that ENCLS will not take
    an immediate #UD, but no ENCLS will ever succeed in a guest
    without explicit support from KVM (map EPC memory into the guest),
    unless KVM has a *very* egregious bug, e.g. accidentally mapped
    EPC memory into the guest SPTEs.  In other words this patch is
    needed only to prevent the guest from seeing inconsistent behavior,
    e.g. #GP (SGX not enabled in Feature Control MSR) or #PF (leaf
    operand(s) does not point at EPC memory) instead of #UD on ENCLS.
    Intercepting ENCLS is not required to prevent the guest from truly
    utilizing SGX.

Signed-off-by: Sean Christopherson <[email protected]>
Message-Id: <20180814163334[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoKVM: vmx: Add defines for SGX ENCLS exiting
Sean Christopherson [Tue, 14 Aug 2018 16:33:33 +0000 (09:33 -0700)]
KVM: vmx: Add defines for SGX ENCLS exiting

Hardware support for basic SGX virtualization adds a new execution
control (ENCLS_EXITING), VMCS field (ENCLS_EXITING_BITMAP) and exit
reason (ENCLS), that enables a VMM to intercept specific ENCLS leaf
functions, e.g. to inject faults when the VMM isn't exposing SGX to
a VM.  When ENCLS_EXITING is enabled, the VMM can set/clear bits in
the bitmap to intercept/allow ENCLS leaf functions in non-root, e.g.
setting bit 2 in the ENCLS_EXITING_BITMAP will cause ENCLS[EINIT]
to VMExit(ENCLS).

Note: EXIT_REASON_ENCLS was previously added by commit 1f5199927034
("KVM: VMX: add missing exit reasons").

Signed-off-by: Sean Christopherson <[email protected]>
Message-Id: <20180814163334[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agox86/kvm/vmx: Fix coding style in vmx_setup_l1d_flush()
Yi Wang [Thu, 16 Aug 2018 05:42:39 +0000 (13:42 +0800)]
x86/kvm/vmx: Fix coding style in vmx_setup_l1d_flush()

Substitute spaces with tab. No functional changes.

Signed-off-by: Yi Wang <[email protected]>
Reviewed-by: Jiang Biao <[email protected]>
Message-Id: <1534398159[email protected]>
Cc: [email protected] # L1TF
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agox86: kvm: avoid unused variable warning
Arnd Bergmann [Mon, 20 Aug 2018 21:37:50 +0000 (23:37 +0200)]
x86: kvm: avoid unused variable warning

Removing one of the two accesses of the maxphyaddr variable led to
a harmless warning:

arch/x86/kvm/x86.c: In function 'kvm_set_mmio_spte_mask':
arch/x86/kvm/x86.c:6563:6: error: unused variable 'maxphyaddr' [-Werror=unused-variable]

Removing the #ifdef seems to be the nicest workaround, as it
makes the code look cleaner than adding another #ifdef.

Fixes: 28a1f3ac1d0c ("kvm: x86: Set highest physical address bits in non-present/reserved SPTEs")
Signed-off-by: Arnd Bergmann <[email protected]>
Cc: [email protected] # L1TF
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoMerge tag 'acpi-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
Linus Torvalds [Wed, 22 Aug 2018 14:44:50 +0000 (07:44 -0700)]
Merge tag 'acpi-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more ACPI updates from Rafael Wysocki:
 "These update the ACPICA code in the kernel to the most recent upstream
  revision (which includes a regression fix and other improvements),
  make ACPICA clear the status of all ACPI events when entering sleep
  states (to restore the previous behavior) and update the ACPI
  operation region driver for the CrystalCove PMIC.

  Specifics:

   - Update the ACPICA code in the kernel to upstream revision 20180810
     including:
      * Fix for AML parser regression causing it to mishandle opcodes
        that open a scope upon parse failures (Erik Schmauss)
      * Fix for a reference counting issue on large systems (Erik
        Schmauss)
      * Fix to discard values coming from register reads that have
        failed (Erik Schmauss)
      * Two acpiexec fixes (Bob Moore, Erik Schmauss)
      * Debugger cleanup (Bob Moore)
      * Cleanup of duplicate table error message (Bob Moore)
      * Cleanup of hex detection in the utilities (Erik Schmauss)

   - Make ACPICA clear the status of all ACPI events when entering sleep
     states again to avoid functional regressions (Rafael Wysocki)

   - Update the ACPI operation region driver for the CrystalCove PMIC to
     cover all of the known operation region fields (Hans de Goede)"

* tag 'acpi-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI / PMIC: CrystalCove: Extend PMOP support to support all possible fields
  ACPICA: Clear status of all events when entering sleep states
  ACPICA: Update version to 20180810
  ACPICA: acpiexec: fix a small memory leak regression
  ACPICA: Reference Counts: increase max to 0x4000 for large servers
  ACPICA: Reference count: add additional debugging details
  ACPICA: acpi_exec: fixing -fi option
  ACPICA: Debugger: Cleanup interface to the AML disassembler
  ACPICA: AML Parser: skip opcodes that open a scope upon parse failure
  ACPICA: Utilities: split hex detection into smaller functions
  ACPICA: Update an error message for a duplicate table
  ACPICA: ACPICA: add status check for acpi_hw_read before assigning return value
  ACPICA: AML Parser: ignore all exceptions resulting from incorrect AML during table load

6 years agoMerge tag 'pm-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
Linus Torvalds [Wed, 22 Aug 2018 14:42:36 +0000 (07:42 -0700)]
Merge tag 'pm-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more power management updates from Rafael Wysocki:
 "These fix the main idle loop and the menu cpuidle governor, clean up
  the latter, fix a mistake in the PCI bus type's support for system
  suspend and resume, fix the ondemand and conservative cpufreq
  governors, address a build issue in the system wakeup framework and
  make the ACPI C-states desciptions less confusing.

  Specifics:

   - Make the idle loop handle stopped scheduler tick correctly (Rafael
     Wysocki).

   - Prevent the menu cpuidle governor from letting CPUs spend too much
     time in shallow idle states when it is invoked with scheduler tick
     stopped and clean it up somewhat (Rafael Wysocki).

   - Avoid invoking the platform firmware to make the platform enter the
     ACPI S3 sleep state with suspended PCIe root ports which may
     confuse the firmware and cause it to crash (Rafael Wysocki).

   - Fix sysfs-related race in the ondemand and conservative cpufreq
     governors which may cause the system to crash if the governor
     module is removed during an update of CPU frequency limits (Henry
     Willard).

   - Select SRCU when building the system wakeup framework to avoid a
     build issue in it (zhangyi).

   - Make the descriptions of ACPI C-states vendor-neutral to avoid
     confusion (Prarit Bhargava)"

* tag 'pm-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  cpuidle: menu: Handle stopped tick more aggressively
  sched: idle: Avoid retaining the tick when it has been stopped
  PCI / ACPI / PM: Resume all bridges on suspend-to-RAM
  cpuidle: menu: Update stale polling override comment
  cpufreq: governor: Avoid accessing invalid governor_data
  x86/ACPI/cstate: Make APCI C1 FFH MWAIT C-state description vendor-neutral
  cpuidle: menu: Fix white space
  PM / sleep: wakeup: Fix build error caused by missing SRCU support

6 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide
Linus Torvalds [Wed, 22 Aug 2018 14:40:33 +0000 (07:40 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide

Pull IDE updates from David Miller:

 - Remove redundant variables (Colin Ian King)

 - Expected switch fall-through annotations (Gustavo A. R. Silva)

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide:
  ide: mark expected switch fall-throughs
  ide-tape: remove redundant variable buffer_size
  ide: remove redundant variables queue_run_ms and left

6 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Linus Torvalds [Wed, 22 Aug 2018 14:38:21 +0000 (07:38 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc

Pull sparc updates from David Miller:
 "Nothing super serious:

   - Convert sparc32 over to NO_BOOTMEM (Mike Rapoport)

   - Use dma_noncoherent_ops on sparc32 (Christoph Hellwig)

   - Fix kbuild defconfig handling on sparc32 (Masahiro Yamada)"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
  sparc: fix KBUILD_DEFCONFIG for ARCH=sparc32
  sparc32: split ramdisk detection and reservation to a helper function
  sparc32: switch to NO_BOOTMEM
  sparc: mm/init_32: kill trailing whitespace
  sparc: use generic dma_noncoherent_ops

6 years agoinitramfs: move gen_initramfs_list.sh from scripts/ to usr/
Masahiro Yamada [Mon, 20 Aug 2018 15:29:51 +0000 (00:29 +0900)]
initramfs: move gen_initramfs_list.sh from scripts/ to usr/

scripts/gen_initramfs_list.sh is only invoked from usr/Makefile.
Move it so that all tools to create initramfs are self-contained
in the usr/ directory.

Signed-off-by: Masahiro Yamada <[email protected]>
6 years agovmlinux.lds.h: remove stale <linux/export.h> include
Masahiro Yamada [Mon, 20 Aug 2018 15:06:24 +0000 (00:06 +0900)]
vmlinux.lds.h: remove stale <linux/export.h> include

This is unneeded since commit a62143850053 ("vmlinux.lds.h: remove
no-op macro VMLINUX_SYMBOL()").

Signed-off-by: Masahiro Yamada <[email protected]>
6 years agoexport.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR()
Masahiro Yamada [Sat, 18 Aug 2018 22:34:47 +0000 (07:34 +0900)]
export.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR()

With the special case handling for Blackfin and Metag was removed by
commit 94e58e0ac312 ("export.h: remove code for prefixing symbols with
underscore"), VMLINUX_SYMBOL() is no-op.

Replace the remaining usages, then remove the definition of
VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR().

Signed-off-by: Masahiro Yamada <[email protected]>
6 years agoCoccinelle: remove pci_alloc_consistent semantic to detect in zalloc-simple.cocci
zhong jiang [Sat, 18 Aug 2018 13:51:12 +0000 (21:51 +0800)]
Coccinelle: remove pci_alloc_consistent semantic to detect in zalloc-simple.cocci

Because pci_alloc_consistent has been deprecated. We prefer to use
dma_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent
to increase the confidence.

Acked-by: Julia Lawall <[email protected]>
Acked-by: Himanshu Jha <[email protected]>
Signed-off-by: zhong jiang <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
6 years agokbuild: make sorting initramfs contents independent of locale
Andrzej Pietrasiewicz [Fri, 17 Aug 2018 12:03:19 +0000 (14:03 +0200)]
kbuild: make sorting initramfs contents independent of locale

Some LANG values (e.g. pl_PL.UTF-8) cause the sort command to output
files before their parent directories, which makes them inaccessible for
the kernel. In other words, when the kernel populates the rootfs, it is
unable to create files whose parent directories have not been yet created.

This patch makes sorting use the default (LANG=C) locale, which results in
correctly laid out initramfs images (parent directories before files).

Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
6 years agokbuild: remove "rpm" target, which is alias of "rpm-pkg"
Masahiro Yamada [Fri, 17 Aug 2018 02:37:21 +0000 (11:37 +0900)]
kbuild: remove "rpm" target, which is alias of "rpm-pkg"

As commit ebaad7d36406 ("kbuild: rpm: prompt to use "rpm-pkg" if "rpm"
target is used") noticed, the "rpm" target is now removed.
I assume people have already migrated to "rpm-pkg".

Signed-off-by: Masahiro Yamada <[email protected]>
6 years agokbuild: Fix LOADLIBES rename in Documentation/kbuild/makefiles.txt
Michal Suchanek [Thu, 16 Aug 2018 17:05:55 +0000 (19:05 +0200)]
kbuild: Fix LOADLIBES rename in Documentation/kbuild/makefiles.txt

Fixes: 8377bd2b9ee1 ("kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS")
Signed-off-by: Michal Suchanek <[email protected]>
Acked-by: Laura Abbott <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
6 years agokconfig: suppress "configuration written to .config" for syncconfig
Masahiro Yamada [Thu, 16 Aug 2018 07:48:26 +0000 (16:48 +0900)]
kconfig: suppress "configuration written to .config" for syncconfig

The top-level Makefile invokes "make syncconfig" when necessary.
Then, Kconfig displays the following message when .config is updated.

  #
  # configuration written to .config
  #

It is distracting because "make syncconfig" happens during the build
stage, and does nothing important in most cases.

Suggested-by: Linus Torvalds <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
6 years agokconfig: fix "Can't open ..." in parallel build
Masahiro Yamada [Thu, 16 Aug 2018 04:36:48 +0000 (13:36 +0900)]
kconfig: fix "Can't open ..." in parallel build

If you run "make menuconfig" or "make nconfig" with -j<N> option in a
fresh source tree, you will see several "Can't open ..." messages:

  $ make -j8 menuconfig
    HOSTCC  scripts/basic/fixdep
    YACC    scripts/kconfig/zconf.tab.c
    LEX     scripts/kconfig/zconf.lex.c
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .:   HOSTCC  scripts/kconfig/lxdialog/checklist.o
  Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
    HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
    UPD     scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
    HOSTCC  scripts/kconfig/lxdialog/menubox.o
    HOSTCC  scripts/kconfig/lxdialog/textbox.o
    HOSTCC  scripts/kconfig/lxdialog/util.o
    HOSTCC  scripts/kconfig/lxdialog/yesno.o
    HOSTCC  scripts/kconfig/mconf.o
    HOSTCC  scripts/kconfig/zconf.tab.o
    HOSTLD  scripts/kconfig/mconf

Correct dependencies to fix this problem.

Fixes: 1c5af5cf9308 ("kconfig: refactor ncurses package checks for building mconf and nconf")
Cc: linux-stable <[email protected]> # v4.18
Reported-by: Borislav Petkov <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
Tested-by: Borislav Petkov <[email protected]>
6 years agokbuild: Add a space after `!` to prevent parsing as file pattern
Michael Forney [Thu, 16 Aug 2018 00:13:50 +0000 (17:13 -0700)]
kbuild: Add a space after `!` to prevent parsing as file pattern

Some shells use !(pattern|...|pattern) to match file names not
containing the specified patterns. This may result in output like

  $ ./scripts/clang-version.sh gcc
  ./scripts/clang-version.sh[18]: COPYING: not found
  printf: %d __clang_major__: conversion error
  printf: %d __clang_minor__: conversion error
  printf: %d __clang_patchlevel__: conversion error
  00000
  $

and set CONFIG_CLANG_VERSION to the invalid value '00000'.

POSIX says[0]

  If the pipeline begins with the reserved word ! and command1 is a
  subshell command, the application shall ensure that the ( operator at
  the beginning of command1 is separated from the ! by one or more
  <blank> characters. The behavior of the reserved word ! immediately
  followed by the ( operator is unspecified.

So, just add a <blank> to prevent this.

[0] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_02

Signed-off-by: Michael Forney <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
6 years agoscripts: modpost: check memory allocation results
Randy Dunlap [Wed, 15 Aug 2018 19:30:38 +0000 (12:30 -0700)]
scripts: modpost: check memory allocation results

Fix missing error check for memory allocation functions in
scripts/mod/modpost.c.

Fixes kernel bugzilla #200319:
https://bugzilla.kernel.org/show_bug.cgi?id=200319

Signed-off-by: Randy Dunlap <[email protected]>
Cc: Yuexing Wang <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
6 years agokconfig: improve the recursive dependency report
Masahiro Yamada [Wed, 15 Aug 2018 05:59:45 +0000 (14:59 +0900)]
kconfig: improve the recursive dependency report

This commit improves the messages of the recursive dependency.
Currently, sym->dir_dep.expr is not checked.  Hence, any dependency
in property visibility is regarded as the dependency of the symbol.

[Test Code 1]

  config A
          bool "a"
          depends on B

  config B
          bool "b"
          depends on A

[Test Code 2]

  config A
          bool "a" if B

  config B
          bool "b"
          depends on A

For both cases above, the same message is displayed:

        symbol B depends on A
        symbol A depends on B

This commit changes the message for the latter, like this:

        symbol B depends on A
        symbol A prompt is visible depending on B

Also, 'select' and 'imply' are distinguished.

Signed-off-by: Masahiro Yamada <[email protected]>
Tested-by: Dirk Gouders <[email protected]>
6 years agokconfig: report recursive dependency involving 'imply'
Masahiro Yamada [Wed, 15 Aug 2018 05:59:44 +0000 (14:59 +0900)]
kconfig: report recursive dependency involving 'imply'

Currently, Kconfig does not complain about the recursive dependency
where 'imply' keywords are involved.

[Test Code]

  config A
          bool "a"

  config B
          bool "b"
          imply A
          depends on A

In the code above, Kconfig cannot calculate the symbol values correctly
due to the circular dependency.  For example, allyesconfig followed by
syncconfig results in an odd behavior because CONFIG_B becomes visible
in syncconfig.

  $ make allyesconfig
  scripts/kconfig/conf  --allyesconfig Kconfig
  #
  # configuration written to .config
  #
  $ cat .config
  #
  # Automatically generated file; DO NOT EDIT.
  # Main menu
  #
  CONFIG_A=y
  $ make syncconfig
  scripts/kconfig/conf  --syncconfig Kconfig
  *
  * Restart config...
  *
  *
  * Main menu
  *
  a (A) [Y/n/?] y
    b (B) [N/y/?] (NEW)

To detect this correctly, sym_check_expr_deps() should recurse to
not only sym->rev_dep.expr but also sym->implied.expr .

At this moment, sym_check_print_recursive() cannot distinguish
'select' and 'imply' since it does not know the precise context
where the recursive dependency has been hit.  This will be solved
by the next commit.

In fact, even the document and the unit-test are confused.  Using
'imply' does not solve recursive dependency since 'imply' addresses
the unmet direct dependency, which 'select' could cause.

Signed-off-by: Masahiro Yamada <[email protected]>
Tested-by: Dirk Gouders <[email protected]>
6 years agokconfig: error out when seeing recursive dependency
Masahiro Yamada [Wed, 15 Aug 2018 05:59:43 +0000 (14:59 +0900)]
kconfig: error out when seeing recursive dependency

Originally, recursive dependency was a fatal error for Kconfig
because Kconfig cannot compute symbol values in such a situation.

Commit d595cea62403 ("kconfig: print more info when we see a recursive
dependency") changed it to a warning, which I guess was not intentional.

Get it back to an error again.

Also, rename the unit test directory "warn_recursive_dep" to
"err_recursive_dep" so that it matches to the behavior.

Signed-off-by: Masahiro Yamada <[email protected]>
Tested-by: Dirk Gouders <[email protected]>
6 years agokconfig: add build-only configurator targets
Randy Dunlap [Wed, 15 Aug 2018 00:36:49 +0000 (17:36 -0700)]
kconfig: add build-only configurator targets

Add build-only targets for build_menuconfig, build_nconfig,
build_xconfig, and build_gconfig.
(targets must end in "config" to qualify in top-level Makefile)

This allows these target to be built without execution (e.g., to
look for errors or warnings) and/or to be built and checked by sparse.

Signed-off-by: Randy Dunlap <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
6 years agoscripts/dtc: consolidate include path options in Makefile
Masahiro Yamada [Wed, 4 Jul 2018 01:59:23 +0000 (10:59 +0900)]
scripts/dtc: consolidate include path options in Makefile

It is tedious to specify extra compiler options for every file.
HOST_EXTRACFLAGS is useful to add options to all files in a
directory.

-I$(src)/libfdt is needed for all the files in this directory
to include libfdt_env.h etc. from scripts/dtc/libfdt/.

On the other hand, -I$(src) is used to include check-in headers
from generated C files.  Thus, I added it only to dtc-lexer.lex.o
and dtc-parser.tab.o .

Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
6 years agoMerge tag 'for-4.19' of git://git.sourceforge.jp/gitroot/uclinux-h8/linux
Linus Torvalds [Wed, 22 Aug 2018 13:24:26 +0000 (06:24 -0700)]
Merge tag 'for-4.19' of git://git.sourceforge.jp/gitroot/uclinux-h8/linux

Pull arch/h8300 updates from Yoshinori Sato.

* tag 'for-4.19' of git://git.sourceforge.jp/gitroot/uclinux-h8/linux:
  h8300: fix IRQ no
  arch/h8300: add a defconfig target
  arch/h8300: eliminate kgbd.c warning
  arch/h8300: eliminate ptrace.h warnings
  h8300:let the checker know that size_t is ulong
  h8300: Don't include linux/kernel.h in asm/atomic.h
  h8300: remove unnecessary of_platform_populate call
  h8300: Correct signature of test_bit()
  h8300: irqchip: fix warning
  h8300: switch to NO_BOOTMEM
  h8300: gcc-8.1 fix
  h8300: Add missing output register.

6 years agoy2038: Provide aliases for compat helpers
Arnd Bergmann [Tue, 21 Aug 2018 20:33:00 +0000 (22:33 +0200)]
y2038: Provide aliases for compat helpers

As part of the system call rework for 64-bit time_t, we are restructuring
the way that compat syscalls deal with 32-bit time_t, reusing the
implementation for 32-bit architectures. Christoph Hellwig suggested a
rename of the associated types and interfaces to avoid the confusing usage
of the 'compat' prefix for 32-bit architectures.

To prepare for doing that in linux-4.20, add a set of macros that allows to
convert subsystems separately to the new names and avoids some of the
nastier merge conflicts.

Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Acked-by: Christoph Hellwig <[email protected]>
Cc: [email protected]
Cc: John Stultz <[email protected]>
Cc: Deepa Dinamani <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
6 years agoKVM: Documentation: rename the capability of KVM_CAP_ARM_SET_SERROR_ESR
Dongjiu Geng [Mon, 20 Aug 2018 21:39:25 +0000 (17:39 -0400)]
KVM: Documentation: rename the capability of KVM_CAP_ARM_SET_SERROR_ESR

In the documentation description, this capability's name is
KVM_CAP_ARM_SET_SERROR_ESR, but in the header file this
capability's name is KVM_CAP_ARM_INJECT_SERROR_ESR, so change
the documentation description to make it same.

Signed-off-by: Dongjiu Geng <[email protected]>
Reported-by: Andrew Jones <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
6 years agoMerge tag 'kvmarm-for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm...
Paolo Bonzini [Wed, 22 Aug 2018 12:07:56 +0000 (14:07 +0200)]
Merge tag 'kvmarm-for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD

KVM/arm updates for 4.19

- Support for Group0 interrupts in guests
- Cache management optimizations for ARMv8.4 systems
- Userspace interface for RAS, allowing error retrival and injection
- Fault path optimization
- Emulated physical timer fixes
- Random cleanups

6 years agoplatform/x86: acer-wmi: Silence "unsupported" message a bit
Benjamin Herrenschmidt [Wed, 15 Aug 2018 23:27:10 +0000 (09:27 +1000)]
platform/x86: acer-wmi: Silence "unsupported" message a bit

This driver prints that "Unsupported machine..." message on every boot on
ThinkPad X1 Carbon laptops (and I assume a number of other systems), which
causes graphical boots to "glitch" a bit and is rather annoying ...

Make it a pr_debug instead.

Signed-off-by: Benjamin Herrenschmidt <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
6 years agoh8300: fix IRQ no
Yoshinori Sato [Wed, 11 Jul 2018 09:39:09 +0000 (18:39 +0900)]
h8300: fix IRQ no

Old timer handler use 24 (Compare match A).
But current timer handler use 26 (Overflow).

Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoarch/h8300: add a defconfig target
Randy Dunlap [Thu, 19 Jul 2018 06:04:29 +0000 (23:04 -0700)]
arch/h8300: add a defconfig target

Make the "defconfig" target valid for arch/h8300.  Currently
"make ARCH=h8300 defconfig" produces:

*** Can't find default configuration "arch/h8300/defconfig"!
../scripts/kconfig/Makefile:87: recipe for target 'defconfig' failed

By adding a value for KBUILD_DEFCONFIG, "make ARCH=h8300 defconfig"
successfully produces a kernel .config file:

*** Default configuration is based on 'edosk2674_defconfig'

This is useful for Kconfig editing/testing.

Signed-off-by: Randy Dunlap <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: [email protected] (moderated for non-subscribers)
Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoarch/h8300: eliminate kgbd.c warning
Randy Dunlap [Fri, 20 Jul 2018 02:36:06 +0000 (19:36 -0700)]
arch/h8300: eliminate kgbd.c warning

Drop the "const" qualifier from arch_kgdb_ops to eliminate the gcc
warning (gcc version is 8.1.0).

arch/h8300/kernel/kgdb.c:132:24: error: conflicting type qualifiers for 'arch_kgdb_ops'
 const struct kgdb_arch arch_kgdb_ops = {
In file included from ../arch/h8300/kernel/kgdb.c:12:
../include/linux/kgdb.h:284:26: note: previous declaration of 'arch_kgdb_ops' was here
 extern struct kgdb_arch  arch_kgdb_ops;

Signed-off-by: Randy Dunlap <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: [email protected]
Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoarch/h8300: eliminate ptrace.h warnings
Randy Dunlap [Fri, 20 Jul 2018 02:34:53 +0000 (19:34 -0700)]
arch/h8300: eliminate ptrace.h warnings

Add a "struct task_struct;" stub to arch/h8300's ptrace.h header to
eliminate gcc warnings (gcc version is 8.1.0).

../arch/h8300/include/asm/ptrace.h:32:34: warning: 'struct task_struct' declared inside parameter list will not be visible outside of this definition or declaration
 extern long h8300_get_reg(struct task_struct *task, int regno);
../arch/h8300/include/asm/ptrace.h:33:33: warning: 'struct task_struct' declared inside parameter list will not be visible outside of this definition or declaration
 extern int h8300_put_reg(struct task_struct *task, int regno,

Signed-off-by: Randy Dunlap <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: [email protected]
Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoh8300:let the checker know that size_t is ulong
Luc Van Oostenryck [Wed, 30 May 2018 21:03:43 +0000 (23:03 +0200)]
h8300:let the checker know that size_t is ulong

All 64bit archs use unsigned long for size_t and most 32bit
archs use 'unsigned int'. By default, this is what is assumed
by sparse.

However, on h8300 (a 32bit arch) size_t is unsigned long which
can led sparse to emit wrong warnings.

Fix this by passing to sparse the flag -msize-long, telling it
that size_t is unsigned long.

Signed-off-by: Luc Van Oostenryck <[email protected]>
Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoh8300: Don't include linux/kernel.h in asm/atomic.h
Will Deacon [Fri, 1 Jun 2018 16:06:21 +0000 (17:06 +0100)]
h8300: Don't include linux/kernel.h in asm/atomic.h

linux/kernel.h isn't needed by asm/atomic.h and will result in circular
dependencies when the asm-generic atomic bitops are built around the
tomic_long_t interface.

Remove the broad include and replace it with linux/compiler.h for
READ_ONCE etc and asm/irqflags.h for arch_local_irq_save etc.

Cc: Yoshinori Sato <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoh8300: remove unnecessary of_platform_populate call
Rob Herring [Tue, 19 Jun 2018 21:40:54 +0000 (15:40 -0600)]
h8300: remove unnecessary of_platform_populate call

The DT core will call of_platform_populate, so it is not necessary for
arch specific code to call it unless there are custom match entries,
auxdata or parent device. Neither of those apply here, so remove the call.

Cc: Yoshinori Sato <[email protected]>
Cc: [email protected]
Signed-off-by: Rob Herring <[email protected]>
Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoh8300: Correct signature of test_bit()
Geert Uytterhoeven [Thu, 21 Jun 2018 19:24:44 +0000 (21:24 +0200)]
h8300: Correct signature of test_bit()

    mm/filemap.c: In function 'clear_bit_unlock_is_negative_byte':
    mm/filemap.c:1181:30: warning: passing argument 2 of 'test_bit' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
      return test_bit(PG_waiters, mem);
  ^~~
    In file included from include/linux/bitops.h:38,
     from include/linux/kernel.h:11,
     from include/linux/list.h:9,
     from include/linux/wait.h:7,
     from include/linux/wait_bit.h:8,
     from include/linux/fs.h:6,
     from include/linux/dax.h:5,
     from mm/filemap.c:14:
    arch/h8300/include/asm/bitops.h:69:57: note: expected 'const long unsigned int *' but argument is of type 'volatile void *'
     static inline int test_bit(int nr, const unsigned long *addr)
~~~~~~~~~~~~~~~~~~~~~^~~~

Make the bitmask pointed to by the "addr" parameter volatile to fix
this, like is done on other architectures.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoh8300: irqchip: fix warning
Yoshinori Sato [Mon, 13 Aug 2018 01:07:46 +0000 (10:07 +0900)]
h8300: irqchip: fix warning

Var "addr" type incorrect.
It have interrupt controler register address.
Type of void __iomem is correct.

Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoh8300: switch to NO_BOOTMEM
Rob Herring [Fri, 16 Mar 2018 21:33:06 +0000 (16:33 -0500)]
h8300: switch to NO_BOOTMEM

Commit 0fa1c579349f ("of/fdt: use memblock_virt_alloc for early alloc")
inadvertently switched the DT unflattening allocations from memblock to
bootmem which doesn't work because the unflattening happens before
bootmem is initialized. Swapping the order of bootmem init and
unflattening could also fix this, but removing bootmem is desired. So
enable NO_BOOTMEM on h8300 like other architectures have done.

Fixes: 0fa1c579349f ("of/fdt: use memblock_virt_alloc for early alloc")
Cc: Yoshinori Sato <[email protected]>
Cc: [email protected]
Signed-off-by: Rob Herring <[email protected]>
Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoh8300: gcc-8.1 fix
Yoshinori Sato [Fri, 13 Jul 2018 07:36:21 +0000 (16:36 +0900)]
h8300: gcc-8.1 fix

Since gcc 8.1 does not generate an assignment statement to er 0,
we had to explicitly write it.

Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoh8300: Add missing output register.
Yoshinori Sato [Thu, 12 Jul 2018 14:31:45 +0000 (23:31 +0900)]
h8300: Add missing output register.

Signed-off-by: Yoshinori Sato <[email protected]>
6 years agoida: Change ida_get_new_above to return the id
Matthew Wilcox [Mon, 18 Jun 2018 23:11:56 +0000 (19:11 -0400)]
ida: Change ida_get_new_above to return the id

This calling convention makes more sense for the implementation as well
as the callers.  It even shaves 32 bytes off the compiled code size.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agoida: Remove old API
Matthew Wilcox [Mon, 18 Jun 2018 23:02:48 +0000 (19:02 -0400)]
ida: Remove old API

Delete ida_pre_get(), ida_get_new(), ida_get_new_above() and ida_remove()
from the public API.  Some of these functions still exist as internal
helpers, but they should not be called by consumers.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agotest_ida: check_ida_destroy and check_ida_alloc
Matthew Wilcox [Mon, 18 Jun 2018 22:39:28 +0000 (18:39 -0400)]
test_ida: check_ida_destroy and check_ida_alloc

Move these tests from the userspace test-suite to the kernel test-suite.
Also convert check_ida_random to the new API.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agotest_ida: Convert check_ida_conv to new API
Matthew Wilcox [Mon, 18 Jun 2018 22:10:32 +0000 (18:10 -0400)]
test_ida: Convert check_ida_conv to new API

Move as much as possible to kernel space; leave the parts in user space
that rely on checking memory allocation failures to detect the
transition between an exceptional entry and a bitmap.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agotest_ida: Move ida_check_max
Matthew Wilcox [Mon, 18 Jun 2018 21:25:20 +0000 (17:25 -0400)]
test_ida: Move ida_check_max

Convert to new API and move to kernel space.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agotest_ida: Move ida_check_leaf
Matthew Wilcox [Mon, 18 Jun 2018 21:23:37 +0000 (17:23 -0400)]
test_ida: Move ida_check_leaf

Convert to new API and move to kernel space.  Take the opportunity to
test the situation a little more thoroughly (ie at different offsets).

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agoidr-test: Convert ida_check_nomem to new API
Matthew Wilcox [Mon, 18 Jun 2018 21:06:58 +0000 (17:06 -0400)]
idr-test: Convert ida_check_nomem to new API

We can't move this test to kernel space because there's no way to
force kmalloc to fail.  But we can use the new API and check this
works when the test is in userspace.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agoida: Start new test_ida module
Matthew Wilcox [Mon, 18 Jun 2018 20:59:29 +0000 (16:59 -0400)]
ida: Start new test_ida module

Start transitioning the IDA tests into kernel space.  Framework heavily
cribbed from test_xarray.c.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agotarget/iscsi: Allocate session IDs from an IDA
Matthew Wilcox [Tue, 19 Jun 2018 05:23:04 +0000 (01:23 -0400)]
target/iscsi: Allocate session IDs from an IDA

Since the session is never looked up by ID, we can use the more
space-efficient IDA instead of the IDR.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agoiscsi target: fix session creation failure handling
Mike Christie [Thu, 26 Jul 2018 17:13:49 +0000 (12:13 -0500)]
iscsi target: fix session creation failure handling

The problem is that iscsi_login_zero_tsih_s1 sets conn->sess early in
iscsi_login_set_conn_values. If the function fails later like when we
alloc the idr it does kfree(sess) and leaves the conn->sess pointer set.
iscsi_login_zero_tsih_s1 then returns -Exyz and we then call
iscsi_target_login_sess_out and access the freed memory.

This patch has iscsi_login_zero_tsih_s1 either completely setup the
session or completely tear it down, so later in
iscsi_target_login_sess_out we can just check for it being set to the
connection.

Cc: [email protected]
Fixes: 0957627a9960 ("iscsi-target: Fix sess allocation leak in...")
Signed-off-by: Mike Christie <[email protected]>
Acked-by: Martin K. Petersen <[email protected]>
Signed-off-by: Matthew Wilcox <[email protected]>
6 years agodrm/vmwgfx: Convert to new IDA API
Matthew Wilcox [Mon, 18 Jun 2018 20:00:05 +0000 (16:00 -0400)]
drm/vmwgfx: Convert to new IDA API

Reorder allocation to avoid an awkward lock/unlock/lock sequence.
Simpler code due to being able to use ida_alloc_max(), even if we can't
eliminate the driver's spinlock.

Signed-off-by: Matthew Wilcox <[email protected]>
Reviewed-by: Sinclair Yeh <[email protected]>
6 years agodmaengine: Convert to new IDA API
Matthew Wilcox [Mon, 18 Jun 2018 19:41:48 +0000 (15:41 -0400)]
dmaengine: Convert to new IDA API

Simpler and shorter code.

Signed-off-by: Matthew Wilcox <[email protected]>
Acked-by: Vinod Koul <[email protected]>
6 years agoppc: Convert vas ID allocation to new IDA API
Matthew Wilcox [Mon, 18 Jun 2018 13:34:34 +0000 (09:34 -0400)]
ppc: Convert vas ID allocation to new IDA API

Removes a custom spinlock and simplifies the code.  Also fix an
error where we could allocate one ID too many.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agomedia: Convert entity ID allocation to new IDA API
Matthew Wilcox [Mon, 18 Jun 2018 12:35:52 +0000 (08:35 -0400)]
media: Convert entity ID allocation to new IDA API

Removes a call to ida_pre_get().

Signed-off-by: Matthew Wilcox <[email protected]>
Reviewed-by: Sakari Ailus <[email protected]>
Acked-by: Mauro Carvalho Chehab <[email protected]>
6 years agoppc: Convert mmu context allocation to new IDA API
Matthew Wilcox [Mon, 18 Jun 2018 12:26:32 +0000 (08:26 -0400)]
ppc: Convert mmu context allocation to new IDA API

ida_alloc_range is the perfect fit for this use case.  Eliminates
a custom spinlock, a call to ida_pre_get and a local check for the
allocated ID exceeding a maximum.

Signed-off-by: Matthew Wilcox <[email protected]>
Reviewed-by: Nicholas Piggin <[email protected]>
6 years agoConvert net_namespace to new IDA API
Matthew Wilcox [Sun, 17 Jun 2018 09:37:08 +0000 (05:37 -0400)]
Convert net_namespace to new IDA API

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agocb710: Convert to new IDA API
Matthew Wilcox [Mon, 11 Jun 2018 19:53:18 +0000 (15:53 -0400)]
cb710: Convert to new IDA API

Eliminates the custom spinlock and the call to ida_pre_get.

Signed-off-by: Matthew Wilcox <[email protected]>
Acked-by: Michał Mirosław <[email protected]>
6 years agorsxx: Convert to new IDA API
Matthew Wilcox [Mon, 11 Jun 2018 19:46:46 +0000 (15:46 -0400)]
rsxx: Convert to new IDA API

Eliminate the custom spinlock and the call to ida_pre_get.
Also add a call to ida_free() in the card remove routine, which I believe
fixes a bug in this driver.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agoosd: Convert to new IDA API
Matthew Wilcox [Mon, 11 Jun 2018 19:41:25 +0000 (15:41 -0400)]
osd: Convert to new IDA API

Slightly simpler code.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agosd: Convert to new IDA API
Matthew Wilcox [Mon, 11 Jun 2018 19:26:27 +0000 (15:26 -0400)]
sd: Convert to new IDA API

Allows us to remove an explicit spinlock.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agodevpts: Convert to new IDA API
Matthew Wilcox [Mon, 11 Jun 2018 19:17:58 +0000 (15:17 -0400)]
devpts: Convert to new IDA API

ida_alloc_max() matches what this driver wants to do.  Also removes a
call to ida_pre_get().  We no longer need the protection of the mutex,
so convert pty_count to an atomic_t and remove the mutex entirely.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agofs: Convert namespace IDAs to new API
Matthew Wilcox [Mon, 11 Jun 2018 16:31:36 +0000 (12:31 -0400)]
fs: Convert namespace IDAs to new API

We don't need to keep track of the starting value; the IDA is efficient.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agofs: Convert unnamed_dev_ida to new API
Matthew Wilcox [Mon, 11 Jun 2018 16:03:31 +0000 (12:03 -0400)]
fs: Convert unnamed_dev_ida to new API

The new API is much easier for this user.  Also add kerneldoc for
get_anon_bdev().

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agomtip32xx: Convert to new IDA API
Matthew Wilcox [Wed, 21 Mar 2018 20:49:06 +0000 (16:49 -0400)]
mtip32xx: Convert to new IDA API

Removes a use of ida_pre_get() and a personalised spinlock.

Signed-off-by: Matthew Wilcox <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
6 years agoida: Add new API
Matthew Wilcox [Tue, 20 Mar 2018 21:07:11 +0000 (17:07 -0400)]
ida: Add new API

Add ida_alloc(), ida_alloc_min(), ida_alloc_max(), ida_alloc_range()
and ida_free().  The ida_alloc_max() and ida_alloc_range() functions
differ from ida_simple_get() in that they take an inclusive 'max'
parameter instead of an exclusive 'end' parameter.  Callers are about
evenly split whether they'd like inclusive or exclusive parameters and
'max' is easier to document than 'end'.

Change the IDA allocation to first attempt to allocate a bit using
existing memory, and only allocate memory afterwards.  Also change the
behaviour of 'min' > INT_MAX from being a BUG() to returning -ENOSPC.

Leave compatibility wrappers in place for ida_simple_get() and
ida_simple_remove() to avoid changing all callers.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agoida: Lock the IDA in ida_destroy
Matthew Wilcox [Thu, 21 Jun 2018 19:36:45 +0000 (15:36 -0400)]
ida: Lock the IDA in ida_destroy

The user has no need to handle locking between ida_simple_get() and
ida_simple_remove().  They shouldn't be forced to think about whether
ida_destroy() might be called at the same time as any of their other
IDA manipulation calls.  Improve the documnetation while I'm in here.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agoradix-tree: Fix UBSAN warning
Matthew Wilcox [Sat, 18 Aug 2018 11:05:50 +0000 (07:05 -0400)]
radix-tree: Fix UBSAN warning

get_slot_offset() can be called with a NULL 'parent' argument.
In this case, the calculated value will not be used, but calculating
it is undefined.  Rather than fixing the caller (__radix_tree_delete)
to not call get_slot_offset(), make get_slot_offset() robust against
being called with a NULL parent.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agoradix tree test suite: Enable ubsan
Matthew Wilcox [Sat, 19 May 2018 20:30:54 +0000 (16:30 -0400)]
radix tree test suite: Enable ubsan

Add support for the undefined behaviour sanitizer and fix the bugs
that ubsan pointed out.  Nothing major, and all in the test suite,
not the code.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agoradix tree test suite: Fix compilation
Matthew Wilcox [Wed, 22 Aug 2018 03:22:54 +0000 (23:22 -0400)]
radix tree test suite: Fix compilation

An include of xarray.h was added to lib/idr.c without updating the test
suite.

Signed-off-by: Matthew Wilcox <[email protected]>
6 years agoMerge tag 'fuse-update-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mszered...
Linus Torvalds [Wed, 22 Aug 2018 01:47:36 +0000 (18:47 -0700)]
Merge tag 'fuse-update-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse

Pull fuse update from Miklos Szeredi:
 "Various bug fixes and cleanups"

* tag 'fuse-update-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
  fuse: reduce allocation size for splice_write
  fuse: use kvmalloc to allocate array of pipe_buffer structs.
  fuse: convert last timespec use to timespec64
  fs: fuse: Adding new return type vm_fault_t
  fuse: simplify fuse_abort_conn()
  fuse: Add missed unlock_page() to fuse_readpages_fill()
  fuse: Don't access pipe->buffers without pipe_lock()
  fuse: fix initial parallel dirops
  fuse: Fix oops at process_init_reply()
  fuse: umount should wait for all requests
  fuse: fix unlocked access to processing queue
  fuse: fix double request_end()

6 years agoMerge tag 'ovl-update-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs
Linus Torvalds [Wed, 22 Aug 2018 01:19:09 +0000 (18:19 -0700)]
Merge tag 'ovl-update-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs

Pull overlayfs updates from Miklos Szeredi:
 "This contains two new features:

   - Stack file operations: this allows removal of several hacks from
     the VFS, proper interaction of read-only open files with copy-up,
     possibility to implement fs modifying ioctls properly, and others.

   - Metadata only copy-up: when file is on lower layer and only
     metadata is modified (except size) then only copy up the metadata
     and continue to use the data from the lower file"

* tag 'ovl-update-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs: (66 commits)
  ovl: Enable metadata only feature
  ovl: Do not do metacopy only for ioctl modifying file attr
  ovl: Do not do metadata only copy-up for truncate operation
  ovl: add helper to force data copy-up
  ovl: Check redirect on index as well
  ovl: Set redirect on upper inode when it is linked
  ovl: Set redirect on metacopy files upon rename
  ovl: Do not set dentry type ORIGIN for broken hardlinks
  ovl: Add an inode flag OVL_CONST_INO
  ovl: Treat metacopy dentries as type OVL_PATH_MERGE
  ovl: Check redirects for metacopy files
  ovl: Move some dir related ovl_lookup_single() code in else block
  ovl: Do not expose metacopy only dentry from d_real()
  ovl: Open file with data except for the case of fsync
  ovl: Add helper ovl_inode_realdata()
  ovl: Store lower data inode in ovl_inode
  ovl: Fix ovl_getattr() to get number of blocks from lower
  ovl: Add helper ovl_dentry_lowerdata() to get lower data dentry
  ovl: Copy up meta inode data from lowest data inode
  ovl: Modify ovl_lookup() and friends to lookup metacopy dentry
  ...

6 years agoMerge tag 'xfs-4.19-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Linus Torvalds [Wed, 22 Aug 2018 01:15:47 +0000 (18:15 -0700)]
Merge tag 'xfs-4.19-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Darrick Wong:

 - Fix an uninitialized variable

 - Don't use obviously garbage AG header counters to calculate
   transaction reservations

 - Trigger icount recalculation on bad icount when mounting

* tag 'xfs-4.19-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  iomap: fix WARN_ON_ONCE on uninitialized variable
  xfs: sanity check ag header values in xrep_calc_ag_resblks
  xfs: recalculate summary counters at mount time if icount is bad

6 years agoMerge tag 'for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux...
Linus Torvalds [Wed, 22 Aug 2018 01:06:27 +0000 (18:06 -0700)]
Merge tag 'for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:

 - Improve support for TI bq20z75 in sbs-battery

 - Add Qualcomm PM8xxx reboot driver

 - Add cros-ec USBPD charger driver

 - Move ds2760 battery driver from w1 to power-supply and add DT support

 - Misc fixes

* tag 'for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (28 commits)
  power: supply: bq27xxx: Update comments
  power: supply: max77693_charger: fix unintentional fall-through
  power: supply: mark expected switch fall-throughs
  power: supply: lego_ev3_battery: fix Vce offset
  power: supply: lego_ev3_battery: Don't ignore iio_read_channel_processed() return value
  power: supply: ds2760_battery: add devicetree probing
  power: supply: ds2760_battery: merge ds2760 supply driver with its w1 slave companion
  w1: core: match sub-nodes of bus masters in devicetree
  dt-bindings: w1: document bindings for ds2760 battery monitor
  dt-bindings: w1: document generic onewire bindings
  power: supply: adp5061: Fix a couple off by ones
  dt-bindings: power: reset: qcom: Add resin binding
  adp5061: New driver for ADP5061 I2C battery charger
  power: generic-adc-battery: check for duplicate properties copied from iio channels
  power: generic-adc-battery: fix out-of-bounds write when copying channel properties
  power: supply: axp288_charger: Fix initial constant_charge_current value
  power: supply: ab8500: stop using getnstimeofday64()
  power: gemini-poweroff: Avoid more spurious poweroffs
  power: vexpress: fix corruption in notifier registration
  power: remove possible deadlock when unregistering power_supply
  ...

6 years agoMerge branch 'i2c/for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Wed, 22 Aug 2018 00:40:46 +0000 (17:40 -0700)]
Merge branch 'i2c/for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c updates from Wolfram Sang:

 - the core has now a lockless variant of i2c_smbus_xfer. Some open
   coded versions of this got removed in drivers. This also enables
   proper SCCB support in regmap.

 - locking got a more precise naming. i2c_{un}lock_adapter() had to go,
   and we know use i2c_lock_bus() consistently with flags like
   I2C_LOCK_ROOT_ADAPTER and I2C_LOCK_SEGMENT to avoid ambiguity.

 - the gpio fault injector got a new delicate testcase

 - the bus recovery procedure got fixed to handle the new testcase
   correctly

 - a new quirk flag for controllers not able to handle zero length
   messages together with driver updates to use it

 - new drivers: FSI bus attached I2C masters, GENI I2C controller, Owl
   family S900

 - and a good set of driver improvements and bugfixes

* 'i2c/for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (77 commits)
  i2c: rcar: implement STOP and REP_START according to docs
  i2c: rcar: refactor private flags
  i2c: core: ACPI: Make acpi_gsb_i2c_read_bytes() check i2c_transfer return value
  i2c: core: ACPI: Properly set status byte to 0 for multi-byte writes
  dt-bindings: i2c: rcar: Add r8a774a1 support
  dt-bindings: i2c: sh_mobile: Add r8a774a1 support
  i2c: imx: Simplify stopped state tracking
  i2c: imx: Fix race condition in dma read
  i2c: pasemi: remove hardcoded bus numbers on smbus
  i2c: designware: Add SPDX license tag
  i2c: designware: Convert to use struct i2c_timings
  i2c: core: Parse SDA hold time from firmware
  i2c: designware-pcidrv: Mark expected switch fall-through
  i2c: amd8111: Mark expected switch fall-through
  i2c: sh_mobile: use core to detect 'no zero length read' quirk
  i2c: xlr: use core to detect 'no zero length' quirk
  i2c: rcar: use core to detect 'no zero length' quirk
  i2c: stu300: use core to detect 'no zero length' quirk
  i2c: pmcmsp: use core to detect 'no zero length' quirk
  i2c: mxs: use core to detect 'no zero length' quirk
  ...

6 years agoapparmor: fix an error code in __aa_create_ns()
Dan Carpenter [Thu, 2 Aug 2018 08:38:23 +0000 (11:38 +0300)]
apparmor: fix an error code in __aa_create_ns()

We should return error pointers in this function.  Returning NULL
results in a NULL dereference in the caller.

Fixes: 73688d1ed0b8 ("apparmor: refactor prepare_ns() and make usable from different views")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: John Johansen <[email protected]>
6 years agoIB/ucm: fix UCM link error
Arnd Bergmann [Tue, 21 Aug 2018 14:20:44 +0000 (16:20 +0200)]
IB/ucm: fix UCM link error

Building UCM with CONFIG_INFINIBAND_USER_ACCESS=m results in a
set of link errors including:

drivers/infiniband/core/ucm.o: In function `ib_ucm_event_handler':
ucm.c:(.text+0x6dc): undefined reference to `ib_copy_path_rec_to_user'
drivers/infiniband/core/ucma.o: In function `ucma_event_handler':
ucma.c:(.text+0xdc0): undefined reference to `ib_copy_ah_attr_to_user'

To get it to build-test again, this makes the option itself a
tristate, which lets Kconfig figure out the dependency correctly.

Fixes: 486edfb1039d ("IB/ucm: Fix compiling ucm.c")
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
6 years agovhost/scsi: increase VHOST_SCSI_PREALLOC_PROT_SGLS to 2048
Greg Edwards [Wed, 8 Aug 2018 19:29:55 +0000 (13:29 -0600)]
vhost/scsi: increase VHOST_SCSI_PREALLOC_PROT_SGLS to 2048

The current value of VHOST_SCSI_PREALLOC_PROT_SGLS is too small to
accommodate larger I/Os, e.g. 16-32 MiB, when the VIRTIO_SCSI_F_T10_PI
feature bit is negotiated and the backing store supports T10 PI.

vhost-scsi rejects the command with errors like:

[   59.581317] vhost_scsi_calc_sgls: requested sgl_count: 1820 exceeds pre-allocated max_sgls: 512

Signed-off-by: Greg Edwards <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
6 years agovhost: allow vhost-scsi driver to be built-in
Greg Edwards [Fri, 10 Aug 2018 16:45:49 +0000 (10:45 -0600)]
vhost: allow vhost-scsi driver to be built-in

It's useful to allow vhost-scsi to be built-in when testing vhost in L1
+ L2 VMs and booting L1 VM with QEMU '-kernel' option.

Signed-off-by: Greg Edwards <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
This page took 0.12609 seconds and 4 git commands to generate.