Commit graph

884,359 commits

Author SHA1 Message Date
Minchan Kim
a95f164e8e mm: support vector address ranges for process_madvise
This patch changes process_madvise interface:

  a) support vector address ranges in a system call
  b) support the vector address ranges to local process as well as
     external process
  c) remove pid but keep only pidfd in argument - [1][2]
  d) change type of flags with unsgined int

Android app has thousands of vmas due to zygote so it's totally waste of
CPU and power if we should call the syscall one by one for each vma.
(With testing 2000-vma syscall vs 1-vector syscall, it showed 15%
performance improvement.  I think it would be bigger in real practice
because the testing ran very cache friendly environment).

Another potential use case for the vector range is to amortize the cost of
TLB shootdowns for multiple ranges when using MADV_DONTNEED; this could
benefit users like TCP receive zerocopy and malloc implementations.  In
future, we could find more usecases for other advises so let's make it
happens as API since we introduce a new syscall at this moment.  With
that, existing madvise(2) user could replace it with process_madvise(2)
with their own pid if they want to have batch address ranges support
feature.

So finally, the API is as follows,

      ssize_t process_madvise(int pidfd, const struct iovec *iovec,
      		unsigned long vlen, int advice, unsigned int flags);

    DESCRIPTION
      The process_madvise() system call is used to give advice or directions
      to the kernel about the address ranges from external process as well as
      local process. It provides the advice to address ranges of process
      described by iovec and vlen. The goal of such advice is to improve system
      or application performance.

      The pidfd selects the process referred to by the PID file descriptor
      specified in pidfd. (See pidofd_open(2) for further information)

      The pointer iovec points to an array of iovec structures, defined in
      <sys/uio.h> as:

        struct iovec {
            void *iov_base;         /* starting address */
            size_t iov_len;         /* number of bytes to be advised */
        };

      The iovec describes address ranges beginning at address(iov_base)
      and with size length of bytes(iov_len).

      The vlen represents the number of elements in iovec.

      The advice is indicated in the advice argument, which is one of the
      following at this moment if the target process specified by pidfd is
      external.

        MADV_COLD
        MADV_PAGEOUT
        MADV_MERGEABLE
        MADV_UNMERGEABLE

      Permission to provide a hint to external process is governed by a
      ptrace access mode PTRACE_MODE_ATTACH_FSCREDS check; see ptrace(2).

      The process_madvise supports every advice madvise(2) has if target
      process is in same thread group with calling process so user could
      use process_madvise(2) to extend existing madvise(2) to support
      vector address ranges.

    RETURN VALUE
      On success, process_madvise() returns the number of bytes advised.
      This return value may be less than the total number of requested
      bytes, if an error occurred. The caller should check return value
      to determine whether a partial advice occurred.

[1] https://lore.kernel.org/linux-mm/20200509124817.xmrvsrq3mla6b76k@wittgenstein/
[2] https://lore.kernel.org/linux-mm/9d849087-3359-c4ab-fbec-859e8186c509@virtuozzo.com/

Link: http://lkml.kernel.org/r/20200518211350.GA50295@google.com
Link: http://lkml.kernel.org/r/20200423145215.72666-2-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Arjun Roy <arjunroy@google.com>
Cc: Tim Murray <timmurray@google.com>
Cc: Daniel Colascione <dancol@google.com>
Cc: Sonny Rao <sonnyrao@google.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: John Dias <joaodias@google.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: SeongJae Park <sj38.park@gmail.com>
Cc: Oleksandr Natalenko <oleksandr@redhat.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Git-Commit: cac63a8674fec9a9e288972475366896d706b53c
Git-Repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

From: Randy Dunlap <rdunlap@infradead.org>
Subject: mm-support-vector-address-ranges-for-process_madvise-fix-fix

fix process_madvise prototype.
[charante@codeaurora.org]: This is merged with cac63a8674fe ("mm:
support vector address ranges for process_madvise" to avoid the
compilation errors.

Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Git-Commit: beadf725ea3f41cc23c77aefcb3139c081ff528d
Git-Repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
Change-Id: I8aa28294d56874f057779674337986dbbe7cf076
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
2020-06-18 18:51:10 +05:30
Oleksandr Natalenko
f7027e2612 mm/madvise: allow KSM hints for remote API
It all began with the fact that KSM works only on memory that is marked by
madvise().  And the only way to get around that is to either:

  * use LD_PRELOAD; or
  * patch the kernel with something like UKSM or PKSM.

(i skip ptrace can of worms here intentionally)

To overcome this restriction, lets employ a new remote madvise API.  This
can be used by some small userspace helper daemon that will do auto-KSM
job for us.

I think of two major consumers of remote KSM hints:

  * hosts, that run containers, especially similar ones and especially in
    a trusted environment, sharing the same runtime like Node.js;

  * heavy applications, that can be run in multiple instances, not
    limited to opensource ones like Firefox, but also those that cannot be
    modified since they are binary-only and, maybe, statically linked.

Speaking of statistics, more numbers can be found in the very first
submission, that is related to this one [1].  For my current setup with
two Firefox instances I get 100 to 200 MiB saved for the second instance
depending on the amount of tabs.

1 FF instance with 15 tabs:

   $ echo "$(cat /sys/kernel/mm/ksm/pages_sharing) * 4 / 1024" | bc
   410

2 FF instances, second one has 12 tabs (all the tabs are different):

   $ echo "$(cat /sys/kernel/mm/ksm/pages_sharing) * 4 / 1024" | bc
   592

At the very moment I do not have specific numbers for containerised
workload, but those should be comparable in case the containers share
similar/same runtime.

[1] https://lore.kernel.org/patchwork/patch/1012142/.

Change-Id: I325b1ec4ee73fe03511391a687a6ecc4c5df89e7
Link: http://lkml.kernel.org/r/20200302193630.68771-8-minchan@kernel.org
Signed-off-by: Oleksandr Natalenko <oleksandr@redhat.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: SeongJae Park <sjpark@amazon.de>
Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Christian Brauner <christian@brauner.io>
Cc: Daniel Colascione <dancol@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: John Dias <joaodias@google.com>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: SeongJae Park <sj38.park@gmail.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Sonny Rao <sonnyrao@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Tim Murray <timmurray@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: <linux-man@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Git-Commit: bc8bcac991aaa143015c099a0d804f23a21d0c48
Git-Repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
2020-06-18 18:49:33 +05:30
Minchan Kim
306d0c3e29 mm/madvise: support both pid and pidfd for process_madvise
There is a demand[1] to support pid as well pidfd for process_madvise
to reduce unnecessary syscall to get pidfd if the user has control of
the target process (ie, they could guarantee the process is not gone or
pid is not reused).

This patch aims for supporting both options like waitid(2).  So, the
syscall is currently,

        int process_madvise(idtype_t idtype, id_t id, void *addr,
                size_t length, int advice, unsigned long flags);

@which is actually idtype_t for userspace library and currently, it
supports P_PID and P_PIDFD.

[1]  https://lore.kernel.org/linux-mm/9d849087-3359-c4ab-fbec-859e8186c509@virtuozzo.com/.

Change-Id: I06249a7621685e120e548a94098e6cce8d32d38d
Link: http://lkml.kernel.org/r/20200302193630.68771-6-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Suggested-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Christian Brauner <christian@brauner.io>
Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Daniel Colascione <dancol@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: John Dias <joaodias@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oleksandr Natalenko <oleksandr@redhat.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: SeongJae Park <sj38.park@gmail.com>
Cc: SeongJae Park <sjpark@amazon.de>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Sonny Rao <sonnyrao@google.com>
Cc: Tim Murray <timmurray@google.com>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: <linux-man@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Git-Commit: 6c7663468de1b093e8ef5c0ef1df42c890f612bf
Git-Repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
2020-06-18 18:03:25 +05:30
Minchan Kim
805706982d pid: move pidfd_get_pid() to pid.c
process_madvise syscall needs pidfd_get_pid function to translate pidfd to
pid so this patch move the function to kernel/pid.c.

Change-Id: Ie3bfdb29b3fb73a444481739b705ac7eb762d6c2
Link: http://lkml.kernel.org/r/20200302193630.68771-5-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Suggested-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jann Horn <jannh@google.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Daniel Colascione <dancol@google.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: John Dias <joaodias@google.com>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oleksandr Natalenko <oleksandr@redhat.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: SeongJae Park <sj38.park@gmail.com>
Cc: SeongJae Park <sjpark@amazon.de>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Sonny Rao <sonnyrao@google.com>
Cc: Tim Murray <timmurray@google.com>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: <linux-man@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Git-Commit: e54e957dea26d6795d51842a785b8765efff396b
Git-Repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
2020-06-18 18:01:49 +05:30
Minchan Kim
ab3b21e52e mm/madvise: check fatal signal pending of target process
Bail out to prevent unnecessary CPU overhead if target process has pending
fatal signal during (MADV_COLD|MADV_PAGEOUT) operation.

Change-Id: Ic264c3ba5b16c91b6395e5a361a3c47e4fd69256
Link: http://lkml.kernel.org/r/20200302193630.68771-4-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Christian Brauner <christian@brauner.io>
Cc: Daniel Colascione <dancol@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: John Dias <joaodias@google.com>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oleksandr Natalenko <oleksandr@redhat.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: SeongJae Park <sj38.park@gmail.com>
Cc: SeongJae Park <sjpark@amazon.de>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Sonny Rao <sonnyrao@google.com>
Cc: Tim Murray <timmurray@google.com>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: <linux-man@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Git-Commit: d6d0112994a95b14016cc7b2825289999fc1b78c
Git-Repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
2020-06-18 17:56:40 +05:30
Minchan Kim
f4ed73112f mm/madvise: introduce process_madvise() syscall: an external memory hinting API
There is usecase that System Management Software(SMS) want to give a
memory hint like MADV_[COLD|PAGEEOUT] to other processes and in the
case of Android, it is the ActivityManagerService.

The information required to make the reclaim decision is not known to
the app.  Instead, it is known to the centralized userspace
daemon(ActivityManagerService), and that daemon must be able to
initiate reclaim on its own without any app involvement.

To solve the issue, this patch introduces a new syscall
process_madvise(2).  It uses pidfd of an external process to give the
hint.

 int process_madvise(int pidfd, void *addr, size_t length, int advice,
			unsigned long flags);

Since it could affect other process's address range, only privileged
process(CAP_SYS_PTRACE) or something else(e.g., being the same UID)
gives it the right to ptrace the process could use it successfully.
The flag argument is reserved for future use if we need to extend the
API.

I think supporting all hints madvise has/will supported/support to
process_madvise is rather risky.  Because we are not sure all hints
make sense from external process and implementation for the hint may
rely on the caller being in the current context so it could be
error-prone.  Thus, I just limited hints as MADV_[COLD|PAGEOUT] in this
patch.

If someone want to add other hints, we could hear hear the usecase and
review it for each hint.  It's safer for maintenance rather than
introducing a buggy syscall but hard to fix it later.

Q.1 - Why does any external entity have better knowledge?

Quote from Sandeep

"For Android, every application (including the special SystemServer)
are forked from Zygote.  The reason of course is to share as many
libraries and classes between the two as possible to benefit from the
preloading during boot.

After applications start, (almost) all of the APIs end up calling into
this SystemServer process over IPC (binder) and back to the
application.

In a fully running system, the SystemServer monitors every single
process periodically to calculate their PSS / RSS and also decides
which process is "important" to the user for interactivity.

So, because of how these processes start _and_ the fact that the
SystemServer is looping to monitor each process, it does tend to *know*
which address range of the application is not used / useful.

Besides, we can never rely on applications to clean things up
themselves.  We've had the "hey app1, the system is low on memory,
please trim your memory usage down" notifications for a long time[1].
They rely on applications honoring the broadcasts and very few do.

So, if we want to avoid the inevitable killing of the application and
restarting it, some way to be able to tell the OS about unimportant
memory in these applications will be useful.

- ssp

Q.2 - How to guarantee the race(i.e., object validation) between when
giving a hint from an external process and get the hint from the target
process?

process_madvise operates on the target process's address space as it
exists at the instant that process_madvise is called.  If the space
target process can run between the time the process_madvise process
inspects the target process address space and the time that
process_madvise is actually called, process_madvise may operate on
memory regions that the calling process does not expect.  It's the
responsibility of the process calling process_madvise to close this
race condition.  For example, the calling process can suspend the
target process with ptrace, SIGSTOP, or the freezer cgroup so that it
doesn't have an opportunity to change its own address space before
process_madvise is called.  Another option is to operate on memory
regions that the caller knows a priori will be unchanged in the target
process.  Yet another option is to accept the race for certain
process_madvise calls after reasoning that mistargeting will do no
harm.  The suggested API itself does not provide synchronization.  It
also apply other APIs like move_pages, process_vm_write.

The race isn't really a problem though.  Why is it so wrong to require
that callers do their own synchronization in some manner?  Nobody
objects to write(2) merely because it's possible for two processes to
open the same file and clobber each other's writes --- instead, we tell
people to use flock or something.  Think about mmap.  It never
guarantees newly allocated address space is still valid when the user
tries to access it because other threads could unmap the memory right
before.  That's where we need synchronization by using other API or
design from userside.  It shouldn't be part of API itself.  If someone
needs more fine-grained synchronization rather than process level,
there were two ideas suggested - cookie[2] and anon-fd[3].  Both are
applicable via using last reserved argument of the API but I don't
think it's necessary right now since we have already ways to prevent
the race so don't want to add additional complexity with more
fine-grained optimization model.

To make the API extend, it reserved an unsigned long as last argument
so we could support it in future if someone really needs it.

Q.3 - Why doesn't ptrace work?

Injecting an madvise in the target process using ptrace would not work
for us because such injected madvise would have to be executed by the
target process, which means that process would have to be runnable and
that creates the risk of the abovementioned race and hinting a wrong
VMA.  Furthermore, we want to act the hint in caller's context, not the
callee's, because the callee is usually limited in cpuset/cgroups or
even freezed state so they can't act by themselves quick enough, which
causes more thrashing/kill.  It doesn't work if the target process are
ptraced(e.g., strace, debugger, minidump) because a process can have at
most one ptracer.

[1] https://developer.android.com/topic/performance/memory"

[2] process_getinfo for getting the cookie which is updated whenever
    vma of process address layout are changed - Daniel Colascione -
    https://lore.kernel.org/lkml/20190520035254.57579-1-minchan@kernel.org/T/#m7694416fd179b2066a2c62b5b139b14e3894e224

[3] anonymous fd which is used for the object(i.e., address range)
    validation - Michal Hocko -
    https://lore.kernel.org/lkml/20200120112722.GY18451@dhcp22.suse.cz/

Conflicts:
	arch/alpha/kernel/syscalls/syscall.tbl
	arch/arm/tools/syscall.tbl
	arch/arm64/include/asm/unistd.h
	arch/arm64/include/asm/unistd32.h
	arch/ia64/kernel/syscalls/syscall.tbl
	arch/m68k/kernel/syscalls/syscall.tbl
	arch/microblaze/kernel/syscalls/syscall.tbl
	arch/mips/kernel/syscalls/syscall_n32.tbl
	arch/mips/kernel/syscalls/syscall_n64.tbl
	arch/parisc/kernel/syscalls/syscall.tbl
	arch/powerpc/kernel/syscalls/syscall.tbl
	arch/s390/kernel/syscalls/syscall.tbl
	arch/sh/kernel/syscalls/syscall.tbl
	arch/sparc/kernel/syscalls/syscall.tbl
	arch/x86/entry/syscalls/syscall_32.tbl
	arch/x86/entry/syscalls/syscall_64.tbl
	arch/xtensa/kernel/syscalls/syscall.tbl
	include/uapi/asm-generic/unistd.h

Link: http://lkml.kernel.org/r/20200302193630.68771-3-minchan@kernel.org
Link: http://lkml.kernel.org/r/20200508183320.GA125527@google.com
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: Christian Brauner <christian@brauner.io>
Cc: Daniel Colascione <dancol@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: John Dias <joaodias@google.com>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oleksandr Natalenko <oleksandr@redhat.com>
Cc: Sandeep Patil <sspatil@google.com>
Cc: SeongJae Park <sj38.park@gmail.com>
Cc: SeongJae Park <sjpark@amazon.de>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Sonny Rao <sonnyrao@google.com>
Cc: Tim Murray <timmurray@google.com>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: <linux-man@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Git-commit: 8422ccd91057d2814466d90ed05d44b359e88ba9
Git-Repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
[charante@codeaurora.org: Fixed merged conflicts]
Change-Id: I187d2a764db09f0868cd11c7536d7a1ed6a54f3a
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
2020-06-18 17:55:54 +05:30
qctecmdr
60c5922a88 Merge "defconfig: Add UAPI_HEADER_TEST for Lahaina GKI" 2020-06-17 16:48:21 -07:00
qctecmdr
5df03724c4 Merge "scsi: ufs: Dump PA_VS_STATUS_REG1 in eh" 2020-06-17 08:24:01 -07:00
qctecmdr
f50a6e676b Merge "msm: adsprpc: Fix array index underflow problem" 2020-06-17 08:24:00 -07:00
qctecmdr
8e2fab80f7 Merge "soc: qcom: spcom: remove excessive debug prints" 2020-06-17 08:24:00 -07:00
qctecmdr
354981abde Merge "sched/walt: Fix negative count of sched_asym_cpucapacity static key" 2020-06-17 08:24:00 -07:00
qctecmdr
be77d9f54e Merge "tmc-etr: Correct condition for SW USB mode when setup sysfs buf" 2020-06-17 02:00:28 -07:00
qctecmdr
58bcf322e6 Merge "soc: qcom: mem-buf: Treat zero-sized sg-lists as invalid inputs" 2020-06-17 02:00:28 -07:00
qctecmdr
9374a3bfd2 Merge "mm: introduce CONFIG_SPECULATIVE_PAGE_FAULT" 2020-06-17 02:00:28 -07:00
qctecmdr
2791c02ab1 Merge "cpufreq: qcom: Add code to support module removal" 2020-06-17 02:00:27 -07:00
qctecmdr
c28e3da0c2 Merge "scsi: ufs: Fixes line-reset and adapt sequence" 2020-06-17 02:00:27 -07:00
qctecmdr
284f983de3 Merge "ANDROID: net: bpf: permit redirect from ingress L3 to egress L2 devices at near max mtu" 2020-06-17 02:00:27 -07:00
qctecmdr
28e2243144 Merge "drver:soc:llcc_perfmon: qdss clk node control" 2020-06-17 02:00:27 -07:00
qctecmdr
2273336b1f Merge "UPSTREAM: mmc: sdhci-msm: Add CQHCI support for sdhci-msm" 2020-06-17 02:00:26 -07:00
Mohammed Nayeem Ur Rahman
5c50e1787c msm: adsprpc: Fix array index underflow problem
Add check to restrict index underflow.This is to avoid
that it does not access invalid index.

Change-Id: Ib971033c5820ca4dab38ace3b106c7b1b42529e4
Acked-by: Gururaj Chalger <gchalger@qti.qualcomm.com>
Signed-off-by: Mohammed Nayeem Ur Rahman <mohara@codeaurora.org>
2020-06-17 10:54:05 +05:30
Can Guo
20235bca1c scsi: ufs: Dump PA_VS_STATUS_REG1 in eh
Dump PA_VS_STATUS_REG1 when full reset is needed in eh, which is helpful
for error debugging.

Change-Id: Iad3c2fc09c88598428762b5da09e13b46493fc7d
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-06-17 12:50:07 +08:00
Jordan Crouse
589f2a3e90 defconfig: Add UAPI_HEADER_TEST for Lahaina GKI
Enable UAPI_HEADER_TEST in the Lahaina GKI defconfig for UAPI sanity
checks.

Change-Id: Ic0dedbad7cd0782018c8e6f32d4337c6e211a809
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2020-06-16 13:49:34 -07:00
Isaac J. Manjarres
53d312da45 soc: qcom: mem-buf: Treat zero-sized sg-lists as invalid inputs
When unmapping memory in S1, treat zero-sized sg-lists as invalid
inputs.

Change-Id: I477cd0808eea1200873c50470c8b73d9162428e4
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
2020-06-16 10:52:24 -07:00
Konstantin Dorfman
7d39a40e87 soc: qcom: spcom: remove excessive debug prints
This change removes not informative prints.

Change-Id: Ic4c4e6fef752c72082b260b2e34873bd994bc62d
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
2020-06-16 17:37:47 +03:00
Mao Jinlong
969c6ceaf3 tmc-etr: Correct condition for SW USB mode when setup sysfs buf
Correct condition for SW USB mode when setup sysfs buf to fix the issue
that the allocated buffer size is always 32M for memory mode with sw_usb
is enabled.

Change-Id: Id545ecfa21378f49ddeac4c3c3f4fe51f744e69b
Signed-off-by: Mao Jinlong <jinlmao@codeaurora.org>
2020-06-16 16:37:48 +08:00
Pavankumar Kondeti
f6c1bf1f02 sched/walt: Fix negative count of sched_asym_cpucapacity static key
The current code sets per-cpu variable sd_asym_cpucapacity while
building sched domains even when there are no asymmetric CPUs.
This is done to make sure that EAS remains enabled on a b.L system
after hotplugging out all big/LITTLE CPUs. However it is causing
the below warning during CPU hotplug.

[13988.932604] pc : static_key_slow_dec_cpuslocked+0xe8/0x150
[13988.932608] lr : static_key_slow_dec_cpuslocked+0xe8/0x150
[13988.932610] sp : ffffffc010333c00
[13988.932612] x29: ffffffc010333c00 x28: ffffff8138d88088
[13988.932615] x27: 0000000000000000 x26: 0000000000000081
[13988.932618] x25: ffffff80917efc80 x24: ffffffc010333c60
[13988.932621] x23: ffffffd32bf09c58 x22: 0000000000000000
[13988.932623] x21: 0000000000000000 x20: ffffff80917efc80
[13988.932626] x19: ffffffd32bf0a3e0 x18: ffffff8138039c38
[13988.932628] x17: ffffffd32bf2b000 x16: 0000000000000050
[13988.932631] x15: 0000000000000050 x14: 0000000000040000
[13988.932633] x13: 0000000000000178 x12: 0000000000000001
[13988.932636] x11: 16a9ca5426841300 x10: 16a9ca5426841300
[13988.932639] x9 : 16a9ca5426841300 x8 : 16a9ca5426841300
[13988.932641] x7 : 0000000000000000 x6 : ffffff813f4edadb
[13988.932643] x5 : 0000000000000000 x4 : 0000000000000004
[13988.932646] x3 : ffffffc010333880 x2 : ffffffd32a683a2c
[13988.932648] x1 : ffffffd329355498 x0 : 000000000000001b
[13988.932651] Call trace:
[13988.932656]  static_key_slow_dec_cpuslocked+0xe8/0x150
[13988.932660]  partition_sched_domains_locked+0x1f8/0x80c
[13988.932666]  sched_cpu_deactivate+0x9c/0x13c
[13988.932670]  cpuhp_invoke_callback+0x6ac/0xa8c
[13988.932675]  cpuhp_thread_fun+0x158/0x1ac
[13988.932678]  smpboot_thread_fn+0x244/0x3e4
[13988.932681]  kthread+0x168/0x178
[13988.932685]  ret_from_fork+0x10/0x18

The mismatch between increment/decrement of sched_asym_cpucapacity
static key is resulting in the above warning. It is due to
the fact that the increment happens only when the system really
has asymmetric capacity CPUs. This check is done by going through
each CPU capacity. So when system becomes SMP during hotplug,
the increment never happens. However the decrement of this static
key is done when any of the currently online CPU has per-cpu variable
sd_asym_cpucapacity value as non-NULL. Since we always set this
variable, we run into this issue.

Our goal was to enable EAS on SMP. To achieve that enable EAS and
build perf domains (required for compute energy) irrespective
of per-cpu variable sd_asym_cpucapacity value. In this way we
no longer have to enable sched_asym_cpucapacity feature on SMP
to enable EAS.

Change-Id: Id46f2b80350b742c75195ad6939b814d4695eb07
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2020-06-16 08:14:09 +05:30
Pavankumar Kondeti
4e2c7c3979 sched/fair: Depend on sched_asym_cpucapacity for new ilb
We have made the new idle CPU selection for load balance energy
aware. For example, if a silver CPU does not have any misfit
tasks but is overloaded, we have to select a silver CPU not
gold CPU. However, this extra checks are needed only when the
system has asymmetric capacity CPUs. So we should depend on
sched_asym_cpucapacity feature instead of sched_energy_present.
Later patches enable sched_energy_present for SMP systems also.

Change-Id: Ie4fae9d1c17511f15b48b92dd61395d1689e1612
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2020-06-16 08:14:01 +05:30
Asutosh Das
ab3e3b4bed scsi: ufs: Fixes line-reset and adapt sequence
Fix adapt sequence for G4 and don't dump registers
on Line-reset.

Change-Id: Ibbe09d75c1655d2400878305e7b38e7e2f744e52
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
2020-06-15 11:39:09 -07:00
qctecmdr
bbc7f2d3ed Merge "ion: Add support for the display non-secure CMA heap" 2020-06-15 09:59:41 -07:00
qctecmdr
46c87ffa77 Merge "msm: kgsl: Use BW_STEP as 50 for AB voting" 2020-06-15 09:59:40 -07:00
qctecmdr
57af170498 Merge "arm64: enable internal regdb for lahaina" 2020-06-15 09:59:40 -07:00
qctecmdr
0dce8a9d5e Merge "Use data format as unspecified for voice" 2020-06-15 09:59:40 -07:00
Satish Kodishala
30b53d277a Use data format as unspecified for voice
For voice usecases, while opening the slimbus
slave ports, currently data format LPCM(1) is used.
SB master uses data format as unspecified(0). SB master's
data format overwrites the slave side configuration.
In the rare cases, this mismatch may lead to pop sound
in SCO Tx(BT FW->LPASS) at the very beginning when
voice is switched from speaker/handset to BT from call UI.
To fix this, use the data format as unspecified during
opening of the slimbus slave ports for voice cases.

CRs-Fixed: 2710472
Change-Id: Ia9b1d23cbf04d1b8056d7b7f7c84a066437e1682
Signed-off-by: Satish Kodishala <skodisha@codeaurora.org>
2020-06-15 07:12:03 -07:00
Maciej Żenczykowski
705e3783b7 ANDROID: net: bpf: permit redirect from ingress L3 to egress L2 devices at near max mtu
__bpf_skb_max_len(skb) is used from:
  bpf_skb_adjust_room
  __bpf_skb_change_tail
  __bpf_skb_change_head

but in the case of forwarding we're likely calling these functions
during receive processing on ingress and bpf_redirect()'ing at
a later point in time to egress on another interface, thus these
mtu checks are for the wrong device (input instead of output).

This is particularly problematic if we're receiving on an L3 1500 mtu
cellular interface, trying to add an L2 header and forwarding to
an L3 mtu 1500 mtu wifi/ethernet device (which is thus L2 1514).

The mtu check prevents us from adding the 14 byte ethernet header prior
to forwarding the packet.

After the packet has already been redirected, we'd need to add
an additional 2nd ebpf program on the target device's egress tc hook,
but then we'd also see non-redirected traffic and have no easy
way to tell apart normal egress with ethernet header packets
from forwarded ethernet headerless packets.

Link: https://patchwork.ozlabs.org/project/netdev/patch/20200507023606.111650-1-zenczykowski@gmail.com/
But note that a more thorough solution will be pursued.

CRs-Fixed: 2662725
Bug: 149816401
Change-Id: If55a144d7822e23bce85f65897bca7de4e0f9b24
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Git-commit: af2b56c502d697a237757aa36b5d5523b29702fa
Git-repo: https://android.googlesource.com/kernel/common/
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2020-06-15 08:09:10 -06:00
qctecmdr
19a5a7fa3b Merge "iommu: arm-smmu: Add support for new attributes" 2020-06-15 06:15:40 -07:00
qctecmdr
df997bf3be Merge "cnss2: Ignore debugfs non availability during init" 2020-06-15 06:15:39 -07:00
qctecmdr
766387ed99 Merge "power: qti_battery_charger: call power_supply_changed() if fake_soc is set" 2020-06-15 06:15:39 -07:00
qctecmdr
c8bbc5bda6 Merge "msm: kgsl: Enable IFPC on A660 target" 2020-06-15 06:15:39 -07:00
qctecmdr
9a94640833 Merge "lib: stackdepot: Add support to configure STACK_HASH_SIZE" 2020-06-15 06:15:38 -07:00
qctecmdr
da16bbb59f Merge "soc: qcom: mem-buf: Add support for consumers to import dma-bufs" 2020-06-15 06:15:37 -07:00
qctecmdr
514fa165a3 Merge "taskstats: handle NULL nla case in taskstats2" 2020-06-15 02:08:40 -07:00
qctecmdr
3309ec470b Merge "clk: qcom: videocc: Update frequency table of video_cc_mvs0_clk_src" 2020-06-15 02:08:39 -07:00
qctecmdr
1806fc87aa Merge "ABI: Update internal whitelist with debugfs symbols" 2020-06-15 02:08:39 -07:00
qctecmdr
5655d2b2cc Merge "genirq/cpuhotplug: Reduce logging level for couple of prints" 2020-06-15 02:08:39 -07:00
qctecmdr
eac6ffcdf1 Merge "uapi: sound: add support for TTP render mode" 2020-06-15 02:08:38 -07:00
qctecmdr
c122110c39 Merge "build.config: Add build.config files for Lahaina" 2020-06-15 02:08:38 -07:00
qctecmdr
8b9a1aa61f Merge "dma-mapping-fast: reduce TLBI during map" 2020-06-15 02:08:38 -07:00
qctecmdr
1b86a92815 Merge "scsi: ufs-qcom: Remove unnecessary devm_kfree" 2020-06-15 02:08:37 -07:00
Deepak Kumar
04ec9fc196 msm: kgsl: Use BW_STEP as 50 for AB voting
AB voting is done in multiples of BW_STEP. Using a big
BW_STEP can result in AB overvoting because of roundup.
Use BW_STEP as 50 instead of 160. This will reduce AB
overvoting and will improve power.

Change-Id: Ieff338685be9650218fd7accc4ed3bcf0d2756ec
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
2020-06-15 13:03:22 +05:30
qctecmdr
acc5971e09 Merge "mmc: sdhci_msm: keep a reference to the sdhc host instance" 2020-06-14 20:37:55 -07:00