Move kernel module to separate git repository 40/213640/1 accepted/tizen/unified/20190917.034018 submit/tizen/20190910.085724 submit/tizen/20190917.043237
authorKonrad Kuchciak <k.kuchciak@samsung.com>
Mon, 9 Sep 2019 10:19:13 +0000 (12:19 +0200)
committerKonrad Kuchciak <k.kuchciak@samsung.com>
Mon, 9 Sep 2019 11:03:02 +0000 (13:03 +0200)
Moved to: /platform/core/system/stability-monitor-kmod-rpi3

Change-Id: Icd60617780e1d4129faa04ded38da9406a8bdaf4

kernel/Makefile [deleted file]
kernel/proc-tsm.c [deleted file]
packaging/stability-monitor-kmod-rpi3.spec [deleted file]

diff --git a/kernel/Makefile b/kernel/Makefile
deleted file mode 100644 (file)
index 99f0f73..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-PWD := $(shell pwd)
-LD = ld
-
-obj-m += proc-tsm.o
-proc-tsm_SOURCES = proc-tsm.c
-
-all:
-       make -C $(KERNELDIR) M=$(PWD) modules
-
-clean:
-       make -C $(KERNELDIR) M=$(PWD) clean
diff --git a/kernel/proc-tsm.c b/kernel/proc-tsm.c
deleted file mode 100644 (file)
index cd22d0c..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * This file is part of stability-monitor
- * 
- * Copyright © 2019 Samsung Electronics
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-
-#include <linux/fs.h>
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-#include <linux/sched.h>
-#include <linux/sched/signal.h>
-#include <linux/sched/cputime.h>
-#include <linux/mm.h>
-#include <linux/pid_namespace.h>
-#include <asm/uaccess.h>
-#include <linux/time.h>
-#include <linux/posix-timers.h>
-#include <linux/kernel_stat.h>
-#include <linux/fdtable.h>
-#include <linux/math64.h>
-#include <linux/task_io_accounting_ops.h>
-
-#define DEBUG 0
-#define PAGE_TO_KB(x) ((x) << (PAGE_SHIFT - 10))
-
-static struct proc_dir_entry* proc_file;
-
-
-static u64 time_now(void)
-{
-    return div64_ul(ktime_get_boot_ns(), NSEC_PER_USEC);
-}
-
-static inline u64 cputime_to_usecs(const u64 cputime)
-{
-    // return cputime >> 12;
-    return div64_ul(cputime, NSEC_PER_USEC);
-}
-
-static unsigned int count_open_files(struct files_struct *files)
-{
-    unsigned int open_files = 0;
-    int i;
-    struct fdtable *fdt;
-
-    if (!files)
-        return 0;
-
-    spin_lock(&files->file_lock);
-    fdt = files_fdtable(files);
-
-    /* Find the last non zero cell in open fds array */
-    for (i = fdt->max_fds / BITS_PER_LONG - 1; i >= 0; i--) {
-        if (fdt->open_fds[i])
-            break;
-    }
-
-    /* Count set bits */
-    for (i = (i + 1) * BITS_PER_LONG - 1; i >= 0; i--) {
-        if(test_bit(i, fdt->open_fds))
-            open_files++;
-    }
-
-    spin_unlock(&files->file_lock);
-    return open_files;
-}
-
-static int stability_monitor_show(struct seq_file *m, void *v)
-{
-    struct sysinfo info;
-    struct task_struct *task, *t;
-    struct pid *pid = NULL;
-    pid_t ppid = 0;
-    u64 uptime, utime, stime, ut, st;
-    unsigned long long vm_rss, total_ram;
-    struct task_io_accounting task_ioac;
-    unsigned int open_fds;
-
-    rcu_read_lock();
-
-    /* Uptime in us */
-    uptime = time_now();
-
-    /* Memory info */
-    si_meminfo(&info);
-    total_ram = PAGE_TO_KB(info.totalram);
-
-    seq_put_decimal_ull(m, "", uptime);
-    seq_put_decimal_ull(m, " ", total_ram);
-    seq_printf(m, "\n");
-
-    for_each_process(task) {
-        ppid = task->real_parent->pid;
-        pid = task_pgrp(task);
-        if (!pid)
-            continue;
-
-        task_lock(task);
-
-        if (!task->mm) {
-            task_unlock(task);
-            continue;
-        }
-
-        if (task->flags & (PF_DUMPCORE|PF_SIGNALED|PF_EXITING)) {
-            task_unlock(task);
-            continue;
-        }
-
-
-        /* Memory */
-        vm_rss = get_mm_rss(task->mm);
-
-        /* Open FDs */
-        open_fds = count_open_files(task->files);
-
-        /* CPU time + IO accounting */
-        task_cputime_adjusted(task, &utime, &stime);
-        task_ioac = task->ioac;
-        t = task;
-        while_each_thread(task, t) {
-            task_cputime_adjusted(t, &ut, &st);
-            utime += ut;
-            stime += st;
-            task_io_accounting_add(&task_ioac, &t->ioac);
-        }
-
-        task_unlock(task);
-
-        seq_put_decimal_ll(m, "", task->pid);
-        seq_put_decimal_ll(m, " ", ppid);
-        seq_put_decimal_ull(m, " ", cputime_to_usecs(utime + stime));
-        seq_put_decimal_ull(m, " ", PAGE_TO_KB(vm_rss));
-        seq_put_decimal_ll(m, " ", open_fds);
-        seq_put_decimal_ull(m, " ", task_ioac.read_bytes + task_ioac.write_bytes);
-        seq_printf(m, "\n");
-    }
-
-    rcu_read_unlock();
-
-#if DEBUG
-    printk(KERN_DEBUG "stability_monitor_show() took %llu us\n", time_now() - uptime);
-#endif
-
-    return 0;
-}
-
-static int stability_monitor_open(struct inode *inode, struct file *file)
-{
-    return single_open_size(file, stability_monitor_show, NULL, 8192);
-}
-
-static const struct file_operations stability_monitor_fops = {
-    .owner     = THIS_MODULE,
-    .open      = stability_monitor_open,
-    .read      = seq_read,
-    .llseek  = seq_lseek,
-    .release = single_release,
-};
-
-static int __init stability_monitor_init(void)
-{
-    proc_file = proc_create("tsm", 0, NULL, &stability_monitor_fops);
-    if (!proc_file)
-        return -ENOMEM;
-
-    return 0;
-}
-
-static void __exit stability_monitor_exit(void)
-{
-    remove_proc_entry("tsm", NULL);
-}
-
-module_init(stability_monitor_init);
-module_exit(stability_monitor_exit);
-
-MODULE_LICENSE("GPL");
diff --git a/packaging/stability-monitor-kmod-rpi3.spec b/packaging/stability-monitor-kmod-rpi3.spec
deleted file mode 100644 (file)
index 8c7bbe1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-%define KMOD_PATH %{_libdir}/stability-monitor/proc-tsm.ko
-
-Name:       stability-monitor-kmod-rpi3
-Version:    0.0.1
-Release:    0
-License:    Apache-2.0
-Source0:    %{name}-%{version}.tar.xz
-Summary:    Stability monitoring kernel module
-Group:      System/Monitoring
-ExclusiveArch: armv7l
-BuildRequires: arm-rpi3-linux-kernel-devel
-
-%description
-This package provides kernel module for stability monitoring daemon.
-
-%prep
-%setup -q
-
-%build
-make -C kernel KMOD_PATH=%KMOD_PATH KERNELDIR=/boot/kernel/devel/kernel-devel-arm-rpi3/
-
-%install
-install -D kernel/proc-tsm.ko %{buildroot}/%KMOD_PATH
-
-%files
-%license COPYING
-%KMOD_PATH