Skip to content
Snippets Groups Projects
Commit 12d34ddd authored by gback's avatar gback
Browse files

Merge branch 'master' of git.cs.vt.edu:gback/pintos-2017

parents 4b5de360 fb8f67e2
No related branches found
No related tags found
No related merge requests found
......@@ -608,7 +608,7 @@ that no CPU is idle while threads are ready to run (but are not currently
running). However, using a global queue has two main weaknesses.
The first weakness is lack of
scability. The global queue must be locked while choosing the next job to run.
scalability. The global queue must be locked while choosing the next job to run.
Locking greatly reduces performance as the number of CPUs grows. Each CPU will
spend more and more time contenting for the global queue lock and less time
actually running threads.
......
......@@ -724,7 +724,7 @@ uhci_add_td_to_qh (struct queue_head *qh, struct tx_descriptor *td)
{
/* queue is empty */
td->flp.terminate = 1;
barrier ();
smp_barrier ();
td->flp.flp = 0;
qh->qelp.flp = ptr_to_flp (vtop (td));
qh->qelp.terminate = 0;
......@@ -745,7 +745,7 @@ uhci_add_td_to_qh (struct queue_head *qh, struct tx_descriptor *td)
fp->qh_select = 0;
fp->depth_select = 0;
fp->flp = ptr_to_flp (vtop (td));
barrier ();
smp_barrier ();
fp->terminate = 0;
}
}
......@@ -928,7 +928,7 @@ uhci_create_chan (host_info hi, int dev_addr, int ver)
/* queue data */
memset (ud->qh, 0, sizeof (*ud->qh));
ud->qh->qelp.terminate = 1;
barrier ();
smp_barrier ();
ud->qh->qelp.flp = 0;
ud->qh->qelp.qh_select = 0;
ud->qh->qhlp.qh_select = 1;
......
......@@ -52,4 +52,12 @@ void cond_broadcast (struct condition *, struct lock *);
reference guide for more information.*/
#define barrier() asm volatile ("" : : : "memory")
/* Memory barrier.
The hardware will not complete instructions out of
order around a memory barrier. The compiler will
similarly refrain from reordering operations across
a memory barrier */
#define smp_barrier() asm volatile("mfence" : : : "memory")
#endif /* threads/synch.h */
......@@ -297,7 +297,7 @@ invalidate_pagedir_others (uint32_t *pd)
lock_acquire (&tlb_flush_state.lock);
tlb_flush_state.remaining = ncpu - 1;
tlb_flush_state.pd = pd;
barrier ();
smp_barrier ();
lapic_send_ipi_to_all_but_self (IPI_TLB);
/* We busy-wait here rather than blocking the calling thread
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment