Displaying 20 results from an estimated 433 matches for "atomic_inc".
2013 Mar 15
1
Re: [PATCH 6/9] tools: memshr: arm64 support
...m not mad keen on propagating these sorts of asm atomic operations throughout
> our code base. Other options would be:
gcc has atomic builtins to do this kind of work. I don''t know about arm, but they do the job in x86
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html
so atomic_inc(val) -> __sync_fetch_and_add(val, 1) and likewise for dec/sub
Andres
>
> - use libatomic-ops, http://www.hpl.hp.com/research/linux/atomic_ops/, although
> this doesn''t seem to be as widespread as I would like (not in RHEL5 for
> example)
> - use a pthread lock. This...
2015 Oct 26
3
[kvm-unit-tests PATCH] x86: hyperv_synic: Hyper-V SynIC test
...HV_TEST_DEV_SINT_ROUTE_SET_SINT
+};
+
+static atomic_t isr_enter_count[MAX_CPUS];
+static atomic_t cpus_comp_count;
+
+static bool synic_supported(void)
+{
+ return cpuid(HYPERV_CPUID_FEATURES).a & HV_X64_MSR_SYNIC_AVAILABLE;
+}
+
+static void synic_sint_auto_eoi_isr(isr_regs_t *regs)
+{
+ atomic_inc(&isr_enter_count[smp_id()]);
+}
+
+static void synic_sint_isr(isr_regs_t *regs)
+{
+ atomic_inc(&isr_enter_count[smp_id()]);
+ eoi();
+}
+
+static void synic_ctl(u8 ctl, u8 vcpu_id, u8 sint)
+{
+ outl((ctl << 16)|((vcpu_id) << 8)|sint, 0x3000);
+}
+
+struct sint_vec_ent...
2015 Oct 26
3
[kvm-unit-tests PATCH] x86: hyperv_synic: Hyper-V SynIC test
...HV_TEST_DEV_SINT_ROUTE_SET_SINT
+};
+
+static atomic_t isr_enter_count[MAX_CPUS];
+static atomic_t cpus_comp_count;
+
+static bool synic_supported(void)
+{
+ return cpuid(HYPERV_CPUID_FEATURES).a & HV_X64_MSR_SYNIC_AVAILABLE;
+}
+
+static void synic_sint_auto_eoi_isr(isr_regs_t *regs)
+{
+ atomic_inc(&isr_enter_count[smp_id()]);
+}
+
+static void synic_sint_isr(isr_regs_t *regs)
+{
+ atomic_inc(&isr_enter_count[smp_id()]);
+ eoi();
+}
+
+static void synic_ctl(u8 ctl, u8 vcpu_id, u8 sint)
+{
+ outl((ctl << 16)|((vcpu_id) << 8)|sint, 0x3000);
+}
+
+struct sint_vec_ent...
2013 Jan 31
4
[RFC][PATCH 2/2] Btrfs: implement unlocked dio write
...iocb,
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
int flags = 0;
- bool wakeup = false;
+ bool wakeup = true;
int ret;
if (check_direct_IO(BTRFS_I(inode)->root, rw, iocb, iov,
offset, nr_segs))
return 0;
- if (rw == READ) {
- atomic_inc(&inode->i_dio_count);
- smp_mb__after_atomic_inc();
- if (unlikely(test_bit(BTRFS_INODE_READDIO_NEED_LOCK,
- &BTRFS_I(inode)->runtime_flags))) {
- inode_dio_done(inode);
- flags = DIO_LOCKING | DIO_SKIP_HOLES;
- } else {
- wakeup = true;
- }
+ atomic_inc(&inode-...
2020 Sep 02
0
[PATCH v2 1/7] mm/thp: fix __split_huge_pmd_locked() for migration PMD
...secondary mmu by calling
* mmu_notifier_invalidate_range() see comments below inside
@@ -2117,30 +2117,34 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
pte = pte_offset_map(&_pmd, addr);
BUG_ON(!pte_none(*pte));
set_pte_at(mm, addr, pte, entry);
- atomic_inc(&page[i]._mapcount);
- pte_unmap(pte);
- }
-
- /*
- * Set PG_double_map before dropping compound_mapcount to avoid
- * false-negative page_mapped().
- */
- if (compound_mapcount(page) > 1 && !TestSetPageDoubleMap(page)) {
- for (i = 0; i < HPAGE_PMD_NR; i++)
+ if (!pmd_migra...
2015 Nov 02
0
[kvm-unit-tests PATCH] x86: hyperv_synic: Hyper-V SynIC test
...ic_t isr_enter_count[MAX_CPUS];
> +static atomic_t cpus_comp_count;
> +
> +static bool synic_supported(void)
> +{
> + return cpuid(HYPERV_CPUID_FEATURES).a & HV_X64_MSR_SYNIC_AVAILABLE;
> +}
> +
> +static void synic_sint_auto_eoi_isr(isr_regs_t *regs)
> +{
> + atomic_inc(&isr_enter_count[smp_id()]);
> +}
> +
> +static void synic_sint_isr(isr_regs_t *regs)
> +{
> + atomic_inc(&isr_enter_count[smp_id()]);
> + eoi();
> +}
> +
> +static void synic_ctl(u8 ctl, u8 vcpu_id, u8 sint)
> +{
> + outl((ctl << 16)|((vcpu_i...
2019 Apr 16
2
[PATCH] vhost/scsi: drop unnecessary smp_mb__after_atomic()
...point.
Later they were dropped or converted to regular ints protected by a
mutex.
The commit that made these changes left an unused smp_mb__after_atomic()
in vhost_scsi_set_endpoint(). It was previously used after incrementing
vhost_scsi->vhost_ref_cnt but this field has been dropped:
- atomic_inc(&vs->vhost_ref_cnt);
smp_mb__after_atomic_inc();
Reported-by: Andrea Parri <andrea.parri at amarulasolutions.com>
Fixes: 101998f6fcd680 ("tcm_vhost: Post-merge review changes requested by MST")
Signed-off-by: Stefan Hajnoczi <stefanha at redhat.com>
---
driver...
2019 Apr 16
2
[PATCH] vhost/scsi: drop unnecessary smp_mb__after_atomic()
...point.
Later they were dropped or converted to regular ints protected by a
mutex.
The commit that made these changes left an unused smp_mb__after_atomic()
in vhost_scsi_set_endpoint(). It was previously used after incrementing
vhost_scsi->vhost_ref_cnt but this field has been dropped:
- atomic_inc(&vs->vhost_ref_cnt);
smp_mb__after_atomic_inc();
Reported-by: Andrea Parri <andrea.parri at amarulasolutions.com>
Fixes: 101998f6fcd680 ("tcm_vhost: Post-merge review changes requested by MST")
Signed-off-by: Stefan Hajnoczi <stefanha at redhat.com>
---
driver...
2010 Aug 03
2
[PATCH 6/6] staging: hv: Gracefully handle SCSI resets
...ruct storvsc_device *)Device->Extension;
+
+ spin_lock_irqsave(&storDevice->lock, flags);
+
+ if (storDevice->reset == 1) {
+ spin_unlock_irqrestore(&storDevice->lock, flags);
+ return NULL;
+ }
+
if (storDevice && atomic_read(&storDevice->RefCount) > 1)
atomic_inc(&storDevice->RefCount);
else
storDevice = NULL;
+ spin_unlock_irqrestore(&storDevice->lock, flags);
+
return storDevice;
}
@@ -122,13 +139,19 @@ static inline struct storvsc_device *GetStorDevice(struct hv_device *Device) static inline struct storvsc_device *MustGetStorDe...
2010 Aug 03
2
[PATCH 6/6] staging: hv: Gracefully handle SCSI resets
...ruct storvsc_device *)Device->Extension;
+
+ spin_lock_irqsave(&storDevice->lock, flags);
+
+ if (storDevice->reset == 1) {
+ spin_unlock_irqrestore(&storDevice->lock, flags);
+ return NULL;
+ }
+
if (storDevice && atomic_read(&storDevice->RefCount) > 1)
atomic_inc(&storDevice->RefCount);
else
storDevice = NULL;
+ spin_unlock_irqrestore(&storDevice->lock, flags);
+
return storDevice;
}
@@ -122,13 +139,19 @@ static inline struct storvsc_device *GetStorDevice(struct hv_device *Device) static inline struct storvsc_device *MustGetStorDe...
2011 Dec 23
2
re: Btrfs: fix num_workers_starting bug and other bugs in async thread
...worker = list_entry(fallback,
601 struct btrfs_worker_thread, worker_list);
602 found:
603 /*
604 * this makes sure the worker doesn''t exit before it is placed
605 * onto a busy/idle list
606 */
607 atomic_inc(&worker->num_pending);
608 spin_unlock_irqrestore(&workers->lock, flags);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
And again here.
Btw, does find_worker() ever get called with IRQs disabled? If so then
__btrfs_start_workers() enables them. Maybe that functi...
2020 Sep 02
1
[PATCH v2 1/7] mm/thp: fix __split_huge_pmd_locked() for migration PMD
...* mmu_notifier_invalidate_range() see comments below inside
> @@ -2117,30 +2117,34 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
> pte = pte_offset_map(&_pmd, addr);
> BUG_ON(!pte_none(*pte));
> set_pte_at(mm, addr, pte, entry);
> - atomic_inc(&page[i]._mapcount);
> - pte_unmap(pte);
> - }
> -
> - /*
> - * Set PG_double_map before dropping compound_mapcount to avoid
> - * false-negative page_mapped().
> - */
> - if (compound_mapcount(page) > 1 && !TestSetPageDoubleMap(page)) {
> - for (i = 0...
2019 Nov 11
2
[PATCH net-next 12/14] vsock/vmci: register vmci_transport only when VMCI guest/host are active
...> +{
> + return atomic_read(&vmci_host_active_users);
> +}
> +
> /*
> * Called on open of /dev/vmci.
> */
> @@ -338,6 +343,8 @@ static int vmci_host_do_init_context(struct
> vmci_host_dev *vmci_host_dev,
> vmci_host_dev->ct_type = VMCIOBJ_CONTEXT;
> atomic_inc(&vmci_host_active_users);
>
> + vmci_call_vsock_callback(true);
> +
Since we don't unregister the transport if user count drops back to 0, we could
just call this the first time, a VM is powered on after the module is loaded.
> retval = 0;
>
> out:
2019 Nov 11
2
[PATCH net-next 12/14] vsock/vmci: register vmci_transport only when VMCI guest/host are active
...> +{
> + return atomic_read(&vmci_host_active_users);
> +}
> +
> /*
> * Called on open of /dev/vmci.
> */
> @@ -338,6 +343,8 @@ static int vmci_host_do_init_context(struct
> vmci_host_dev *vmci_host_dev,
> vmci_host_dev->ct_type = VMCIOBJ_CONTEXT;
> atomic_inc(&vmci_host_active_users);
>
> + vmci_call_vsock_callback(true);
> +
Since we don't unregister the transport if user count drops back to 0, we could
just call this the first time, a VM is powered on after the module is loaded.
> retval = 0;
>
> out:
2014 Sep 18
3
[PATCH] blk-mq: Avoid race condition with uninitialized requests
This patch should fix the bug reported in https://lkml.org/lkml/2014/9/11/249.
Test is still pending.
David Hildenbrand (1):
blk-mq: Avoid race condition with uninitialized requests
block/blk-mq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--
1.8.5.5
2014 Sep 18
3
[PATCH] blk-mq: Avoid race condition with uninitialized requests
This patch should fix the bug reported in https://lkml.org/lkml/2014/9/11/249.
Test is still pending.
David Hildenbrand (1):
blk-mq: Avoid race condition with uninitialized requests
block/blk-mq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--
1.8.5.5
2008 Sep 25
0
[PATCH 2/4] Add shared reference cache
...rb_node *rb;
struct btrfs_leaf_ref *ref = NULL;
struct btrfs_leaf_ref_tree *tree = root->ref_tree;
-
- if (!tree)
- return NULL;
-
- spin_lock(&tree->lock);
- rb = tree_search(&tree->root, bytenr);
- if (rb)
- ref = rb_entry(rb, struct btrfs_leaf_ref, rb_node);
- if (ref)
- atomic_inc(&ref->usage);
- spin_unlock(&tree->lock);
- return ref;
+again:
+ if (tree) {
+ spin_lock(&tree->lock);
+ rb = tree_search(&tree->root, bytenr);
+ if (rb)
+ ref = rb_entry(rb, struct btrfs_leaf_ref, rb_node);
+ if (ref)
+ atomic_inc(&ref->usage);
+ spin_u...
2007 Apr 18
0
[Bridge] [PATCH] (4/4) bridge forwarding table RCU
Convert the bridge forwarding database over to using RCU.
This avoids a read_lock and atomic_inc/dec in the fast path
of output.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
diff -Nru a/include/linux/list.h b/include/linux/list.h
--- a/include/linux/list.h 2004-07-28 15:30:04 -07:00
+++ b/include/linux/list.h 2004-07-28 15:30:04 -07:00
@@ -678,6 +678,24 @@
pos &&am...
2020 Sep 03
1
[PATCH v3] mm/thp: fix __split_huge_pmd_locked() for migration PMD
...secondary mmu by calling
* mmu_notifier_invalidate_range() see comments below inside
@@ -2117,30 +2117,34 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
pte = pte_offset_map(&_pmd, addr);
BUG_ON(!pte_none(*pte));
set_pte_at(mm, addr, pte, entry);
- atomic_inc(&page[i]._mapcount);
- pte_unmap(pte);
- }
-
- /*
- * Set PG_double_map before dropping compound_mapcount to avoid
- * false-negative page_mapped().
- */
- if (compound_mapcount(page) > 1 && !TestSetPageDoubleMap(page)) {
- for (i = 0; i < HPAGE_PMD_NR; i++)
+ if (!pmd_migra...
2016 Nov 11
2
[PATCH] vhost/vsock: Remove unused but set variable
...st_vsock *vsock;
- struct vhost_virtqueue *vq;
int len = pkt->len;
/* Find the vhost_vsock according to guest context id */
@@ -205,8 +204,6 @@ vhost_transport_send_pkt(struct virtio_vsock_pkt *pkt)
return -ENODEV;
}
- vq = &vsock->vqs[VSOCK_VQ_RX];
-
if (pkt->reply)
atomic_inc(&vsock->queued_replies);
--
2.11.0.rc0.7.gbe5a750