aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* cpufreq: Iterate over all the possible cpus to create powerstats.HEADn7.1Ruchi Kandoi2017-04-211-5/+4
| | | | | | | | | | | | | For architectures which support a single policy for multiple cpus, powerstats will not be initalized for all the cores. This change will make sure powerstats is initialized for all the cores. Also minor changes to increase code readability. Bug: 21498425 Change-Id: I938f45e92ff6d5371c32c4d0e37274e6de66769c Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com> (cherry picked from commit 5862c50d1970886b5b5a57b5b52ecfd6feb95ebd)
* cpufreq: Correct the data reported in all_time_in_stateNirmal Abraham2017-04-211-1/+15
| | | | | | | | | | | | | | | | | | | | | Commit bd9474e059bbb2bb62f7e93894cfc3d3ba473fb2 (cpufreq_stats: Adds the fucntionality to load current values for each frequency for all the cores) introduced a change by which 'cpufreq_allstats_create' gets called at initialization (from 'cpufreq_stats_init' instead of 'cpufreq_stat_notifier_policy'). This causes 'cpufreq_allstate_create' to be called before the freq_table is allocated from 'create_all_freq_table'. Due to this, the data for cpu's which are online at boot are not added to the 'all_freq_table' leading to the incorrect reporting of data when the below sysfs command is run - 'cat sys/devices/system/cpu/cpufreq/all_time_in_state'. Correct this behaviour by altering the cpufreq_stats init sequence by which the memory for 'all_freq_table' is allocated before the 'cpufreq_allstats_create' function is called. Change-Id: I2232dacdc0deec4d1987c418e833fe28f74623fc Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
* uid_cputime: Iterates over all the threads instead of processes.Ruchi Kandoi2017-04-211-3/+3
| | | | | | | | | Bug: 22833116 Change-Id: I775a18f61bd2f4df2bec23d01bd49421d0969f87 Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com> Git-commit: 35ef14095795ea331361034a1f7087bdf07f76f7 Git-repo: https://android.googlesource.com/kernel/msm/ Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
* uid_cputime: Avoids double accounting of process stime, utime and cpu_power ↵Ruchi Kandoi2017-04-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | in task exit. This avoids the race where a particular process is terminating and we read the show_uid_stats. At this time since the task_struct still exists and we will account for the terminating process as one of the active task, where as the stats would have been added in the task exit callback. When the task is terminated, the cpu_power for that particular task is added to the terminated tasks. It is possible that before the task releases all the resources, cpu reschedules the task or a timer interrupt is fired. At this point we will try to add the additional time to the process, which will cause the accounting to be skewed. This avoids that race condition. Bug: 22064385 Change-Id: Id2ae04b33fcd230eda9683a41b6019d4dd8f5d85 Signed-off-by: Jin Qian <jinqian@google.com> Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com> Git-commit: 344377047daa5832ef798af697adee388e367d57 Git-repo: https://android.googlesource.com/kernel/msm/ Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
* sched: cpufreq: Adds a field cpu_power in the task_structRuchi Kandoi2017-04-213-5/+19
| | | | | | | | | | | | | | | cpu_power has been added to keep track of amount of power each task is consuming. cpu_power is updated whenever stime and utime are updated for a task. power is computed by taking into account the frequency at which the current core was running and the current for cpu actively running at hat frequency. Bug: 21498425 Change-Id: Ic535941e7b339aab5cae9081a34049daeb44b248 Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com> Git-commit: 94877641f6b6ea17aa335729f548eb5647db3e3e Git-repo: https://android.googlesource.com/kernel/msm/ Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
* cpufreq_stats: Adds the fucntionality to load current values for each ↵Ruchi Kandoi2017-04-211-46/+154
| | | | | | | | | | | | | | | frequency for all the cores. The current values for the cpu cores needs to be added to the device tree for this functionaly to work. It loads the current values for each frequecy in uA for all the cores. Bug: 21498425 Change-Id: If03311aaeb3e4c09375dd0beb9ad4fbb254b5c08 Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com> Git-commit: 744a20b3a12e29a4c2b32005fe1b030cecd267e5 Git-repo: https://android.googlesource.com/kernel/msm/ Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
* cpufreq: Avoid using global variable total_cpusRuchi Kandoi2017-04-211-4/+4
| | | | | | | | | | | | | The change is to compile on kernels where cpufreq stats are compiled as a module (CONFIG_CPU_FREQ_STAT=m), because total_cpus is not exported for module use. Reported-By: Emilio López <elopez93@gmail.com> Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com> Change-Id: I4f3c74f0fac5e8d9449655b26bf3b407b0fe4290 Git-commit: c8468201e5509fd4a942247d32d07904e15a57df Git-repo: https://android.googlesource.com/kernel/msm/ Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
* cpufreq: fix sleeping in atomic context when realloc freq_table for ↵Minsung Kim2017-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | all_time_in_state Commit 40cf2f8 (cpufreq: Persist cpufreq time in state data across hotplug) causes the following call trace to be spit on boot: BUG: sleeping function called from invalid context at mm/slub.c:936 in_atomic(): 1, irqs_disabled(): 0, pid: 1, name: swapper/0 CPU: 6 PID: 1 Comm: swapper/0 Not tainted 3.10.9-20140624.172707-eng-gd6c0f69-dirty #50 Backtrace: [<c0012270>] (dump_backtrace+0x0/0x10c) from [<c001256c>] (show_stack+0x18/0x1c) r6:ffff1788 r5:c0c020c0 r4:e609c000 r3:00000000 [<c0012554>] (show_stack+0x0/0x1c) from [<c07a2970>] (dump_stack+0x20/0x28) [<c07a2950>] (dump_stack+0x0/0x28) from [<c0057678>] (__might_sleep+0x104/0x120) [<c0057574>] (__might_sleep+0x0/0x120) from [<c00ff000>] (__kmalloc_track_caller+0x144/0x274) r6:00000000 r5:e609c000 r4:e6802140 [<c00feebc>] (__kmalloc_track_caller+0x0/0x274) from [<c00da098>] (krealloc+0x58/0xb0) [<c00da040>] (krealloc+0x0/0xb0) from [<c050266c>] (cpufreq_allstats_create+0x120/0x204) r8:e4c4ff00 r7:c0d266b8 r6:0013d620 r5:e4c4e600 r4:00000001 r3:e535d6d0 [<c050254c>] (cpufreq_allstats_create+0x0/0x204) from [<c0502e38>] (cpufreq_stat_notifier_policy+0xb8/0xd0) [<c0502d80>] (cpufreq_stat_notifier_policy+0x0/0xd0) from [<c00517cc>] (notifier_call_chain+0x4c/0x8c) r5:00000000 r4:fffffffe [<c0051780>] (notifier_call_chain+0x0/0x8c) from [<c00519fc>] (__blocking_notifier_call_chain+0x50/0x68) r8:c0cd4d00 r7:00000002 r6:e609dd7c r5:ffffffff r4:c0d25a4c r3:ffffffff [<c00519ac>] (__blocking_notifier_call_chain+0x0/0x68) from [<c0051a34>] (blocking_notifier_call_chain+0x20/0x28) r7:c0e24f30 r6:00000000 r5:e53e1e00 r4:e609dd7c [<c0051a14>] (blocking_notifier_call_chain+0x0/0x28) from [<c0500fec>] (__cpufreq_set_policy+0xc0/0x1d0) [<c0500f2c>] (__cpufreq_set_policy+0x0/0x1d0) from [<c0501308>] (cpufreq_add_dev_interface+0x20c/0x270) r7:00000008 r6:00000000 r5:e53e1e00 r4:e53e1e58 [<c05010fc>] (cpufreq_add_dev_interface+0x0/0x270) from [<c05016a8>] (cpufreq_add_dev+0x33c/0x420) [<c050136c>] (cpufreq_add_dev+0x0/0x420) from [<c03604a4>] (subsys_interface_register+0x80/0xbc) [<c0360424>] (subsys_interface_register+0x0/0xbc) from [<c050035c>] (cpufreq_register_driver+0x8c/0x194) Change-Id: If77a656d0ea60a8fc4083283d104509fa6c07f8f Signed-off-by: Minsung Kim <ms925.kim@samsung.com> Git-commit: d7052164059dd0447cc8f00a2692161a81644417 Git-repo: https://android.googlesource.com/kernel/msm/ Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
* cpufreq: Persist cpufreq time in state data across hotplugRuchi Kandoi2017-04-211-97/+171
| | | | | | | | | | | | Cpufreq time_in_state data for all CPUs is made persistent across hotplug and exposed to userspace via sysfs file /sys/devices/system/cpu/cpufreq/all_time_in_state Change-Id: I97cb5de24b6de16189bf8b5df9592d0a6e6ddf32 Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com> Git-commit: 0d6bea9ad183eb8a6565a2124eb6081480ccaf0e Git-repo: https://android.googlesource.com/kernel/msm/ Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
* kgsl: convert some workqueues to use kthreadsTim Murray2017-04-175-9/+26
| | | | | | | | | | | adreno_dispatch_work and _kgsl_event_worker are both low-latency low-runtime functions that are in the critical path of GPU rendering. Moving them out of workqueues and into a dedicated FIFO kthread avoids significant jitter. bug 30342017 Change-Id: I5feb4e829064d422b4b9af2acb449afd1f981899
* cpufreq: interactive: Use wake_up_process_no_notif to wake up tasksJunjie Wu2017-04-171-3/+3
| | | | | | | | | | | | Scheduler could send a notification to governor each time a task wakes up. If governor wakes up another task as a response to such a notification, it could result in endless recursive notifications. Use wake_up_process_no_notif to ensure scheduler won't send another notification for speedchange task woken up by the governor. Change-Id: I697affcbdf79e2ad0cfe843eb880d304960682f4 Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
* FROMLIST: defconfig: msm: Disable CONFIG_CP_ACCESS64Bruce Levy2017-04-071-1/+0
| | | | | | | | | | | | | | Disable the cpaccess64 driver. This driver allows user space access to cpu registers. With this driver enabled, a CTS test causes the system to crash. CRs-Fixed: 968777 Bug: 32068683 Change-Id: I3ebe7220c7ca68a25b781c2e836a735d11dcaf08 Signed-off-by: Bruce Levy <blevy@codeaurora.org> Signed-off-by: Siqi Lin <siqilin@google.com> (am from https://source.codeaurora.org/quic/la/kernel/msm-3.18/commit/?h=LA.HB.0.3&id=452d2ad331d20b19e8a0768c4b6e7fe1b65abe8f)
* seed: config: enable CONFIG_CRYPTO_SHA512Lorenzo Colitti2017-04-071-0/+1
| | | | | Bug: 28279646 Change-Id: I49487db3da28cf15174d9bc0c7aedea5b698492b
* Merge tag 'android-7.1.1_r0.52' of ↵Arvin Quilao2017-04-0611-28/+160
|\ | | | | | | | | | | https://android.googlesource.com/kernel/msm into cm-14.1 Android 7.1.1 Release 0.52 (N4F26W,seed)
| * qcrypto: protect potential integer overflow.Ariel Yin2017-02-141-0/+6
| | | | | | | | | | | | | | | | | | | | Adding user passed parameters without check might lead to Integer overflow and unpredictable system behaviour. Change-Id: Iaf8259e3c4a157e1790f1447b1b62a646988b7c4 Signed-off-by: Neeraj Soni <neersoni@codeaurora.org> Bug: 34389927
| * ANDROID: ion: Protect kref from userspace manipulationAriel Yin2017-02-141-7/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This separates the kref for ion handles into two components. Userspace requests through the ioctl will hold at most one reference to the internally used kref. All additional requests will increment a separate counter, and the original reference is only put once that counter hits 0. This protects the kernel from a poorly behaving userspace. Bug: 34276203 Change-Id: Ibc36bc4405788ed0fea7337b541cad3be2b934c0 Signed-off-by: Daniel Rosenberg <drosen@google.com>
| * qcacld-2.0: Fix buffer overflow in WLANSAP_Set_WPARSNIes()Ariel Yin2017-02-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently In WLANSAP_Set_WPARSNIes() the parameter WPARSNIEsLen is user-controllable and never validates which uses as the length for a memory copy. This enables user-space applications to corrupt heap memory and potentially crash the kernel. Fix is to validate the WPARSNIes length to its max before use as the length for a memory copy. Change-Id: I7aff731aeae22bfd84beb955439a799abef37f68 CRs-Fixed: 1102648 Bug: 32086742 Signed-off-by: Srinivas Girigowda <sgirigow@codeaurora.org>
| * sdcardfs: limit stacking depthAndrew Chant2017-02-141-0/+7
| | | | | | | | | | | | | | | | Limit filesystem stacking to prevent stack overflow. Bug: 32761463 Change-Id: I8b1462b9c0d6c7f00cf110724ffb17e7f307c51e Signed-off-by: Andrew Chant <achant@google.com>
| * UPSTREAM: udp: properly support MSG_PEEK with truncated buffersAriel Yin2017-02-142-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 197c949e7798fbf28cfadc69d9ca0c2abbf93191 upstream. Backport of this upstream commit into stable kernels : 89c22d8c3b27 ("net: Fix skb csum races when peeking") exposed a bug in udp stack vs MSG_PEEK support, when user provides a buffer smaller than skb payload. In this case, skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); returns -EFAULT. This bug does not happen in upstream kernels since Al Viro did a great job to replace this into : skb_copy_and_csum_datagram_msg(skb,sizeof(struct udphdr), msg); This variant is safe vs short buffers. For the time being, instead reverting Herbert Xu patch and add back skb->ip_summed invalid changes, simply store the result of udp_lib_checksum_complete() so that we avoid computing the checksum a second time, and avoid the problematic skb_copy_and_csum_datagram_iovec() call. This patch can be applied on recent kernels as it avoids a double checksumming, then backported to stable kernels as a bug fix. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net> [ luis: backported to 3.16: adjusted context ] Signed-off-by: Luis Henriques <luis.henriques@canonical.com> Signed-off-by: Charles (Chas) Williams <ciwillia@brocade.com> Signed-off-by: Willy Tarreau <w@1wt.eu> (cherry picked from commit 98f57e42cab062608cf3dce2b8eecbb2a0780ac4) Bug: 32813456 Change-Id: I0ed569f72b2caf368c4413ac565073ff17492ea8
| * msm: mdss: Correct the format specifiers in sscanf functionAriel Yin2017-02-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | In many parts of the code the sscanf function was getting an unsigned integer with a wrong format specifier. Changed the format specifiers appropriately. Single variable sscanf were replaced by kstrtouint at reported places. CRs-Fixed: 1024872 Bug: 34386696 Change-Id: I03ce718b0456d437d31d701586965d0aa7443b51 Signed-off-by: Shalini Krishnamoorthi <shakri@codeaurora.org>
| * crypto: msm: check integer overflow on total data len in qcedev.cAriel Yin2017-02-141-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | qcedev_vbuf_ablk_cipher will calculate total data length. It starts with the value of "areq->cipher_op_req.byteoffset", which is controlled by the user. Make change to check if this total data length has integer overflow issue in qcedev_check_cipher_params. Bug: 33544431 CRs-Fixed: 1103089 Change-Id: Ice42dca6d47eb8febfe8a34e566c69e4799fab57 Signed-off-by: Zhen Kong <zkong@codeaurora.org> Signed-off-by: Biswajit Paul <biswajitpaul@codeaurora.org>
| * platform: msm: spmi: Fix possible race condition in debugfsAriel Yin2017-02-141-9/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | There is a possible race condition when debugfs files are concurrently accessed by multiple threads. Fix this. Bug: 33644454 Bug: 33644474 Bug: 33644710 CRs-Fixed: 1106842 Change-Id: Ifd092143f428db3cf73c45ec4f0aaa96318ae165 Signed-off-by: ansharma <ansharma@codeaurora.org> Signed-off-by: Biswajit Paul <biswajitpaul@codeaurora.org>
| * FROMLIST: defconfig: msm: Disable CONFIG_CP_ACCESS64Bruce Levy2017-02-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable the cpaccess64 driver. This driver allows user space access to cpu registers. With this driver enabled, a CTS test causes the system to crash. CRs-Fixed: 968777 Bug: 32068683 Change-Id: I3ebe7220c7ca68a25b781c2e836a735d11dcaf08 Signed-off-by: Bruce Levy <blevy@codeaurora.org> Signed-off-by: Siqi Lin <siqilin@google.com> (am from https://source.codeaurora.org/quic/la/kernel/msm-3.18/commit/?h=LA.HB.0.3&id=452d2ad331d20b19e8a0768c4b6e7fe1b65abe8f)
| * ASoC: msm: qdsp6v2: Fix out-of-bounds access in put functionsAriel Yin2017-02-131-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | Add out of bounds check in routing put functions for the mux value before accessing the texts pointer of soc_enum struct with mux as index. CRs-fixed: 1097569 Bug: 33649808 Change-Id: Ib9ef8d398f0765754b0f79666963fac043b66077 Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org> Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
| * seed: config: enable CONFIG_CRYPTO_SHA512Lorenzo Colitti2017-01-201-0/+1
| | | | | | | | | | Bug: 28279646 Change-Id: I693d17fe65acca6962cc0f848c351673037c1319
* | sched: Fix bug in average nr_running and nr_iowait calculationSrivatsa Vaddagiri2017-03-164-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sched_get_nr_running_avg() returns average nr_running and nr_iowait task count since it was last invoked. Fix several bugs in their calculation. * sched_update_nr_prod() needs to consider that nr_running count can change by more than 1 when CFS_BANDWIDTH feature is used * sched_get_nr_running_avg() needs to sum up nr_iowait count across all cpus, rather than just one * sched_get_nr_running_avg() could race with sched_update_nr_prod(), as a result of which it could use curr_time which is behind a cpu's 'last_time' value. That would lead to erroneous calculation of average nr_running or nr_iowait. While at it, fix also a bug in BUG_ON() check in sched_update_nr_prod() function and remove unnecessary nr_running argument to sched_update_nr_prod() function. Change-Id: I46737614737292fae0d7204c4648fb9b862f65b2 Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
* | sched: Provide a wake up API without sending freq notificationsJunjie Wu2017-03-163-5/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each time a task wakes up, scheduler evaluates its load and notifies governor if the resulting frequency of destination CPU is larger than a threshold. However, some governor wakes up a separate task that handles frequency change, which again calls wake_up_process(). This is dangerous because if the task being woken up meets the threshold and ends up being moved around, there is a potential for endless recursive notifications. Introduce a new API for waking up a task without triggering frequency notification. Change-Id: I24261af81b7dc410c7fb01eaa90920b8d66fbd2a Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
* | seed: Disable overlayfsArvin Quilao2017-03-071-1/+1
| | | | | | | | Change-Id: I1868be936fc8e1cf2021ccd35c67458d3eca2a9f
* | tracing: power: Add trace events for core controlJunjie Wu2017-03-072-1/+46
| | | | | | | | | | | | | | Add trace events for core control module. Change-Id: I36da5381709f81ef1ba82025cd9cf8610edef3fc Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
* | config: Enable core controlArvin Quilao2017-03-071-0/+1
| | | | | | | | Change-Id: Ic96bae1c82ae3e7be92b5926fbb9c501ae51ce39
* | sched: Keep track of average nr_big_tasksSrivatsa Vaddagiri2017-03-075-8/+76
| | | | | | | | | | | | | | | | | | | | | | | | Extend sched_get_nr_running_avg() API to return average nr_big_tasks, in addition to average nr_running and average nr_io_wait tasks. Also add a new trace point to record values returned by sched_get_nr_running_avg() API. Change-Id: Id3591e6d04da8db484b4d1cb9d95dba075f5ab9a Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org> [rameezmustafa@codeaurora.org: Resolve trivial merge conflicts] Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
* | core_ctl: Manage number of online cores based on system loadPavankumar Kondeti2017-03-073-0/+1095
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The core_ctl module takes input from userspace and CPU load information to decide how many CPUs to keep online. User space has the following tunables: - min_cpus: Minimum number of CPUs to keep online. This overrides other heuristics. - max_cpus: Maximum number of CPUs to keep online. This overrides other heuristics. - additional_cpus: Additional idle CPUs to keep ready for use. - busy_up_thres: The normalized load% threshold that the CPU load should exceeded for the CPU to be go from not busy to busy. It could be a single threshold for all CPUs in a group, or num_cpus thresholds separated by spaces to specify different thresholds based on the current number of online CPUs. - busy_down_thres: The normalized load% threshold that the CPU load should be lower than for the CPU to go from busy to not busy. It could be a single threshold for all CPUs in a group, or num_cpus thresholds separated by spaces to specify different thresholds based on the current number of online CPUs. - offline_delay_ms: The time to wait for before offline cores when the number of needed CPUs goes down. Mot-CRs-fixed: (CR) Change-Id: Ied1d5bcbb8da5bbd5f3d1a3f042599babace6b65 Signed-off-by: Saravana Kannan <skannan@codeaurora.org> Signed-off-by: Junjie Wu <junjiew@codeaurora.org> Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Ravi Chebolu <arc095@motorola.com> Reviewed-on: http://gerrit.mot.com/866560 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver <sltawvr@motorola.com> Tested-by: Jira Key <jirakey@motorola.com> Reviewed-by: Lian-Wei Wang <lian-wei.wang@motorola.com> Reviewed-by: Christopher Fries <cfries@motorola.com> Submit-Approved: Jira Key <jirakey@motorola.com>
* | qcom: core_ctl: Add support functions for core_ctlBryan Huntsman2017-03-074-0/+96
| | | | | | | | | | | | | | | | Add support functions for core control driver. Also introduce Kconfig for enabling core_ctl. Change-Id: Ic127b6ed7d9450338883b13d9c42abfe49ff8b35 Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
* | ANDROID: vfs: Missed updating truncate to truncate2Daniel Rosenberg2017-03-071-1/+1
| | | | | | | | | | | | Bug: 30954918 Change-Id: I8163d3f86dd7aadb2ab3fc11816754f331986f05 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* | BACKPORT: smarter propagate_mnt()Al Viro2017-03-074-77/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current mainline has copies propagated to *all* nodes, then tears down the copies we made for nodes that do not contain counterparts of the desired mountpoint. That sets the right propagation graph for the copies (at teardown time we move the slaves of removed node to a surviving peer or directly to master), but we end up paying a fairly steep price in useless allocations. It's fairly easy to create a situation where N calls of mount(2) create exactly N bindings, with O(N^2) vfsmounts allocated and freed in process. Fortunately, it is possible to avoid those allocations/freeings. The trick is to create copies in the right order and find which one would've eventually become a master with the current algorithm. It turns out to be possible in O(nodes getting propagation) time and with no extra allocations at all. One part is that we need to make sure that eventual master will be created before its slaves, so we need to walk the propagation tree in a different order - by peer groups. And iterate through the peers before dealing with the next group. Another thing is finding the (earlier) copy that will be a master of one we are about to create; to do that we are (temporary) marking the masters of mountpoints we are attaching the copies to. Either we are in a peer of the last mountpoint we'd dealt with, or we have the following situation: we are attaching to mountpoint M, the last copy S_0 had been attached to M_0 and there are sequences S_0...S_n, M_0...M_n such that S_{i+1} is a master of S_{i}, S_{i} mounted on M{i} and we need to create a slave of the first S_{k} such that M is getting propagation from M_{k}. It means that the master of M_{k} will be among the sequence of masters of M. On the other hand, the nearest marked node in that sequence will either be the master of M_{k} or the master of M_{k-1} (the latter - in the case if M_{k-1} is a slave of something M gets propagation from, but in a wrong peer group). So we go through the sequence of masters of M until we find a marked one (P). Let N be the one before it. Then we go through the sequence of masters of S_0 until we find one (say, S) mounted on a node D that has P as master and check if D is a peer of N. If it is, S will be the master of new copy, if not - the master of S will be. That's it for the hard part; the rest is fairly simple. Iterator is in next_group(), handling of one prospective mountpoint is propagate_one(). It seems to survive all tests and gives a noticably better performance than the current mainline for setups that are seriously using shared subtrees. Change-Id: I45648e8a405544f768c5956711bdbdf509e2705a Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | BACKPORT: don't bother with propagate_mnt() unless the target is sharedAl Viro2017-03-071-10/+7
| | | | | | | | | | | | | | | | | | | | If the dest_mnt is not shared, propagate_mnt() does nothing - there's no mounts to propagate to and thus no copies to create. Might as well don't bother calling it in that case. Change-Id: Id94af8ad288bf9bfc6ffb5570562bbc2dc2e0d87 Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | ANDROID: mnt: remount should propagate to slaves of slavesDaniel Rosenberg2017-03-072-7/+22
| | | | | | | | | | | | | | | | | | | | propagate_remount was not accounting for the slave mounts of other slave mounts, leading to some namespaces not recieving the remount information. Signed-off-by: Daniel Rosenberg <drosen@google.com> Bug: 33731928 Change-Id: Idc9e8c2ed126a4143229fc23f10a959c2d0a3854
* | ANDROID: sdcardfs: Don't bother deleting freelistDaniel Rosenberg2017-03-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no point deleting entries from dlist, as that is a temporary list on the stack from which contains only entries that are being deleted. Not all code paths set up dlist, so those that don't were performing invalid accesses in hash_del_rcu. As an additional means to prevent any other issue, we null out the list entries when we allocate from the cache. Signed-off-by: Daniel Rosenberg <drosen@google.com> Bug: 35666680 Change-Id: Ibb1e28c08c3a600c29418d39ba1c0f3db3bf31e5
* | ANDROID: sdcardfs: support direct-IO (DIO) operationsDaniel Rosenberg2017-03-072-17/+5
| | | | | | | | | | | | | | | | | | | | | | This comes from the wrapfs patch 2e346c83b26e Wrapfs: support direct-IO (DIO) operations Signed-off-by: Li Mengyang <li.mengyang@stonybrook.edu> Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu> Signed-off-by: Daniel Rosenberg <drosen@google.com> Bug: 34133558 Change-Id: I3fd779c510ab70d56b1d918f99c20421b524cdc4
* | ANDROID: sdcardfs: implement vm_ops->page_mkwriteDaniel Rosenberg2017-03-071-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | This comes from the wrapfs patch 3dfec0ffe5e2 Wrapfs: implement vm_ops->page_mkwrite Some file systems (e.g., ext4) require it. Reported by Ted Ts'o. Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu> Signed-off-by: Daniel Rosenberg <drosen@google.com> Bug: 34133558 Change-Id: I1a389b2422c654a6d3046bb8ec3e20511aebfa8e
* | ANDROID: sdcardfs: Add missing path_putDaniel Rosenberg2017-03-071-0/+1
| | | | | | | | | | | | | | | | | | | | "ANDROID: sdcardfs: Add GID Derivation to sdcardfs" introduced an unbalanced pat_get, leading to storage space not being freed after deleting a file until rebooting. This adds the missing path_put. Signed-off-by: Daniel Rosenberg <drosen@google.com> Bug: 34691169 Change-Id: Ia7ef97ec2eca2c555cc06b235715635afc87940e
* | ANDROID: sdcardfs: Fix incorrect hashDaniel Rosenberg2017-03-071-2/+6
| | | | | | | | | | | | | | | | | | This adds back the hash calculation removed as part of the previous patch, as it is in fact necessary. Signed-off-by: Daniel Rosenberg <drosen@google.com> Bug: 35307857 Change-Id: Ie607332bcf2c5d2efdf924e4060ef3f576bf25dc
* | ANDROID: sdcardfs: Switch strcasecmp for internal callDaniel Rosenberg2017-03-076-58/+78
| | | | | | | | | | | | | | | | | | This moves our uses of strcasecmp over to an internal call so we can easily change implementations later if we so desire. Additionally, we leverage qstr's where appropriate to save time on comparisons. Change-Id: I32fdc4fd0cd3b7b735dcfd82f60a2516fd8272a5 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* | ANDROID: sdcardfs: switch to full_name_hash and qstrDaniel Rosenberg2017-03-071-81/+108
| | | | | | | | | | | | | | | | | | Use the kernel's string hash function instead of rolling our own. Additionally, save a bit of calculation by using the qstr struct in place of strings. Change-Id: I0bbeb5ec2a9233f40135ad632e6f22c30ffa95c1 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* | ANDROID: sdcardfs: Add GID Derivation to sdcardfsDaniel Rosenberg2017-03-077-60/+429
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes sdcardfs to modify the user and group in the underlying filesystem depending on its usage. Ownership is set by Android user, and package, as well as if the file is under obb or cache. Other files can be labeled by extension. Those values are set via the configfs interace. To add an entry, mkdir -p [configfs root]/sdcardfs/extensions/[gid]/[ext] Bug: 34262585 Change-Id: I4e030ce84f094a678376349b1a96923e5076a0f4 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* | ANDROID: sdcardfs: Remove redundant operationDaniel Rosenberg2017-03-071-11/+0
| | | | | | | | | | | | | | | | We call get_derived_permission_new unconditionally, so we don't need to call update_derived_permission_lock, which does the same thing. Change-Id: I0748100828c6af806da807241a33bf42be614935 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* | ANDROID: sdcardfs: add support for user permission isolationDaniel Rosenberg2017-03-073-40/+284
| | | | | | | | | | | | | | | | | | | | | | This allows you to hide the existence of a package from a user by adding them to an exclude list. If a user creates that package's folder and is on the exclude list, they will not see that package's id. Bug: 34542611 Change-Id: I9eb82e0bf2457d7eb81ee56153b9c7d2f6646323 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* | ANDROID: sdcardfs: Refactor configfs interfaceDaniel Rosenberg2017-03-071-80/+76
| | | | | | | | | | | | | | | | | | | | This refactors the configfs code to be more easily extended. It will allow additional files to be added easily. Bug: 34542611 Bug: 34262585 Change-Id: I73c9b0ae5ca7eb27f4ebef3e6807f088b512d539 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* | ANDROID: sdcardfs: Allow non-owners to touchDaniel Rosenberg2017-03-071-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This modifies the permission checks in setattr to allow for non-owners to modify the timestamp of files to things other than the current time. This still requires write access, as enforced by the permission call, but relaxes the requirement that the caller must be the owner, allowing those with group permissions to change it as well. Bug: 11118565 Change-Id: Ied31f0cce2797675c7ef179eeb4e088185adcbad Signed-off-by: Daniel Rosenberg <drosen@google.com>
* | constify ->actorAl Viro2017-03-078-51/+5
| | | | | | | | | | | | | | | | Change-Id: I75fcba66a9839c3be8dc11ced25105c87ac4ee65 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Git-commit: b2497fc3057ae27db9aa29579f16ae5afb6d6d08 Git-repo: https://android.googlesource.com/kernel/common.git Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>