?????????Linux?豸?????е????????
???????????? ???????[ 2015/5/7 13:34:54 ] ??????????????
??????????????????????????????????????豸??????????????
static atomic_t xxx_available = ATOMIC_INIT(1); // ??????????
static int xxx_open(struct inode *inode?? struct file *filp)
{
...
if(!atomic_dec_and_test(&xxx_available))
{
atomic_inc(&xxx_availble);
return - EBUSY; // ?????
}
...
return 0; // ???
}
static int xxx_release(struct inode *inode?? struct file *filp)
{
atomic_inc(&xxx_available); // ????豸
return 0;
}
???????????????:
??????????VS?????
?????????????????????????????????????????ε??????Σ?????????????????????CPU???????????????????????????????????????????????????????????????У????????????·???????????????????????????????????????????????л?????????????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????????????л??????????CPU?ò????????????CPU??????????????????е???????????????????????????????????????????
??????????????????裺
????1.??????????
????spinlock_t lock;
????2.???????????
????spin_lock_init(lock);??????????????????????????lock??
????3.?????????
????spin_lock(lock);?ú???????????????????????????????????????????????????????????????????????????????
????spin_trylock(lock);????????????棬????????????????????????????
????4.?????????
????spin_unlock(lock);
????????????????????????????????? ???????????????????????CPU???CPU???????????????????????????·?????????????????????????ж????(BH)????????????????????????????????????
????spin_lock_irq() = spin_lock() + local_irq_disable()
????spin_unlock_irq() = spin_unlock() + local_irq_enable()
????spin_lock_irqsave() = spin_lock() + local_irq_save()
????spin_unlock_irqrestore() = spin_unlock() + local_irq_restore()
????spin_lock_bh() = spin_lock() + local_bh_disable()
????spin_unlock_bh() = spin_unlock() + local_bh_enable()
????????????????????????????????????????佇???????£?????????????????????????????????????????????????????????????????????????
?????????
????spinlock_t lock;
????spin_lock_init(&lock);
????spin_lock(&lock); //????????????????????
?????????????????
????spin_unlock(&lock);//?????????
??????????????????????????????????????е?????????????????д???????????????????????ж???????????????????????е?????????????????????????????????????????????????????д???????????????????????????????????????????ж??????????????????????????д????????????С?
????????????????????????????????д???????????????????????????д???????????????????д????????????????????????С??????????????????д????????????????????
????????????????????????????????????????????
??????д??????(rwlock)??????????????д???????棬?????????д???????????????棬???????ж??????е?????????????д??????????С?
// ???????????д??????
rwlock_t my_rwlock = RW_LOCK_UNLOCKED; // ????????
rwlock_t my_rwlock;
rwlock)init(&my_rwlock); // ????????
// ????????????????????ж?????????????????????????????????????????
void read_lock(rwlock_t *lock);
void read_lock_irqsave(rwlock_t *lock?? unsigned long flags);
void read_lock_irq(rwlock_t *lock);
void read_lock_bh(rwlock_t *lock);
// ??????
void read_unlock(rwlock_t *lock);
void read_unlock_irqrestore(rwlock_t *lock?? unsigned long flags);
void read_unlock_irq(rwlock_t *lock);
void read_unlock_bh(rwlock_t *lock);
// д???????????????????д??????????д???????????????????д????????
void write_lock(rwlock_t *lock);
void write_lock_irqsave(rwlock_t *lock?? unsigned long flags);
void write_lock_irq(rwlock_t *lock);
void write_lock_bh(rwlock_t *lock);
int write_trylock(rwlock_t *lock);
// д????
void write_unlock(rwlock_t *lock);
void write_unlock_irqsave(rwlock_t *lock?? unsigned long flags);
void write_unlock_irq(rwlock_t *lock);
void write_unlock_bh(rwlock_t *lock);
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Linux??????DDR????????????Linux?????????????????豸??????????linux???в???????????м??????????????????????????Linux????Linux??DNS????????????γ???????????Linux?????????????Linux????(???)????????Linux ????????????????????????????????Windows???У?Linux???????Linux????????????????Linux iommu??vfio???????Linux????ε???TCP???????Linux?????????????СLinux?·???????????Linux???Jexus?й?Asp.Net Core??ó???Linux?????????Щ??
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????