Commit 8107000b authored by Philippe Gerum's avatar Philippe Gerum
Browse files

evl/file: convert file table lock to hard lock



The data protected by the file table lock is frequently accessed from
the in-band stage where holding it with hard irqs off is
required. Therefore we would not benefit in the common case from the
preemption disabling feature we are going to add to the EVL-specific
spinlock. Make it a hard lock to clarify the intent.
Signed-off-by: default avatarPhilippe Gerum <rpm@xenomai.org>
parent d2d5be01
......@@ -21,7 +21,7 @@
static struct rb_root fd_tree = RB_ROOT;
static DEFINE_EVL_SPINLOCK(fdt_lock);
static DEFINE_HARD_SPINLOCK(fdt_lock);
/*
* We could have a per-files_struct table of fds managed out-of-band,
......@@ -122,9 +122,9 @@ void install_inband_fd(unsigned int fd, struct file *filp,
efd->files = files;
efd->efilp = filp->oob_data;
INIT_LIST_HEAD(&efd->poll_nodes);
evl_spin_lock_irqsave(&fdt_lock, flags);
raw_spin_lock_irqsave(&fdt_lock, flags);
ret = index_efd(efd, filp);
evl_spin_unlock_irqrestore(&fdt_lock, flags);
raw_spin_unlock_irqrestore(&fdt_lock, flags);
}
EVL_WARN_ON(CORE, ret);
......@@ -147,11 +147,11 @@ void uninstall_inband_fd(unsigned int fd, struct file *filp,
if (filp->oob_data == NULL)
return;
evl_spin_lock_irqsave(&fdt_lock, flags);
raw_spin_lock_irqsave(&fdt_lock, flags);
efd = unindex_efd(fd, files);
if (efd)
drop_watchpoints(efd);
evl_spin_unlock_irqrestore(&fdt_lock, flags);
raw_spin_unlock_irqrestore(&fdt_lock, flags);
evl_schedule();
if (efd)
......@@ -168,18 +168,18 @@ void replace_inband_fd(unsigned int fd, struct file *filp,
if (filp->oob_data == NULL)
return;
evl_spin_lock_irqsave(&fdt_lock, flags);
raw_spin_lock_irqsave(&fdt_lock, flags);
efd = lookup_efd(fd, files);
if (efd) {
drop_watchpoints(efd);
efd->efilp = filp->oob_data;
evl_spin_unlock_irqrestore(&fdt_lock, flags);
raw_spin_unlock_irqrestore(&fdt_lock, flags);
evl_schedule();
return;
}
evl_spin_unlock_irqrestore(&fdt_lock, flags);
raw_spin_unlock_irqrestore(&fdt_lock, flags);
install_inband_fd(fd, filp, files);
}
......@@ -190,13 +190,13 @@ struct evl_file *evl_get_file(unsigned int fd)
unsigned long flags;
struct evl_fd *efd;
evl_spin_lock_irqsave(&fdt_lock, flags);
raw_spin_lock_irqsave(&fdt_lock, flags);
efd = lookup_efd(fd, current->files);
if (efd) {
efilp = efd->efilp;
evl_get_fileref(efilp);
}
evl_spin_unlock_irqrestore(&fdt_lock, flags);
raw_spin_unlock_irqrestore(&fdt_lock, flags);
return efilp;
}
......@@ -209,14 +209,14 @@ struct evl_file *evl_watch_fd(unsigned int fd,
unsigned long flags;
struct evl_fd *efd;
evl_spin_lock_irqsave(&fdt_lock, flags);
raw_spin_lock_irqsave(&fdt_lock, flags);
efd = lookup_efd(fd, current->files);
if (efd) {
efilp = efd->efilp;
evl_get_fileref(efilp);
list_add(&node->next, &efd->poll_nodes);
}
evl_spin_unlock_irqrestore(&fdt_lock, flags);
raw_spin_unlock_irqrestore(&fdt_lock, flags);
return efilp;
}
......@@ -225,9 +225,9 @@ void evl_ignore_fd(struct evl_poll_node *node)
{
unsigned long flags;
evl_spin_lock_irqsave(&fdt_lock, flags);
raw_spin_lock_irqsave(&fdt_lock, flags);
list_del(&node->next);
evl_spin_unlock_irqrestore(&fdt_lock, flags);
raw_spin_unlock_irqrestore(&fdt_lock, flags);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment