Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95753
b: refs/heads/master
c: 5ef8275
h: refs/heads/master
i:
  95751: 1d02d22
v: v3
  • Loading branch information
Rusty Russell committed May 2, 2008
1 parent dfd3128 commit 71dc26e
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 158 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8bec4a5d9305c86d028a519b08f05b81cd63cc55
refs/heads/master: 5ef827526fc01820a7a80827802e9fad3f34f937
2 changes: 1 addition & 1 deletion trunk/arch/ia64/ia32/ia32_signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ sys32_sigsuspend (int history0, int history1, old_sigset_t mask)

current->state = TASK_INTERRUPTIBLE;
schedule();
set_restore_sigmask();
set_thread_flag(TIF_RESTORE_SIGMASK);
return -ERESTARTNOHAND;
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/ia64/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ acpi_map_iosapics (void)
fs_initcall(acpi_map_iosapics);
#endif /* CONFIG_ACPI_NUMA */

int __ref acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
{
int err;

Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/ia64/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ void fixup_irqs(void)
{
unsigned int irq;
extern void ia64_process_pending_intr(void);
extern void ia64_disable_timer(void);
extern volatile int time_keeper_id;

/* Mask ITV to disable timer */
ia64_set_itv(1 << 16);
ia64_disable_timer();

/*
* Find a new timesync master
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/ia64/kernel/palinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK;
}

static struct notifier_block __refdata palinfo_cpu_notifier =
static struct notifier_block palinfo_cpu_notifier __cpuinitdata =
{
.notifier_call = palinfo_cpu_callback,
.priority = 0,
Expand Down
199 changes: 112 additions & 87 deletions trunk/arch/ia64/kernel/perfmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ pfm_rvfree(void *mem, unsigned long size)
}

static pfm_context_t *
pfm_context_alloc(int ctx_flags)
pfm_context_alloc(void)
{
pfm_context_t *ctx;

Expand All @@ -878,46 +878,6 @@ pfm_context_alloc(int ctx_flags)
ctx = kzalloc(sizeof(pfm_context_t), GFP_KERNEL);
if (ctx) {
DPRINT(("alloc ctx @%p\n", ctx));

/*
* init context protection lock
*/
spin_lock_init(&ctx->ctx_lock);

/*
* context is unloaded
*/
ctx->ctx_state = PFM_CTX_UNLOADED;

/*
* initialization of context's flags
*/
ctx->ctx_fl_block = (ctx_flags & PFM_FL_NOTIFY_BLOCK) ? 1 : 0;
ctx->ctx_fl_system = (ctx_flags & PFM_FL_SYSTEM_WIDE) ? 1: 0;
ctx->ctx_fl_no_msg = (ctx_flags & PFM_FL_OVFL_NO_MSG) ? 1: 0;
/*
* will move to set properties
* ctx->ctx_fl_excl_idle = (ctx_flags & PFM_FL_EXCL_IDLE) ? 1: 0;
*/

/*
* init restart semaphore to locked
*/
init_completion(&ctx->ctx_restart_done);

/*
* activation is used in SMP only
*/
ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
SET_LAST_CPU(ctx, -1);

/*
* initialize notification message queue
*/
ctx->ctx_msgq_head = ctx->ctx_msgq_tail = 0;
init_waitqueue_head(&ctx->ctx_msgq_wait);
init_waitqueue_head(&ctx->ctx_zombieq);

}
return ctx;
}
Expand Down Expand Up @@ -2205,21 +2165,28 @@ static struct dentry_operations pfmfs_dentry_operations = {
};


static struct file *
pfm_alloc_file(pfm_context_t *ctx)
static int
pfm_alloc_fd(struct file **cfile)
{
struct file *file;
struct inode *inode;
struct dentry *dentry;
int fd, ret = 0;
struct file *file = NULL;
struct inode * inode;
char name[32];
struct qstr this;

fd = get_unused_fd();
if (fd < 0) return -ENFILE;

ret = -ENFILE;

file = get_empty_filp();
if (!file) goto out;

/*
* allocate a new inode
*/
inode = new_inode(pfmfs_mnt->mnt_sb);
if (!inode)
return ERR_PTR(-ENOMEM);
if (!inode) goto out;

DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));

Expand All @@ -2232,28 +2199,59 @@ pfm_alloc_file(pfm_context_t *ctx)
this.len = strlen(name);
this.hash = inode->i_ino;

ret = -ENOMEM;

/*
* allocate a new dcache entry
*/
dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
if (!dentry) {
iput(inode);
return ERR_PTR(-ENOMEM);
}
file->f_path.dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
if (!file->f_path.dentry) goto out;

dentry->d_op = &pfmfs_dentry_operations;
d_add(dentry, inode);
file->f_path.dentry->d_op = &pfmfs_dentry_operations;

file = alloc_file(pfmfs_mnt, dentry, FMODE_READ, &pfm_file_ops);
if (!file) {
dput(dentry);
return ERR_PTR(-ENFILE);
}
d_add(file->f_path.dentry, inode);
file->f_path.mnt = mntget(pfmfs_mnt);
file->f_mapping = inode->i_mapping;

file->f_op = &pfm_file_ops;
file->f_mode = FMODE_READ;
file->f_flags = O_RDONLY;
file->private_data = ctx;
file->f_pos = 0;

/*
* may have to delay until context is attached?
*/
fd_install(fd, file);

/*
* the file structure we will use
*/
*cfile = file;

return fd;
out:
if (file) put_filp(file);
put_unused_fd(fd);
return ret;
}

static void
pfm_free_fd(int fd, struct file *file)
{
struct files_struct *files = current->files;
struct fdtable *fdt;

return file;
/*
* there ie no fd_uninstall(), so we do it here
*/
spin_lock(&files->file_lock);
fdt = files_fdtable(files);
rcu_assign_pointer(fdt->fd[fd], NULL);
spin_unlock(&files->file_lock);

if (file)
put_filp(file);
put_unused_fd(fd);
}

static int
Expand Down Expand Up @@ -2477,7 +2475,6 @@ pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t

/* link buffer format and context */
ctx->ctx_buf_fmt = fmt;
ctx->ctx_fl_is_sampling = 1; /* assume record() is defined */

/*
* check if buffer format wants to use perfmon buffer allocation/mapping service
Expand Down Expand Up @@ -2672,45 +2669,78 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
{
pfarg_context_t *req = (pfarg_context_t *)arg;
struct file *filp;
struct path path;
int ctx_flags;
int fd;
int ret;

/* let's check the arguments first */
ret = pfarg_is_sane(current, req);
if (ret < 0)
return ret;
if (ret < 0) return ret;

ctx_flags = req->ctx_flags;

ret = -ENOMEM;

fd = get_unused_fd();
if (fd < 0)
return fd;
ctx = pfm_context_alloc();
if (!ctx) goto error;

ctx = pfm_context_alloc(ctx_flags);
if (!ctx)
goto error;
ret = pfm_alloc_fd(&filp);
if (ret < 0) goto error_file;

filp = pfm_alloc_file(ctx);
if (IS_ERR(filp)) {
ret = PTR_ERR(filp);
goto error_file;
}
req->ctx_fd = ctx->ctx_fd = ret;

req->ctx_fd = ctx->ctx_fd = fd;
/*
* attach context to file
*/
filp->private_data = ctx;

/*
* does the user want to sample?
*/
if (pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) {
ret = pfm_setup_buffer_fmt(current, filp, ctx, ctx_flags, 0, req);
if (ret)
goto buffer_error;
if (ret) goto buffer_error;
}

/*
* init context protection lock
*/
spin_lock_init(&ctx->ctx_lock);

/*
* context is unloaded
*/
ctx->ctx_state = PFM_CTX_UNLOADED;

/*
* initialization of context's flags
*/
ctx->ctx_fl_block = (ctx_flags & PFM_FL_NOTIFY_BLOCK) ? 1 : 0;
ctx->ctx_fl_system = (ctx_flags & PFM_FL_SYSTEM_WIDE) ? 1: 0;
ctx->ctx_fl_is_sampling = ctx->ctx_buf_fmt ? 1 : 0; /* assume record() is defined */
ctx->ctx_fl_no_msg = (ctx_flags & PFM_FL_OVFL_NO_MSG) ? 1: 0;
/*
* will move to set properties
* ctx->ctx_fl_excl_idle = (ctx_flags & PFM_FL_EXCL_IDLE) ? 1: 0;
*/

/*
* init restart semaphore to locked
*/
init_completion(&ctx->ctx_restart_done);

/*
* activation is used in SMP only
*/
ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
SET_LAST_CPU(ctx, -1);

/*
* initialize notification message queue
*/
ctx->ctx_msgq_head = ctx->ctx_msgq_tail = 0;
init_waitqueue_head(&ctx->ctx_msgq_wait);
init_waitqueue_head(&ctx->ctx_zombieq);

DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d \n",
ctx,
ctx_flags,
Expand All @@ -2725,14 +2755,10 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
*/
pfm_reset_pmu_state(ctx);

fd_install(fd, filp);

return 0;

buffer_error:
path = filp->f_path;
put_filp(filp);
path_put(&path);
pfm_free_fd(ctx->ctx_fd, filp);

if (ctx->ctx_buf_fmt) {
pfm_buf_fmt_exit(ctx->ctx_buf_fmt, current, NULL, regs);
Expand All @@ -2741,7 +2767,6 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
pfm_context_free(ctx);

error:
put_unused_fd(fd);
return ret;
}

Expand Down
15 changes: 7 additions & 8 deletions trunk/arch/ia64/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
if (!user_mode(&scr->pt))
return;

if (current_thread_info()->status & TS_RESTORE_SIGMASK)
if (test_thread_flag(TIF_RESTORE_SIGMASK))
oldset = &current->saved_sigmask;
else
oldset = &current->blocked;
Expand Down Expand Up @@ -530,13 +530,12 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
* continue to iterate in this loop so we can deliver the SIGSEGV...
*/
if (handle_signal(signr, &ka, &info, oldset, scr)) {
/*
* A signal was successfully delivered; the saved
/* a signal was successfully delivered; the saved
* sigmask will have been stored in the signal frame,
* and will be restored by sigreturn, so we can simply
* clear the TS_RESTORE_SIGMASK flag.
*/
current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
* clear the TIF_RESTORE_SIGMASK flag */
if (test_thread_flag(TIF_RESTORE_SIGMASK))
clear_thread_flag(TIF_RESTORE_SIGMASK);
return;
}
}
Expand Down Expand Up @@ -567,8 +566,8 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)

/* if there's no signal to deliver, we just put the saved sigmask
* back */
if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
clear_thread_flag(TIF_RESTORE_SIGMASK);
sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
}
}
Loading

0 comments on commit 71dc26e

Please sign in to comment.