Merge branch 'for_tizen_2.4' into tizen_2.4_dev
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Wed, 18 Nov 2015 09:03:19 +0000 (12:03 +0300)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Wed, 18 Nov 2015 09:03:19 +0000 (12:03 +0300)
Conflicts:
preload/preload_control.c

Change-Id: Ic0455598c0e156f8dd8fbb937c0320a4e472ddb4
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
1  2 
packaging/swap-modules.spec
us_manager/helper.c

@@@ -10,14 -10,26 +10,26 @@@ Source: swap-modules-3.0.tar.g
  BuildRequires: perl
  BuildRequires: python
  %ifarch %{arm}
- BuildRequires: kernel-devel
- %define build_arch arm
- %define kernel_path /usr/src/linux-kernel-build-3.0.101-trats2_defconfig
- %else
- %define build_arch i386
+     %if "%{?tizen_profile_name}" == "tv"
+ BuildConflicts: vd_kernel-headers
+ BuildRequires: tztv-hawk-kmodules-devel
+         %define build_arch arm
+         %define kernel_path /usr/include/kernel_header/debug
+     %else
+         %if "%{?tizen_profile_name}" == "mobile"
+ ExcludeArch: %{arm}
+         %else
+             %if "%{?tizen_profile_name}" == "wearable"
+ ExcludeArch: %{arm}
+             %endif
+         %endif
+     %endif
+ %else #i386
+     %define build_arch i386
  BuildRequires: emulator-kernel-devel
- %define kernel_path /usr/src/linux-kernel-build-3.14.25
    %define kernel_path /usr/src/linux-kernel-build-3.14.25
  %endif
  Provides: swap-modules
  %description
  Kernel modules for SWAP
@@@ -50,7 -62,6 +62,7 @@@ install -m 666 preload/swap_preload.ko 
  install -m 666 fbiprobe/swap_fbiprobe.ko -t %{buildroot}/opt/swap/sdk
  install -m 666 wsp/swap_wsp.ko -t %{buildroot}/opt/swap/sdk
  install -m 666 nsp/swap_nsp.ko -t %{buildroot}/opt/swap/sdk
 +install -m 666 task_ctx/swap_taskctx.ko -t %{buildroot}/opt/swap/sdk
  
  mkdir -p %{buildroot}/usr/share/license
  cp LICENSE.GPL-2.0+ %{buildroot}/usr/share/license/%{name}
@@@ -78,4 -89,3 +90,4 @@@
  /opt/swap/sdk/swap_fbiprobe.ko
  /opt/swap/sdk/swap_wsp.ko
  /opt/swap/sdk/swap_nsp.ko
 +/opt/swap/sdk/swap_taskctx.ko
diff --combined us_manager/helper.c
@@@ -143,6 -143,60 +143,6 @@@ static void unregister_mf(void
  
  
  
 -#ifdef CONFIG_ARM
 -/*
 - ******************************************************************************
 - *                       workaround for already running                       *
 - ******************************************************************************
 - */
 -static unsigned long cb_check_and_install(void *data);
 -
 -static int ctx_task_pre_handler(struct kprobe *p, struct pt_regs *regs)
 -{
 -      int ret;
 -      struct sspt_proc *proc;
 -      struct task_struct *task = current;
 -
 -      if (is_kthread(task) || check_task_on_filters(task) == 0)
 -              return 0;
 -
 -      proc = sspt_proc_get_by_task(task);
 -      if (proc && proc->first_install)
 -              return 0;
 -
 -      ret = set_kjump_cb(regs, cb_check_and_install, NULL, 0);
 -      if (ret < 0)
 -              pr_err("ctx_task_pre_handler: ret=%d\n", ret);
 -
 -      return 0;
 -}
 -
 -static struct kprobe ctx_task_kprobe = {
 -      .pre_handler = ctx_task_pre_handler,
 -};
 -
 -static int register_ctx_task(void)
 -{
 -      int ret = 0;
 -
 -      ret = swap_register_kprobe(&ctx_task_kprobe);
 -      if (ret)
 -              printk(KERN_INFO "swap_register_kprobe(workaround) ret=%d!\n",
 -                     ret);
 -
 -      return ret;
 -}
 -
 -static void unregister_ctx_task(void)
 -{
 -      swap_unregister_kprobe(&ctx_task_kprobe);
 -}
 -#endif /* CONFIG_ARM */
 -
 -
 -
 -
 -
  /*
   ******************************************************************************
   *                              copy_process()                                *
@@@ -153,12 -207,12 +153,12 @@@ static void func_uinst_creare(struct us
        struct hlist_head *head = (struct hlist_head *)data;
        struct uprobe *up;
  
 -      up = probe_info_get_uprobe(ip->info, ip);
 +      up = probe_info_get_uprobe(ip->desc->type, ip);
        if (up) {
                struct uinst_info *uinst;
 -              unsigned long vaddr = (unsigned long)up->kp.addr;
 +              unsigned long vaddr = (unsigned long)up->addr;
  
 -              uinst = uinst_info_create(vaddr, up->kp.opcode);
 +              uinst = uinst_info_create(vaddr, up->opcode);
                if (uinst)
                        hlist_add_head(&uinst->hlist, head);
        }
@@@ -474,18 -528,14 +474,14 @@@ static void msg_unmap(struct sspt_filte
  static void __remove_unmap_probes(struct sspt_proc *proc,
                                  struct unmap_data *umd)
  {
-       struct task_struct *task = proc->task;
        unsigned long start = umd->start;
-       size_t len = PAGE_ALIGN(umd->len);
+       size_t len = umd->len;
        LIST_HEAD(head);
  
        if (sspt_proc_get_files_by_region(proc, &head, start, len)) {
                struct sspt_file *file, *n;
                unsigned long end = start + len;
-               struct msg_unmap_data msg_data = {
-                       .start = start,
-                       .end = end
-               };
+               struct task_struct *task = proc->task;
  
                list_for_each_entry_safe(file, n, &head, list) {
                        if (file->vm_start >= end)
                }
  
                sspt_proc_insert_files(proc, &head);
-               sspt_proc_on_each_filter(proc, msg_unmap, (void *)&msg_data);
        }
  }
  
@@@ -510,9 -558,18 +504,18 @@@ static void remove_unmap_probes(struct 
        sspt_proc_write_lock();
  
        proc = sspt_proc_get_by_task_no_lock(task);
-       if (proc)
+       if (proc) {
+               struct msg_unmap_data msg_data = {
+                       .start = umd->start,
+                       .end = umd->start + umd->len,
+               };
                __remove_unmap_probes(proc, umd);
  
+               /* send unmap region */
+               sspt_proc_on_each_filter(proc, msg_unmap, (void *)&msg_data);
+       }
        sspt_proc_write_unlock();
  }
  
@@@ -525,7 -582,7 +528,7 @@@ static int entry_handler_unmap(struct k
        atomic_inc(&unmap_cnt);
  
        data->start = swap_get_karg(regs, 1);
-       data->len = (size_t)swap_get_karg(regs, 2);
+       data->len = (size_t)PAGE_ALIGN(swap_get_karg(regs, 2));
  
        if (!is_kthread(task) && atomic_read(&stop_flag))
                remove_unmap_probes(task, data);
@@@ -768,8 -825,20 +771,8 @@@ int register_helper(void
        if (ret)
                goto unreg_mmap;
  
 -#ifdef CONFIG_ARM
 -      /* install probe to detect already running process */
 -      ret = register_ctx_task();
 -      if (ret)
 -              goto unreg_mf;
 -#endif /* CONFIG_ARM */
 -
        return ret;
  
 -#ifdef CONFIG_ARM
 -unreg_mf:
 -      unregister_mf();
 -#endif /* CONFIG_ARM */
 -
  unreg_mmap:
        unregister_mmap();
  
@@@ -795,6 -864,9 +798,6 @@@ unreg_comm
   */
  void unregister_helper_top(void)
  {
 -#ifdef CONFIG_ARM
 -      unregister_ctx_task();
 -#endif /* CONFIG_ARM */
        unregister_mf();
        atomic_set(&stop_flag, 1);
  }
@@@ -853,6 -925,13 +856,6 @@@ int once_helper(void
        if (comm_kretprobe.kp.addr == NULL)
                goto not_found;
  
 -#ifdef CONFIG_ARM
 -      sym = "ret_to_user";
 -      ctx_task_kprobe.addr = (kprobe_opcode_t *)swap_ksyms(sym);
 -      if (ctx_task_kprobe.addr == NULL)
 -              goto not_found;
 -#endif /* CONFIG_ARM */
 -
        return 0;
  
  not_found: