search for: init_mutex

Displaying 20 results from an estimated 21 matches for "init_mutex".

2007 Nov 23
0
[PATCH] [Mini-OS] Add init_SEMAPHORE
...7b87 extras/mini-os/include/semaphore.h --- a/extras/mini-os/include/semaphore.h Thu Nov 22 19:55:42 2007 +0000 +++ b/extras/mini-os/include/semaphore.h Fri Nov 23 13:21:02 2007 +0000 @@ -41,11 +41,13 @@ #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) -static inline void init_MUTEX(struct semaphore *sem) +static inline void init_SEMAPHORE(struct semaphore *sem, int count) { - sem->count = 1; + sem->count = count; init_waitqueue_head(&sem->wait); } +#define init_MUTEX(sem) init_SEMAPHORE(sem, 1) + static void inline down(struct semaphore *sem) { ______...
2007 Apr 18
2
[PATCH 21/21] i386 Ldt context inline
...new_context(struct task_struct *tsk, struct mm_struct *mm); -void destroy_context(struct mm_struct *mm); +static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm) +{ + struct mm_struct * old_mm; + int retval = 0; + + memset(&mm->context, 0, sizeof(mm->context)); + init_MUTEX(&mm->context.sem); + old_mm = current->mm; + if (old_mm && unlikely(old_mm->context.ldt)) { + retval = copy_ldt(&mm->context, &old_mm->context); + } + return retval; +} +/* + * No need to lock the MM as we are the last user + */ +static inline void destroy_cont...
2007 Apr 18
2
[PATCH 21/21] i386 Ldt context inline
...new_context(struct task_struct *tsk, struct mm_struct *mm); -void destroy_context(struct mm_struct *mm); +static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm) +{ + struct mm_struct * old_mm; + int retval = 0; + + memset(&mm->context, 0, sizeof(mm->context)); + init_MUTEX(&mm->context.sem); + old_mm = current->mm; + if (old_mm && unlikely(old_mm->context.ldt)) { + retval = copy_ldt(&mm->context, &old_mm->context); + } + return retval; +} +/* + * No need to lock the MM as we are the last user + */ +static inline void destroy_cont...
2007 Apr 18
0
[PATCH 12/14] i386 / Move context switch inline
...p;old->sem); + return err; } -/* - * we do not have to muck with descriptors here, that is - * done in switch_mm() as needed. - */ -int init_new_context(struct task_struct *tsk, struct mm_struct *mm) +void destroy_ldt(struct mm_struct *mm) { - struct mm_struct * old_mm; - int retval = 0; - - init_MUTEX(&mm->context.sem); + if (mm == current->active_mm) + clear_LDT(); + if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE) + vfree(mm->context.ldt); + else + kfree(mm->context.ldt); mm->context.size = 0; - old_mm = current->mm; - if (old_mm && old_mm->context.s...
2007 Apr 18
0
[PATCH 12/14] i386 / Move context switch inline
...p;old->sem); + return err; } -/* - * we do not have to muck with descriptors here, that is - * done in switch_mm() as needed. - */ -int init_new_context(struct task_struct *tsk, struct mm_struct *mm) +void destroy_ldt(struct mm_struct *mm) { - struct mm_struct * old_mm; - int retval = 0; - - init_MUTEX(&mm->context.sem); + if (mm == current->active_mm) + clear_LDT(); + if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE) + vfree(mm->context.ldt); + else + kfree(mm->context.ldt); mm->context.size = 0; - old_mm = current->mm; - if (old_mm && old_mm->context.s...
2007 Apr 18
0
[PATCH 14/14] i386 / Introduce hypervisor lazy pinning hooks
...7 @@ #include <asm/atomic.h> #include <asm/pgalloc.h> #include <asm/tlbflush.h> +#include <mach_mmu.h> /* * Used for LDT copy/destruction. @@ -15,12 +16,14 @@ struct mm_struct * old_mm; int retval = 0; + memset(&mm->context, 0, sizeof(mm->context)); init_MUTEX(&mm->context.sem); - mm->context.size = 0; old_mm = current->mm; if (old_mm && unlikely(old_mm->context.size > 0)) { retval = copy_ldt(&mm->context, &old_mm->context); } + if (retval == 0) + add_lazy_mm(mm); return retval; } @@ -31,6 +34,7 @@...
2007 Apr 18
0
[PATCH 14/14] i386 / Introduce hypervisor lazy pinning hooks
...7 @@ #include <asm/atomic.h> #include <asm/pgalloc.h> #include <asm/tlbflush.h> +#include <mach_mmu.h> /* * Used for LDT copy/destruction. @@ -15,12 +16,14 @@ struct mm_struct * old_mm; int retval = 0; + memset(&mm->context, 0, sizeof(mm->context)); init_MUTEX(&mm->context.sem); - mm->context.size = 0; old_mm = current->mm; if (old_mm && unlikely(old_mm->context.size > 0)) { retval = copy_ldt(&mm->context, &old_mm->context); } + if (retval == 0) + add_lazy_mm(mm); return retval; } @@ -31,6 +34,7 @@...
2007 Apr 18
0
[PATCH 12/12] xen-ldt
...memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE); + make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) / + PAGE_SIZE); return 0; } @@ -94,14 +103,16 @@ struct mm_struct * old_mm; int retval = 0; + memset(&mm->context, 0, sizeof(mm->context)); init_MUTEX(&mm->context.sem); - mm->context.size = 0; old_mm = current->mm; if (old_mm && old_mm->context.size > 0) { down(&old_mm->context.sem); retval = copy_ldt(&mm->context, &old_mm->context); up(&old_mm->context.sem); } + if (retval ==...
2007 Apr 18
0
[PATCH 12/12] xen-ldt
...memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE); + make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) / + PAGE_SIZE); return 0; } @@ -94,14 +103,16 @@ struct mm_struct * old_mm; int retval = 0; + memset(&mm->context, 0, sizeof(mm->context)); init_MUTEX(&mm->context.sem); - mm->context.size = 0; old_mm = current->mm; if (old_mm && old_mm->context.size > 0) { down(&old_mm->context.sem); retval = copy_ldt(&mm->context, &old_mm->context); up(&old_mm->context.sem); } + if (retval ==...
2007 Apr 18
2
[PATCH 3/6] i386 virtualization - Make ldt a desc struct
...======================= > --- linux-2.6.13.orig/include/asm-i386/mmu_context.h 2005-08-15 11:16:59.000000000 -0700 > +++ linux-2.6.13/include/asm-i386/mmu_context.h 2005-08-15 11:19:49.000000000 -0700 > @@ -19,7 +19,7 @@ > memset(&mm->context, 0, sizeof(mm->context)); > init_MUTEX(&mm->context.sem); > old_mm = current->mm; > - if (old_mm && unlikely(old_mm->context.size > 0)) { > + if (old_mm && unlikely(old_mm->context.ldt)) { > retval = copy_ldt(&mm->context, &old_mm->context); > } > if (retval ==...
2007 Apr 18
2
[PATCH 3/6] i386 virtualization - Make ldt a desc struct
...======================= > --- linux-2.6.13.orig/include/asm-i386/mmu_context.h 2005-08-15 11:16:59.000000000 -0700 > +++ linux-2.6.13/include/asm-i386/mmu_context.h 2005-08-15 11:19:49.000000000 -0700 > @@ -19,7 +19,7 @@ > memset(&mm->context, 0, sizeof(mm->context)); > init_MUTEX(&mm->context.sem); > old_mm = current->mm; > - if (old_mm && unlikely(old_mm->context.size > 0)) { > + if (old_mm && unlikely(old_mm->context.ldt)) { > retval = copy_ldt(&mm->context, &old_mm->context); > } > if (retval ==...
2007 Apr 18
2
[PATCH 12/12; UPDATED] xen-ldt
...memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE); + make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) / + PAGE_SIZE); return 0; } @@ -94,14 +103,16 @@ struct mm_struct * old_mm; int retval = 0; + memset(&mm->context, 0, sizeof(mm->context)); init_MUTEX(&mm->context.sem); - mm->context.size = 0; old_mm = current->mm; if (old_mm && old_mm->context.size > 0) { down(&old_mm->context.sem); retval = copy_ldt(&mm->context, &old_mm->context); up(&old_mm->context.sem); } + if (retval ==...
2007 Apr 18
2
[PATCH 12/12; UPDATED] xen-ldt
...memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE); + make_pages_readonly(new->ldt, (new->size * LDT_ENTRY_SIZE) / + PAGE_SIZE); return 0; } @@ -94,14 +103,16 @@ struct mm_struct * old_mm; int retval = 0; + memset(&mm->context, 0, sizeof(mm->context)); init_MUTEX(&mm->context.sem); - mm->context.size = 0; old_mm = current->mm; if (old_mm && old_mm->context.size > 0) { down(&old_mm->context.sem); retval = copy_ldt(&mm->context, &old_mm->context); up(&old_mm->context.sem); } + if (retval ==...
2007 Apr 18
0
[PATCH 20/21] i386 Ldt cleanups 3
...ldt = NULL; } -/* - * we do not have to muck with descriptors here, that is - * done in switch_mm() as needed. - */ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) { struct mm_struct * old_mm; int retval = 0; + memset(&mm->context, 0, sizeof(mm->context)); init_MUTEX(&mm->context.sem); - mm->context.size = 0; old_mm = current->mm; - if (old_mm && old_mm->context.size > 0) { - down(&old_mm->context.sem); + if (old_mm && unlikely(old_mm->context.ldt)) { retval = copy_ldt(&mm->context, &old_mm->conte...
2007 Apr 18
0
[PATCH 20/21] i386 Ldt cleanups 3
...ldt = NULL; } -/* - * we do not have to muck with descriptors here, that is - * done in switch_mm() as needed. - */ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) { struct mm_struct * old_mm; int retval = 0; + memset(&mm->context, 0, sizeof(mm->context)); init_MUTEX(&mm->context.sem); - mm->context.size = 0; old_mm = current->mm; - if (old_mm && old_mm->context.size > 0) { - down(&old_mm->context.sem); + if (old_mm && unlikely(old_mm->context.ldt)) { retval = copy_ldt(&mm->context, &old_mm->conte...
2018 Nov 16
0
[PATCH v4 5/7] iommu: Add virtio-iommu driver
Hi Eric, On 16/11/2018 06:08, Auger Eric wrote: >> +struct viommu_domain { >> + struct iommu_domain domain; >> + struct viommu_dev *viommu; >> + struct mutex mutex; > same naming/comment as in smmu driver may help here > struct mutex init_mutex; /* Protects viommu pointer */ ok >> + unsigned int id; >> + >> + spinlock_t mappings_lock; >> + struct rb_root_cached mappings; >> + >> + unsigned long nr_endpoints; >> +}; >> + >> +struct viommu_endpoint { >> + struct viommu_dev...
2018 Nov 16
2
[PATCH v4 5/7] iommu: Add virtio-iommu driver
...dr_t paddr; > + struct interval_tree_node iova; > + u32 flags; > +}; > + > +struct viommu_domain { > + struct iommu_domain domain; > + struct viommu_dev *viommu; > + struct mutex mutex; same naming/comment as in smmu driver may help here struct mutex init_mutex; /* Protects viommu pointer */ > + unsigned int id; > + > + spinlock_t mappings_lock; > + struct rb_root_cached mappings; > + > + unsigned long nr_endpoints; > +}; > + > +struct viommu_endpoint { > + struct viommu_dev *viommu; > + struct viommu_domain *vdom...
2018 Nov 16
2
[PATCH v4 5/7] iommu: Add virtio-iommu driver
...dr_t paddr; > + struct interval_tree_node iova; > + u32 flags; > +}; > + > +struct viommu_domain { > + struct iommu_domain domain; > + struct viommu_dev *viommu; > + struct mutex mutex; same naming/comment as in smmu driver may help here struct mutex init_mutex; /* Protects viommu pointer */ > + unsigned int id; > + > + spinlock_t mappings_lock; > + struct rb_root_cached mappings; > + > + unsigned long nr_endpoints; > +}; > + > +struct viommu_endpoint { > + struct viommu_dev *viommu; > + struct viommu_domain *vdom...
2018 Nov 15
12
[PATCH v4 0/7] Add virtio-iommu driver
Implement the virtio-iommu driver, following specification v0.8 [1]. Changes since v3 [2]: * Rebase onto v4.20-rc2. Patch 3 now touches drivers/of/base.c instead of drivers/pci/of.c, since the map_rid() function has moved. * Removed the request timeout, that depended on DEBUG. * Other small fixes addressing comments on v3. You can find Linux driver and kvmtool device on my virtio-iommu/v0.8.1
2007 Apr 18
43
[RFC PATCH 00/35] Xen i386 paravirtualization support
Unlike full virtualization in which the virtual machine provides the same platform interface as running natively on the hardware, paravirtualization requires modification to the guest operating system to work with the platform interface provided by the hypervisor. Xen was designed with performance in mind. Calls to the hypervisor are minimized, batched if necessary, and non-critical codepaths