RE: [PATCH 1/4] Drivers: hv: vmbus: implement get/put usage workflow for vmbus channels
> -Original Message- > From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] > Sent: Wednesday, February 4, 2015 1:01 AM > To: KY Srinivasan; de...@linuxdriverproject.org > Cc: Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui; Jason Wang > Subject: [PATCH 1/4] Drivers: hv: vmbus: implement get/put usage workflow for > vmbus channels > > free_channel() function frees the channel unconditionally so we need to make > sure nobody has any link to it. This is not trivial and there are several > examples of races we have: > > 1) In vmbus_onoffer_rescind() we check for channel existence with >relid2channel() and then use it. This can go wrong if we're in the middle >of channel removal (free_channel() was already called). > > 2) In process_chn_event() we check for channel existence with >pcpu_relid2channel() and then use it. This can also go wrong. > > 3) vmbus_free_channels() just frees all channels, in case we're in the middle >of vmbus_process_rescind_offer() crash is possible. > > The issue can be solved by holding vmbus_connection.channel_lock everywhere, > however, it looks like a way to deadlocks and performance degradation. Get/put > workflow fits here the best. > > Implement vmbus_get_channel()/vmbus_put_channel() pair instead of > free_channel(). > > Signed-off-by: Vitaly Kuznetsov > --- > drivers/hv/channel_mgmt.c | 45 > ++--- > drivers/hv/connection.c | 7 +-- > drivers/hv/hyperv_vmbus.h | 4 > include/linux/hyperv.h| 13 + > 4 files changed, 60 insertions(+), 9 deletions(-) > > diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c > index 36bacc7..eb9ce94 100644 > --- a/drivers/hv/channel_mgmt.c > +++ b/drivers/hv/channel_mgmt.c > @@ -147,6 +147,8 @@ static struct vmbus_channel *alloc_channel(void) > return NULL; > > channel->id = atomic_inc_return(&chan_num); > + atomic_set(&channel->count, 1); > + > spin_lock_init(&channel->inbound_lock); > spin_lock_init(&channel->lock); > > @@ -178,19 +180,47 @@ static void release_channel(struct work_struct *work) > } > > /* > - * free_channel - Release the resources used by the vmbus channel object > + * vmbus_put_channel - Decrease the channel usage counter and release the > + * resources when this counter reaches zero. > */ > -static void free_channel(struct vmbus_channel *channel) > +void vmbus_put_channel(struct vmbus_channel *channel) > { > + unsigned long flags; > > /* >* We have to release the channel's workqueue/thread in the vmbus's >* workqueue/thread context >* ie we can't destroy ourselves. >*/ > - INIT_WORK(&channel->work, release_channel); > - queue_work(vmbus_connection.work_queue, &channel->work); > + spin_lock_irqsave(&channel->lock, flags); > + if (atomic_dec_and_test(&channel->count)) { > + channel->dying = true; > + INIT_WORK(&channel->work, release_channel); > + spin_unlock_irqrestore(&channel->lock, flags); > + queue_work(vmbus_connection.work_queue, &channel->work); > + } else > + spin_unlock_irqrestore(&channel->lock, flags); > +} > +EXPORT_SYMBOL_GPL(vmbus_put_channel); > + > +/* vmbus_get_channel - Get additional reference to the channel */ > +struct vmbus_channel *vmbus_get_channel(struct vmbus_channel *channel) > +{ > + unsigned long flags; > + struct vmbus_channel *ret = NULL; > + > + if (!channel) > + return NULL; > + > + spin_lock_irqsave(&channel->lock, flags); > + if (!channel->dying) { > + atomic_inc(&channel->count); > + ret = channel; > + } > + spin_unlock_irqrestore(&channel->lock, flags); > + return ret; > } > +EXPORT_SYMBOL_GPL(vmbus_get_channel); > > static void percpu_channel_enq(void *arg) > { > @@ -253,7 +283,7 @@ static void vmbus_process_rescind_offer(struct > work_struct *work) > list_del(&channel->sc_list); > spin_unlock_irqrestore(&primary_channel->lock, flags); > } > - free_channel(channel); > + vmbus_put_channel(channel); > } > > void vmbus_free_channels(void) > @@ -262,7 +292,7 @@ void vmbus_free_channels(void) > > list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) { > vmbus_device_unregister(channel->device_obj); > - free_channel(channel); > + vmbus_put_channel(channel); > } > } > > @@ -391,7 +421,7 @@ done_init_rescind: > spin_unlock_irqrestore(&newchannel->lock, flags); > return; > err_free_chan: > - free_channel(newchannel); > + vmbus_put_channel(newchannel); > } > > enum { > @@ -549,6 +579,7 @@ static void vmbus_onoffer_rescind(struct > vmbus_channel_message_header *hdr) > queue_work(channel->controlwq, &channel->work); > > spin_unlock_irqrestore(&channel->lock, flags); > + vmbus_put_channel(c
Re: [PATCH 1/4] Drivers: hv: vmbus: implement get/put usage workflow for vmbus channels
On Wed, Feb 4, 2015 at 1:00 AM, Vitaly Kuznetsov wrote: free_channel() function frees the channel unconditionally so we need to make sure nobody has any link to it. This is not trivial and there are several examples of races we have: 1) In vmbus_onoffer_rescind() we check for channel existence with relid2channel() and then use it. This can go wrong if we're in the middle of channel removal (free_channel() was already called). 2) In process_chn_event() we check for channel existence with pcpu_relid2channel() and then use it. This can also go wrong. 3) vmbus_free_channels() just frees all channels, in case we're in the middle of vmbus_process_rescind_offer() crash is possible. The issue can be solved by holding vmbus_connection.channel_lock everywhere, however, it looks like a way to deadlocks and performance degradation. Get/put workflow fits here the best. Implement vmbus_get_channel()/vmbus_put_channel() pair instead of free_channel(). Signed-off-by: Vitaly Kuznetsov --- drivers/hv/channel_mgmt.c | 45 ++--- drivers/hv/connection.c | 7 +-- drivers/hv/hyperv_vmbus.h | 4 include/linux/hyperv.h| 13 + 4 files changed, 60 insertions(+), 9 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 36bacc7..eb9ce94 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -147,6 +147,8 @@ static struct vmbus_channel *alloc_channel(void) return NULL; channel->id = atomic_inc_return(&chan_num); + atomic_set(&channel->count, 1); + spin_lock_init(&channel->inbound_lock); spin_lock_init(&channel->lock); @@ -178,19 +180,47 @@ static void release_channel(struct work_struct *work) } /* - * free_channel - Release the resources used by the vmbus channel object + * vmbus_put_channel - Decrease the channel usage counter and release the + * resources when this counter reaches zero. */ -static void free_channel(struct vmbus_channel *channel) +void vmbus_put_channel(struct vmbus_channel *channel) { + unsigned long flags; /* * We have to release the channel's workqueue/thread in the vmbus's * workqueue/thread context * ie we can't destroy ourselves. */ - INIT_WORK(&channel->work, release_channel); - queue_work(vmbus_connection.work_queue, &channel->work); + spin_lock_irqsave(&channel->lock, flags); + if (atomic_dec_and_test(&channel->count)) { + channel->dying = true; + INIT_WORK(&channel->work, release_channel); + spin_unlock_irqrestore(&channel->lock, flags); + queue_work(vmbus_connection.work_queue, &channel->work); + } else + spin_unlock_irqrestore(&channel->lock, flags); +} +EXPORT_SYMBOL_GPL(vmbus_put_channel); + +/* vmbus_get_channel - Get additional reference to the channel */ +struct vmbus_channel *vmbus_get_channel(struct vmbus_channel *channel) +{ + unsigned long flags; + struct vmbus_channel *ret = NULL; + + if (!channel) + return NULL; + + spin_lock_irqsave(&channel->lock, flags); + if (!channel->dying) { + atomic_inc(&channel->count); + ret = channel; + } + spin_unlock_irqrestore(&channel->lock, flags); Looks like we can use atomic_inc_return_safe() here to avoid extra dying. And then there's also no need for the spinlock. if (atomic_inc_return_safe(&channel->count) > 0) return channel; else return NULL; + return ret; } +EXPORT_SYMBOL_GPL(vmbus_get_channel); static void percpu_channel_enq(void *arg) { @@ -253,7 +283,7 @@ static void vmbus_process_rescind_offer(struct work_struct *work) list_del(&channel->sc_list); spin_unlock_irqrestore(&primary_channel->lock, flags); } - free_channel(channel); + vmbus_put_channel(channel); } void vmbus_free_channels(void) @@ -262,7 +292,7 @@ void vmbus_free_channels(void) list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) { vmbus_device_unregister(channel->device_obj); - free_channel(channel); + vmbus_put_channel(channel); } } @@ -391,7 +421,7 @@ done_init_rescind: spin_unlock_irqrestore(&newchannel->lock, flags); return; err_free_chan: - free_channel(newchannel); + vmbus_put_channel(newchannel); } enum { @@ -549,6 +579,7 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr) queue_work(channel->controlwq, &channel->work); spin_unlock_irqrestore(&channel->lock, flags); + vmbus_put_channel(channel); } /* diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index c4acd1c..d1ce134 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -247,7 +247,8 @@ void vmbus_di
Re: [PATCH 1/4] Drivers: hv: vmbus: implement get/put usage workflow for vmbus channels
Dexuan Cui writes: >> -Original Message- >> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] >> Sent: Wednesday, February 4, 2015 1:01 AM >> To: KY Srinivasan; de...@linuxdriverproject.org >> Cc: Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui; Jason Wang >> Subject: [PATCH 1/4] Drivers: hv: vmbus: implement get/put usage workflow for >> vmbus channels >> >> free_channel() function frees the channel unconditionally so we need to make >> sure nobody has any link to it. This is not trivial and there are several >> examples of races we have: >> >> 1) In vmbus_onoffer_rescind() we check for channel existence with >>relid2channel() and then use it. This can go wrong if we're in the middle >>of channel removal (free_channel() was already called). >> >> 2) In process_chn_event() we check for channel existence with >>pcpu_relid2channel() and then use it. This can also go wrong. >> >> 3) vmbus_free_channels() just frees all channels, in case we're in the middle >>of vmbus_process_rescind_offer() crash is possible. >> >> The issue can be solved by holding vmbus_connection.channel_lock everywhere, >> however, it looks like a way to deadlocks and performance degradation. >> Get/put >> workflow fits here the best. >> >> Implement vmbus_get_channel()/vmbus_put_channel() pair instead of >> free_channel(). >> >> Signed-off-by: Vitaly Kuznetsov >> --- >> drivers/hv/channel_mgmt.c | 45 >> ++--- >> drivers/hv/connection.c | 7 +-- >> drivers/hv/hyperv_vmbus.h | 4 >> include/linux/hyperv.h| 13 + >> 4 files changed, 60 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c >> index 36bacc7..eb9ce94 100644 >> --- a/drivers/hv/channel_mgmt.c >> +++ b/drivers/hv/channel_mgmt.c >> @@ -147,6 +147,8 @@ static struct vmbus_channel *alloc_channel(void) >> return NULL; >> >> channel->id = atomic_inc_return(&chan_num); >> +atomic_set(&channel->count, 1); >> + >> spin_lock_init(&channel->inbound_lock); >> spin_lock_init(&channel->lock); >> >> @@ -178,19 +180,47 @@ static void release_channel(struct work_struct *work) >> } >> >> /* >> - * free_channel - Release the resources used by the vmbus channel object >> + * vmbus_put_channel - Decrease the channel usage counter and release the >> + * resources when this counter reaches zero. >> */ >> -static void free_channel(struct vmbus_channel *channel) >> +void vmbus_put_channel(struct vmbus_channel *channel) >> { >> +unsigned long flags; >> >> /* >> * We have to release the channel's workqueue/thread in the vmbus's >> * workqueue/thread context >> * ie we can't destroy ourselves. >> */ >> -INIT_WORK(&channel->work, release_channel); >> -queue_work(vmbus_connection.work_queue, &channel->work); >> +spin_lock_irqsave(&channel->lock, flags); >> +if (atomic_dec_and_test(&channel->count)) { >> +channel->dying = true; >> +INIT_WORK(&channel->work, release_channel); >> +spin_unlock_irqrestore(&channel->lock, flags); >> +queue_work(vmbus_connection.work_queue, &channel->work); >> +} else >> +spin_unlock_irqrestore(&channel->lock, flags); >> +} >> +EXPORT_SYMBOL_GPL(vmbus_put_channel); >> + >> +/* vmbus_get_channel - Get additional reference to the channel */ >> +struct vmbus_channel *vmbus_get_channel(struct vmbus_channel *channel) >> +{ >> +unsigned long flags; >> +struct vmbus_channel *ret = NULL; >> + >> +if (!channel) >> +return NULL; >> + >> +spin_lock_irqsave(&channel->lock, flags); >> +if (!channel->dying) { >> +atomic_inc(&channel->count); >> +ret = channel; >> +} >> +spin_unlock_irqrestore(&channel->lock, flags); >> +return ret; >> } >> +EXPORT_SYMBOL_GPL(vmbus_get_channel); >> >> static void percpu_channel_enq(void *arg) >> { >> @@ -253,7 +283,7 @@ static void vmbus_process_rescind_offer(struct >> work_struct *work) >> list_del(&channel->sc_list); >> spin_unlock_irqrestore(&primary_channel->lock, flags); >> } >> -free_channel(channel); >> +vmbus_put_channel(channel); >> } >> >> void vmbus_free_channels(void) >> @@ -262,7 +292,7 @@ void vmbus_free_channels(void) >> >> list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) { >> vmbus_device_unregister(channel->device_obj); >> -free_channel(channel); >> +vmbus_put_channel(channel); >> } >> } >> >> @@ -391,7 +421,7 @@ done_init_rescind: >> spin_unlock_irqrestore(&newchannel->lock, flags); >> return; >> err_free_chan: >> -free_channel(newchannel); >> +vmbus_put_channel(newchannel); >> } >> >> enum { >> @@ -549,6 +579,7 @@ static void vmbus_onoffer_rescind(struct >> vmbus_channel_message_header *hdr) >> queue_work(channel->c
Re: [PATCH 1/4] Drivers: hv: vmbus: implement get/put usage workflow for vmbus channels
Jason Wang writes: > On Wed, Feb 4, 2015 at 1:00 AM, Vitaly Kuznetsov > wrote: >> free_channel() function frees the channel unconditionally so we need >> to make >> sure nobody has any link to it. This is not trivial and there are >> several >> examples of races we have: >> >> 1) In vmbus_onoffer_rescind() we check for channel existence with >>relid2channel() and then use it. This can go wrong if we're in >> the middle >>of channel removal (free_channel() was already called). >> >> 2) In process_chn_event() we check for channel existence with >>pcpu_relid2channel() and then use it. This can also go wrong. >> >> 3) vmbus_free_channels() just frees all channels, in case we're in >> the middle >>of vmbus_process_rescind_offer() crash is possible. >> >> The issue can be solved by holding vmbus_connection.channel_lock >> everywhere, >> however, it looks like a way to deadlocks and performance >> degradation. Get/put >> workflow fits here the best. >> >> Implement vmbus_get_channel()/vmbus_put_channel() pair instead of >> free_channel(). >> >> Signed-off-by: Vitaly Kuznetsov >> --- >> drivers/hv/channel_mgmt.c | 45 >> ++--- >> drivers/hv/connection.c | 7 +-- >> drivers/hv/hyperv_vmbus.h | 4 >> include/linux/hyperv.h| 13 + >> 4 files changed, 60 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c >> index 36bacc7..eb9ce94 100644 >> --- a/drivers/hv/channel_mgmt.c >> +++ b/drivers/hv/channel_mgmt.c >> @@ -147,6 +147,8 @@ static struct vmbus_channel *alloc_channel(void) >> return NULL; >> channel->id = atomic_inc_return(&chan_num); >> +atomic_set(&channel->count, 1); >> + >> spin_lock_init(&channel->inbound_lock); >> spin_lock_init(&channel->lock); >> @@ -178,19 +180,47 @@ static void release_channel(struct >> work_struct *work) >> } >> /* >> - * free_channel - Release the resources used by the vmbus channel >> object >> + * vmbus_put_channel - Decrease the channel usage counter and >> release the >> + * resources when this counter reaches zero. >> */ >> -static void free_channel(struct vmbus_channel *channel) >> +void vmbus_put_channel(struct vmbus_channel *channel) >> { >> +unsigned long flags; >> /* >> * We have to release the channel's workqueue/thread in the vmbus's >> * workqueue/thread context >> * ie we can't destroy ourselves. >> */ >> -INIT_WORK(&channel->work, release_channel); >> -queue_work(vmbus_connection.work_queue, &channel->work); >> +spin_lock_irqsave(&channel->lock, flags); >> +if (atomic_dec_and_test(&channel->count)) { >> +channel->dying = true; >> +INIT_WORK(&channel->work, release_channel); >> +spin_unlock_irqrestore(&channel->lock, flags); >> +queue_work(vmbus_connection.work_queue, &channel->work); >> +} else >> +spin_unlock_irqrestore(&channel->lock, flags); >> +} >> +EXPORT_SYMBOL_GPL(vmbus_put_channel); >> + >> +/* vmbus_get_channel - Get additional reference to the channel */ >> +struct vmbus_channel *vmbus_get_channel(struct vmbus_channel >> *channel) >> +{ >> +unsigned long flags; >> +struct vmbus_channel *ret = NULL; >> + >> +if (!channel) >> +return NULL; >> + >> +spin_lock_irqsave(&channel->lock, flags); >> +if (!channel->dying) { >> +atomic_inc(&channel->count); >> +ret = channel; >> +} >> +spin_unlock_irqrestore(&channel->lock, flags); > > Looks like we can use atomic_inc_return_safe() here to avoid extra > dying. And then there's also no need for the spinlock. > > if (atomic_inc_return_safe(&channel->count) > 0) > return channel; > else > return NULL; Good idea, thanks! I'll try. >> >> +return ret; >> } >> +EXPORT_SYMBOL_GPL(vmbus_get_channel); >> static void percpu_channel_enq(void *arg) >> { >> @@ -253,7 +283,7 @@ static void vmbus_process_rescind_offer(struct >> work_struct *work) >> list_del(&channel->sc_list); >> spin_unlock_irqrestore(&primary_channel->lock, flags); >> } >> -free_channel(channel); >> +vmbus_put_channel(channel); >> } >> void vmbus_free_channels(void) >> @@ -262,7 +292,7 @@ void vmbus_free_channels(void) >> list_for_each_entry(channel, &vmbus_connection.chn_list, >> listentry) { >> vmbus_device_unregister(channel->device_obj); >> -free_channel(channel); >> +vmbus_put_channel(channel); >> } >> } >> @@ -391,7 +421,7 @@ done_init_rescind: >> spin_unlock_irqrestore(&newchannel->lock, flags); >> return; >> err_free_chan: >> -free_channel(newchannel); >> +vmbus_put_channel(newchannel); >> } >> enum { >> @@ -549,6 +579,7 @@ static void vmbus_onoffer_rescind(struct >> vmbus_channel_message_header *hdr) >> queue_work(channel->controlwq, &channel->work); >> spin
RE: [PATCH 1/4] Drivers: hv: vmbus: implement get/put usage workflow for vmbus channels
> -Original Message- > From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] > Sent: Wednesday, February 4, 2015 17:32 PM > To: Dexuan Cui > Cc: KY Srinivasan; de...@linuxdriverproject.org; Haiyang Zhang; linux- > ker...@vger.kernel.org; Jason Wang > Subject: Re: [PATCH 1/4] Drivers: hv: vmbus: implement get/put usage workflow > for vmbus channels > > Dexuan Cui writes: > > >> -Original Message- > >> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] > >> Sent: Wednesday, February 4, 2015 1:01 AM > >> To: KY Srinivasan; de...@linuxdriverproject.org > >> Cc: Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui; Jason Wang > >> Subject: [PATCH 1/4] Drivers: hv: vmbus: implement get/put usage workflow > for > >> vmbus channels > >> > >> free_channel() function frees the channel unconditionally so we need to > make > >> sure nobody has any link to it. This is not trivial and there are several > >> examples of races we have: > >> > >> 1) In vmbus_onoffer_rescind() we check for channel existence with > >>relid2channel() and then use it. This can go wrong if we're in the > >> middle > >>of channel removal (free_channel() was already called). > >> > >> 2) In process_chn_event() we check for channel existence with > >>pcpu_relid2channel() and then use it. This can also go wrong. > >> > >> 3) vmbus_free_channels() just frees all channels, in case we're in the > >> middle > >>of vmbus_process_rescind_offer() crash is possible. > >> > >> The issue can be solved by holding vmbus_connection.channel_lock > everywhere, > >> however, it looks like a way to deadlocks and performance degradation. > Get/put > >> workflow fits here the best. > >> > >> Implement vmbus_get_channel()/vmbus_put_channel() pair instead of > >> free_channel(). > >> > >> Signed-off-by: Vitaly Kuznetsov > >> --- > >> drivers/hv/channel_mgmt.c | 45 > >> ++--- > >> drivers/hv/connection.c | 7 +-- > >> drivers/hv/hyperv_vmbus.h | 4 > >> include/linux/hyperv.h| 13 + > >> 4 files changed, 60 insertions(+), 9 deletions(-) > >> > >> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c > >> index 36bacc7..eb9ce94 100644 > >> --- a/drivers/hv/channel_mgmt.c > >> +++ b/drivers/hv/channel_mgmt.c > >> @@ -147,6 +147,8 @@ static struct vmbus_channel *alloc_channel(void) > >>return NULL; > >> > >>channel->id = atomic_inc_return(&chan_num); > >> + atomic_set(&channel->count, 1); > >> + > >>spin_lock_init(&channel->inbound_lock); > >>spin_lock_init(&channel->lock); > >> > >> @@ -178,19 +180,47 @@ static void release_channel(struct work_struct > *work) > >> } > >> > >> /* > >> - * free_channel - Release the resources used by the vmbus channel object > >> + * vmbus_put_channel - Decrease the channel usage counter and release > the > >> + * resources when this counter reaches zero. > >> */ > >> -static void free_channel(struct vmbus_channel *channel) > >> +void vmbus_put_channel(struct vmbus_channel *channel) > >> { > >> + unsigned long flags; > >> > >>/* > >> * We have to release the channel's workqueue/thread in the vmbus's > >> * workqueue/thread context > >> * ie we can't destroy ourselves. > >> */ > >> - INIT_WORK(&channel->work, release_channel); > >> - queue_work(vmbus_connection.work_queue, &channel->work); > >> + spin_lock_irqsave(&channel->lock, flags); > >> + if (atomic_dec_and_test(&channel->count)) { > >> + channel->dying = true; > >> + INIT_WORK(&channel->work, release_channel); > >> + spin_unlock_irqrestore(&channel->lock, flags); > >> + queue_work(vmbus_connection.work_queue, &channel->work); > >> + } else > >> + spin_unlock_irqrestore(&channel->lock, flags); > >> +} > >> +EXPORT_SYMBOL_GPL(vmbus_put_channel); > >> + > >> +/* vmbus_get_channel - Get additional reference to the channel */ > >> +struct vmbus_channel *vmbus_get_channel(struct vmbus_channel *channel) > >> +{ > >> + unsigned long flags; > >> + struct vmbus_channel *ret = NULL; > >> + > >> + if (!channel) > >> + return NULL; > >> + > >> + spin_lock_irqsave(&channel->lock, flags); > >> + if (!channel->dying) { > >> + atomic_inc(&channel->count); > >> + ret = channel; > >> + } > >> + spin_unlock_irqrestore(&channel->lock, flags); > >> + return ret; > >> } > >> +EXPORT_SYMBOL_GPL(vmbus_get_channel); > >> > >> static void percpu_channel_enq(void *arg) > >> { > >> @@ -253,7 +283,7 @@ static void vmbus_process_rescind_offer(struct > >> work_struct *work) > >>list_del(&channel->sc_list); > >>spin_unlock_irqrestore(&primary_channel->lock, flags); > >>} > >> - free_channel(channel); > >> + vmbus_put_channel(channel); > >> } > >> > >> void vmbus_free_channels(void) > >> @@ -262,7 +292,7 @@ void vmbus_free_channels(void) > >> > >>list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) { > >>
[PATCH 1/2] staging: rtl8188eu: odm: condition with no effect
The if and the else branch code are identical - so the condition has no effect on the effective code - this patch removes the condition and the duplicated code. Signed-off-by: Nicholas Mc Guire --- The if/else performing the same settings in both branches so the condition has no effect. This needs a check by someone who knows the details of the driver as it could be that the two branches actually should be different. Patch was only compile-tested for x86_64_defconfig + CONFIG_STAGING=y CONFIG_R8188EU=m Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/staging/rtl8188eu/hal/odm.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c index 9873998..878c460 100644 --- a/drivers/staging/rtl8188eu/hal/odm.c +++ b/drivers/staging/rtl8188eu/hal/odm.c @@ -534,13 +534,8 @@ void odm_DIGInit(struct odm_dm_struct *pDM_Odm) pDM_DigTable->RssiHighThresh= DM_DIG_THRESH_HIGH; pDM_DigTable->FALowThresh = DM_false_ALARM_THRESH_LOW; pDM_DigTable->FAHighThresh = DM_false_ALARM_THRESH_HIGH; - if (pDM_Odm->BoardType == ODM_BOARD_HIGHPWR) { - pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; - pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC; - } else { - pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; - pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC; - } + pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; + pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC; pDM_DigTable->BackoffVal = DM_DIG_BACKOFF_DEFAULT; pDM_DigTable->BackoffVal_range_max = DM_DIG_BACKOFF_MAX; pDM_DigTable->BackoffVal_range_min = DM_DIG_BACKOFF_MIN; -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] staging: rtl8188eu: odm: conditional setting with no effect
The if and the else branch code are identical - so the condition has no effect on the effective code - this patch removes the condition and the duplicated code. Due to this being a fall-through-if here - the first if condition has no effect either - so it also can be removed. struct mlme_priv is thus also no longer needed here. Signed-off-by: Nicholas Mc Guire --- The if/else executes the same code in both branches so the condition has no effect. This needs a check by someone who knows the details of the driver as it could be that the two branches actually should be different. >From the comments it seems that an effect is actually intended so this may be a bug. The comment was updated to reflect the changes Patch was only compile-tested for x86_64_defconfig + CONFIG_STAGING=y CONFIG_R8188EU=m Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/staging/rtl8188eu/hal/odm.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c index 878c460..06477e8 100644 --- a/drivers/staging/rtl8188eu/hal/odm.c +++ b/drivers/staging/rtl8188eu/hal/odm.c @@ -1133,16 +1133,9 @@ static void FindMinimumRSSI(struct adapter *pAdapter) { struct hal_data_8188e *pHalData = GET_HAL_DATA(pAdapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - struct mlme_priv*pmlmepriv = &pAdapter->mlmepriv; - - /* 1 1.Determine the minimum RSSI */ - if ((check_fwstate(pmlmepriv, _FW_LINKED) == false) && - (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) - pdmpriv->MinUndecoratedPWDBForDM = 0; - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) /* Default port */ - pdmpriv->MinUndecoratedPWDBForDM = pdmpriv->EntryMinUndecoratedSmoothedPWDB; - else /* associated entry pwdb */ - pdmpriv->MinUndecoratedPWDBForDM = pdmpriv->EntryMinUndecoratedSmoothedPWDB; + + /* 1 1.Unconditionally set RSSI */ + pdmpriv->MinUndecoratedPWDBForDM = pdmpriv->EntryMinUndecoratedSmoothedPWDB; } void odm_RSSIMonitorCheckCE(struct odm_dm_struct *pDM_Odm) -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8188eu: core: switch with redundant cases
A few redundant switch cases as well as a redundant if/else within one of the cases was consolidated to a single call. The cases are intentionally retained for documentation purposes. Signed-off-by: Nicholas Mc Guire --- case WIFI_REASSOCREQ,WIFI_PROBEREQ,WIFI_BEACON,WIFI_ACTION all have the same effect - notably the also for WIFI_PROBEREQ where the if/else is executing the same function. These redundant cases could all be dropped and consolidated into the default but probably it is better for documentation/readability to leave them in the switch/case explicitly. Patch was only compile-tested for x86_64_defconfig + CONFIG_STAGING=y CONFIG_R8188EU=m Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/staging/rtl8188eu/core/rtw_mlme_ext.c |9 - 1 file changed, 9 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 28918201..cd12dd7 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -484,17 +484,8 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) /* fall through */ case WIFI_ASSOCREQ: case WIFI_REASSOCREQ: - _mgt_dispatcher(padapter, ptable, precv_frame); - break; case WIFI_PROBEREQ: - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) - _mgt_dispatcher(padapter, ptable, precv_frame); - else - _mgt_dispatcher(padapter, ptable, precv_frame); - break; case WIFI_BEACON: - _mgt_dispatcher(padapter, ptable, precv_frame); - break; case WIFI_ACTION: _mgt_dispatcher(padapter, ptable, precv_frame); break; -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8188eu: core: switch with redundant cases
On Wed, Feb 04, 2015 at 06:04:38AM -0500, Nicholas Mc Guire wrote: > A few redundant switch cases as well as a redundant if/else > within one of the cases was consolidated to a single call. > The cases are intentionally retained for documentation purposes. This statement is not clear. It obviously causes a bug if you just start deleting case statements. > > Signed-off-by: Nicholas Mc Guire > --- > case WIFI_REASSOCREQ,WIFI_PROBEREQ,WIFI_BEACON,WIFI_ACTION all > have the same effect - notably the also for WIFI_PROBEREQ where > the if/else is executing the same function. > > These redundant cases could all be dropped and consolidated into > the default but probably it is better for documentation/readability > to leave them in the switch/case explicitly. Oh. This explains what you meant. Stop putting this information below the cut off, it's annoying. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8188eu: core: switch with redundant cases
Btw, what tool are you using to find these? regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8188eu: core: switch with redundant cases
On Wed, Feb 04 2015, Nicholas Mc Guire wrote: > A few redundant switch cases as well as a redundant if/else > within one of the cases was consolidated to a single call. > The cases are intentionally retained for documentation purposes. > [...] > diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > index 28918201..cd12dd7 100644 > --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c > @@ -484,17 +484,8 @@ void mgt_dispatcher(struct adapter *padapter, struct > recv_frame *precv_frame) > /* fall through */ > case WIFI_ASSOCREQ: > case WIFI_REASSOCREQ: > - _mgt_dispatcher(padapter, ptable, precv_frame); > - break; > case WIFI_PROBEREQ: > - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) > - _mgt_dispatcher(padapter, ptable, precv_frame); > - else > - _mgt_dispatcher(padapter, ptable, precv_frame); It is highly unlikely that a function called check_fwstate has side effects, but it might be nice checking that and making a note in the commit log. Rasmus ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8188eu: core: switch with redundant cases
On Wed, 04 Feb 2015, Dan Carpenter wrote: > Btw, what tool are you using to find these? > working on a set of coccinell scripts - they are not yet really clean - but this one is simply: virtual context virtual patch virtual org virtual report @assign@ position p; statement S1; @@ <+... * if@p (...) S1 else S1 ...+> @script:python@ p << assign.p; @@ print "%s:%s WARNING: condition with no effect" % (p[0].file,p[0].line) I guess this is not wildly impressive - but it seems to be effective in finding a lot of broken code. The rate of false postivs has been supprisingly low (very few case of intentional if==else like in ./fs/kernfs/file.c:661 - which is nicely documented) thx! hofrat ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 03/20] power_supply: Add API for safe access of power supply function attrs
On Fri 2015-01-30 15:47:41, Krzysztof Kozlowski wrote: > Add simple wrappers for accessing power supply's function attributes: > - get_property -> power_supply_get_property > - set_property -> power_supply_set_property > - property_is_writeable -> power_supply_property_is_writeable > - external_power_changed -> power_supply_external_power_changed > > This API along with atomic usage counter adds a safe way of accessing a > power supply from another driver. If power supply is unregistered after > obtaining reference to it by some driver, then the API wrappers won't be > executed in invalid (freed) context. > > Next patch changing the ownership of power supply class is still needed > to fully fix race conditions in accessing freed power supply. > > Signed-off-by: Krzysztof Kozlowski > Reviewed-by: Bartlomiej Zolnierkiewicz > Reviewed-by: Sebastian Reichel For 1-3: Acked-by: Pavel Machek -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: hyper-v: allow access to vmbus from userspace driver
Hi Stephen, 2015-02-03 11:03, stephen hemminger: > Brocade is submitting a hyper-v driver for DPDK > but this driver needs a hook in the hyper-v bus layer > to allow the additional hv_uio driver to access the shared vmbus > pages. The hv_uio driver lives in DPDK (like igb_uio) and provides > userspace access to raw network packets. > > Signed-off-by: Stas Egorov > Signed-off-by: Stephen Hemminger The hyper-v driver for DPDK has not been sent yet to http://dpdk.org/dev/patchwork but it would be interesting to better explain this uio mapping. Thanks -- Thomas > --- a/drivers/hv/connection.c 2015-02-03 10:58:51.751752450 -0800 > +++ b/drivers/hv/connection.c 2015-02-03 10:58:51.751752450 -0800 > @@ -64,6 +64,21 @@ static __u32 vmbus_get_next_version(__u3 > } > } > > +static const uuid_le HV_NET_GUID = { > + .b = { > + 0x63, 0x51, 0x61, 0xf8, 0x3e, 0xdf, 0xc5, 0x46, > + 0x91, 0x3f, 0xf2, 0xd2, 0xf9, 0x65, 0xed, 0x0e > + } > +}; > + > +void vmbus_get_pages(unsigned long *int_page, unsigned long monitor_pages[2]) > +{ > + *int_page = (unsigned long)vmbus_connection.int_page; > + monitor_pages[0] = (unsigned long)vmbus_connection.monitor_pages[0]; > + monitor_pages[1] = (unsigned long)vmbus_connection.monitor_pages[1]; > +} > +EXPORT_SYMBOL_GPL(vmbus_get_pages); > + > static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, > __u32 version) > { > @@ -347,7 +362,8 @@ static void process_chn_event(u32 relid) > else > bytes_to_read = 0; > } while (read_state && (bytes_to_read != 0)); > - } else { > + } else if (!memcmp(&channel->device_obj->dev_type, &HV_NET_GUID, > +sizeof(uuid_le))) { > pr_err("no channel callback for relid - %u\n", relid); > } > > --- a/include/linux/hyperv.h 2015-02-03 10:58:51.751752450 -0800 > +++ b/include/linux/hyperv.h 2015-02-03 10:58:51.751752450 -0800 > @@ -868,6 +868,9 @@ extern int vmbus_recvpacket_raw(struct v > > extern void vmbus_ontimer(unsigned long data); > > +extern void vmbus_get_pages(unsigned long *int_page, > + unsigned long monitor_pages[2]); > + > /* Base driver object */ > struct hv_driver { > const char *name; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC 08/10] fsl_qman: Add debugfs support
From: Geoff Thorpe Change-Id: I59a75a91b289193b5ab1d30a08f60119dc4d7568 Signed-off-by: Geoff Thorpe --- drivers/staging/fsl_qbman/Kconfig|7 + drivers/staging/fsl_qbman/Makefile |2 + drivers/staging/fsl_qbman/qman_debugfs.c | 1326 ++ drivers/staging/fsl_qbman/qman_high.c| 58 ++ drivers/staging/fsl_qbman/qman_private.h |8 + include/linux/fsl_qman.h |6 + 6 files changed, 1407 insertions(+) create mode 100644 drivers/staging/fsl_qbman/qman_debugfs.c diff --git a/drivers/staging/fsl_qbman/Kconfig b/drivers/staging/fsl_qbman/Kconfig index 66a8361..9e2a25f 100644 --- a/drivers/staging/fsl_qbman/Kconfig +++ b/drivers/staging/fsl_qbman/Kconfig @@ -125,6 +125,13 @@ config FSL_QMAN_TEST_STASH_POTATO across a series of FQs scheduled to different portals (and cpus), with DQRR, data and context stashing always on. +config FSL_QMAN_DEBUGFS + tristate "QMan debugfs interface" + depends on DEBUG_FS + default y + ---help--- + This option compiles debugfs code for QMan. + # H/w settings that can be hard-coded for now. config FSL_QMAN_FQD_SZ int "size of Frame Queue Descriptor region" diff --git a/drivers/staging/fsl_qbman/Makefile b/drivers/staging/fsl_qbman/Makefile index 0287eab..5e93fff 100644 --- a/drivers/staging/fsl_qbman/Makefile +++ b/drivers/staging/fsl_qbman/Makefile @@ -19,3 +19,5 @@ obj-$(CONFIG_FSL_QMAN_TEST)+= qman_tester.o qman_tester-y= qman_test.o qman_tester-$(CONFIG_FSL_QMAN_TEST_HIGH)+= qman_test_high.o qman_tester-$(CONFIG_FSL_QMAN_TEST_STASH_POTATO) += qman_test_hotpotato.o +obj-$(CONFIG_FSL_QMAN_DEBUGFS) += qman_debugfs_interface.o +qman_debugfs_interface-y = qman_debugfs.o diff --git a/drivers/staging/fsl_qbman/qman_debugfs.c b/drivers/staging/fsl_qbman/qman_debugfs.c new file mode 100644 index 000..f5ab16d --- /dev/null +++ b/drivers/staging/fsl_qbman/qman_debugfs.c @@ -0,0 +1,1326 @@ +/* Copyright 2010-2011 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "qman_private.h" + +#define MAX_FQID (0x00ff) +#define QM_FQD_BLOCK_SIZE 64 +#define QM_FQD_AR(0xC10) + +static u32 fqid_max; +static u64 qman_ccsr_start; +static u64 qman_ccsr_size; + +static const char * const state_txt[] = { + "Out of Service", + "Retired", + "Tentatively Scheduled", + "Truly Scheduled", + "Parked", + "Active, Active Held or Held Suspended", + "Unknown State 6", + "Unknown State 7", + NULL, +}; + +static const u8 fqd_states[] = { + QM_MCR_NP_STATE_OOS, QM_MCR_NP_STATE_RETIRED, QM_MCR_NP_STATE_TEN_SCHED, + QM_MCR_NP_STATE_TRU_SCHED, QM_MCR_NP_STATE_PARKED, + QM_MCR_NP_STATE_ACTIVE}; + +struct mask_to_text { + u16 mask; + const char *txt; +}; + +struct mask_filter_s { + u16 mask; + u8 filter; +}; + +static const struct mask_filter_s mask_filter[] = { + {QM_FQCTRL_PREFERINCACHE, 0}, + {QM_FQCTRL_PREFERINCACHE, 1}, + {QM_FQCTRL_HOLDACTIVE, 0}, + {QM_FQCTRL_HOLDACTIVE, 1}, + {QM_FQCTRL_AVOI
[RFC 00/10] Freescale DPAA B/QMan drivers
Hello, This is the first attempt to publish the Freescale DPAA B/QMan drivers. They are not to be applied yet. At this stage, this is more or less the drivers from the Freescale PowerPC SDK roughly squashed and split in a sequence of component patches. They still needs some work and cleanup before we expect to have them applied, but we appreciate early feedback Cheers, Geoff Thorpe (8): fsl_bman: Add drivers for the Freescale DPAA BMan fsl_qman: Add drivers for the Freescale DPAA QMan powerpc/mpc85xx: Add platform support for the Freescale DPAA BMan powerpc/mpc85xx: Add platform support for the Freescale DPAA QMan fsl_bman: Add self-tester fsl_qman: Add self-tester fsl_bman: Add debugfs support fsl_qman: Add debugfs support Hai-Ying Wang (2): fsl_bman: Add HOTPLUG_CPU support fsl_qman: Add HOTPLUG_CPU support arch/powerpc/Kconfig| 33 +- arch/powerpc/platforms/85xx/Kconfig | 11 +- arch/powerpc/platforms/85xx/corenet_generic.c | 26 +- arch/powerpc/platforms/85xx/p1023_rdb.c | 26 +- drivers/staging/Kconfig |4 +- drivers/staging/Makefile|1 + drivers/staging/fsl_qbman/Kconfig | 188 ++ drivers/staging/fsl_qbman/Makefile | 23 + drivers/staging/fsl_qbman/bman_config.c | 611 ++ drivers/staging/fsl_qbman/bman_debugfs.c| 119 + drivers/staging/fsl_qbman/bman_driver.c | 373 drivers/staging/fsl_qbman/bman_high.c | 1055 + drivers/staging/fsl_qbman/bman_low.h| 524 + drivers/staging/fsl_qbman/bman_private.h| 149 ++ drivers/staging/fsl_qbman/bman_test.c | 56 + drivers/staging/fsl_qbman/bman_test.h | 44 + drivers/staging/fsl_qbman/bman_test_high.c | 181 ++ drivers/staging/fsl_qbman/bman_test_thresh.c| 196 ++ drivers/staging/fsl_qbman/dpa_alloc.c | 573 + drivers/staging/fsl_qbman/dpa_sys.h | 294 +++ drivers/staging/fsl_qbman/qbman_driver.c| 85 + drivers/staging/fsl_qbman/qman_config.c | 991 + drivers/staging/fsl_qbman/qman_debugfs.c| 1326 drivers/staging/fsl_qbman/qman_driver.c | 548 + drivers/staging/fsl_qbman/qman_high.c | 2624 +++ drivers/staging/fsl_qbman/qman_low.h| 1302 +++ drivers/staging/fsl_qbman/qman_private.h| 283 +++ drivers/staging/fsl_qbman/qman_test.c | 57 + drivers/staging/fsl_qbman/qman_test.h | 43 + drivers/staging/fsl_qbman/qman_test_high.c | 213 ++ drivers/staging/fsl_qbman/qman_test_hotpotato.c | 497 + drivers/staging/fsl_qbman/qman_utility.c| 129 ++ include/linux/fsl_bman.h| 517 + include/linux/fsl_qman.h| 1955 + 34 files changed, 15032 insertions(+), 25 deletions(-) create mode 100644 drivers/staging/fsl_qbman/Kconfig create mode 100644 drivers/staging/fsl_qbman/Makefile create mode 100644 drivers/staging/fsl_qbman/bman_config.c create mode 100644 drivers/staging/fsl_qbman/bman_debugfs.c create mode 100644 drivers/staging/fsl_qbman/bman_driver.c create mode 100644 drivers/staging/fsl_qbman/bman_high.c create mode 100644 drivers/staging/fsl_qbman/bman_low.h create mode 100644 drivers/staging/fsl_qbman/bman_private.h create mode 100644 drivers/staging/fsl_qbman/bman_test.c create mode 100644 drivers/staging/fsl_qbman/bman_test.h create mode 100644 drivers/staging/fsl_qbman/bman_test_high.c create mode 100644 drivers/staging/fsl_qbman/bman_test_thresh.c create mode 100644 drivers/staging/fsl_qbman/dpa_alloc.c create mode 100644 drivers/staging/fsl_qbman/dpa_sys.h create mode 100644 drivers/staging/fsl_qbman/qbman_driver.c create mode 100644 drivers/staging/fsl_qbman/qman_config.c create mode 100644 drivers/staging/fsl_qbman/qman_debugfs.c create mode 100644 drivers/staging/fsl_qbman/qman_driver.c create mode 100644 drivers/staging/fsl_qbman/qman_high.c create mode 100644 drivers/staging/fsl_qbman/qman_low.h create mode 100644 drivers/staging/fsl_qbman/qman_private.h create mode 100644 drivers/staging/fsl_qbman/qman_test.c create mode 100644 drivers/staging/fsl_qbman/qman_test.h create mode 100644 drivers/staging/fsl_qbman/qman_test_high.c create mode 100644 drivers/staging/fsl_qbman/qman_test_hotpotato.c create mode 100644 drivers/staging/fsl_qbman/qman_utility.c create mode 100644 include/linux/fsl_bman.h create mode 100644 include/linux/fsl_qman.h -- 2.2.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC 06/10] fsl_qman: Add self-tester
From: Geoff Thorpe Change-Id: I314d36d94717cfc34053b6212899f71cb729d16c Signed-off-by: Geoff Thorpe --- drivers/staging/fsl_qbman/Kconfig | 24 ++ drivers/staging/fsl_qbman/Makefile | 24 +- drivers/staging/fsl_qbman/qman_test.c | 57 +++ drivers/staging/fsl_qbman/qman_test.h | 43 ++ drivers/staging/fsl_qbman/qman_test_high.c | 213 ++ drivers/staging/fsl_qbman/qman_test_hotpotato.c | 497 6 files changed, 848 insertions(+), 10 deletions(-) create mode 100644 drivers/staging/fsl_qbman/qman_test.c create mode 100644 drivers/staging/fsl_qbman/qman_test.h create mode 100644 drivers/staging/fsl_qbman/qman_test_high.c create mode 100644 drivers/staging/fsl_qbman/qman_test_hotpotato.c diff --git a/drivers/staging/fsl_qbman/Kconfig b/drivers/staging/fsl_qbman/Kconfig index 1875dbf..fdf2f3b 100644 --- a/drivers/staging/fsl_qbman/Kconfig +++ b/drivers/staging/fsl_qbman/Kconfig @@ -94,6 +94,30 @@ config FSL_QMAN_CONFIG linux image is running as a guest OS under the hypervisor, only one guest OS ("the control plane") needs this option. +config FSL_QMAN_TEST + tristate "QMan self-tests" + default n + ---help--- + This option compiles self-test code for QMan. + +config FSL_QMAN_TEST_HIGH + bool "QMan high-level self-test" + depends on FSL_QMAN_TEST + default y + ---help--- + This requires the presence of cpu-affine portals, and performs + high-level API testing with them (whichever portal(s) are affine to + the cpu(s) the test executes on). + +config FSL_QMAN_TEST_STASH_POTATO + bool "QMan 'hot potato' data-stashing self-test" + depends on FSL_QMAN_TEST + default y + ---help--- + This performs a "hot potato" style test enqueuing/dequeuing a frame + across a series of FQs scheduled to different portals (and cpus), with + DQRR, data and context stashing always on. + # H/w settings that can be hard-coded for now. config FSL_QMAN_FQD_SZ int "size of Frame Queue Descriptor region" diff --git a/drivers/staging/fsl_qbman/Makefile b/drivers/staging/fsl_qbman/Makefile index 0fcdd84..04d61f7 100644 --- a/drivers/staging/fsl_qbman/Makefile +++ b/drivers/staging/fsl_qbman/Makefile @@ -1,15 +1,19 @@ # Common -obj-$(CONFIG_FSL_DPA) += dpa_alloc.o -obj-$(CONFIG_HAS_FSL_QBMAN)+= qbman_driver.o +obj-$(CONFIG_FSL_DPA) += dpa_alloc.o +obj-$(CONFIG_HAS_FSL_QBMAN) += qbman_driver.o # Bman -obj-$(CONFIG_FSL_BMAN) += bman_high.o -obj-$(CONFIG_FSL_BMAN_CONFIG) += bman_config.o bman_driver.o -obj-$(CONFIG_FSL_BMAN_TEST)+= bman_tester.o -bman_tester-y = bman_test.o -bman_tester-$(CONFIG_FSL_BMAN_TEST_HIGH) += bman_test_high.o -bman_tester-$(CONFIG_FSL_BMAN_TEST_THRESH) += bman_test_thresh.o +obj-$(CONFIG_FSL_BMAN) += bman_high.o +obj-$(CONFIG_FSL_BMAN_CONFIG) += bman_config.o bman_driver.o +obj-$(CONFIG_FSL_BMAN_TEST) += bman_tester.o +bman_tester-y= bman_test.o +bman_tester-$(CONFIG_FSL_BMAN_TEST_HIGH)+= bman_test_high.o +bman_tester-$(CONFIG_FSL_BMAN_TEST_THRESH) += bman_test_thresh.o # Qman -obj-$(CONFIG_FSL_QMAN) += qman_high.o qman_utility.o -obj-$(CONFIG_FSL_QMAN_CONFIG) += qman_config.o qman_driver.o +obj-$(CONFIG_FSL_QMAN) += qman_high.o qman_utility.o +obj-$(CONFIG_FSL_QMAN_CONFIG) += qman_config.o qman_driver.o +obj-$(CONFIG_FSL_QMAN_TEST) += qman_tester.o +qman_tester-y= qman_test.o +qman_tester-$(CONFIG_FSL_QMAN_TEST_HIGH)+= qman_test_high.o +qman_tester-$(CONFIG_FSL_QMAN_TEST_STASH_POTATO) += qman_test_hotpotato.o diff --git a/drivers/staging/fsl_qbman/qman_test.c b/drivers/staging/fsl_qbman/qman_test.c new file mode 100644 index 000..09d8ea6 --- /dev/null +++ b/drivers/staging/fsl_qbman/qman_test.c @@ -0,0 +1,57 @@ +/* Copyright 2008-2011 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote produ
[RFC 09/10] fsl_bman: Add HOTPLUG_CPU support
From: Hai-Ying Wang Change-Id: I863d5c15c7f35f9de4ea3d985e4ff467167924b7 Signed-off-by: Hai-Ying Wang --- drivers/staging/fsl_qbman/bman_driver.c | 45 - 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fsl_qbman/bman_driver.c b/drivers/staging/fsl_qbman/bman_driver.c index bab2283..18a6cdd 100644 --- a/drivers/staging/fsl_qbman/bman_driver.c +++ b/drivers/staging/fsl_qbman/bman_driver.c @@ -30,6 +30,9 @@ */ #include "bman_private.h" +#ifdef CONFIG_HOTPLUG_CPU +#include +#endif /* * Global variables of the max portal/pool number this bman version supported @@ -180,7 +183,7 @@ static int __init parse_bportals(char *str) } __setup("bportals=", parse_bportals); -static void bman_offline_cpu(unsigned int cpu) +static void __cold bman_offline_cpu(unsigned int cpu) { struct bman_portal *p = (struct bman_portal *)affine_bportals[cpu]; const struct bm_portal_config *pcfg; @@ -192,6 +195,42 @@ static void bman_offline_cpu(unsigned int cpu) } } +#ifdef CONFIG_HOTPLUG_CPU +static void __cold bman_online_cpu(unsigned int cpu) +{ + struct bman_portal *p = (struct bman_portal *)affine_bportals[cpu]; + const struct bm_portal_config *pcfg; + + if (p) { + pcfg = bman_get_bm_portal_config(p); + if (pcfg) + irq_set_affinity(pcfg->public_cfg.irq, cpumask_of(cpu)); + } +} + +static int __cold bman_hotplug_cpu_callback(struct notifier_block *nfb, + unsigned long action, void *hcpu) +{ + unsigned int cpu = (unsigned long)hcpu; + + switch (action) { + case CPU_ONLINE: + case CPU_ONLINE_FROZEN: + bman_online_cpu(cpu); + break; + case CPU_DOWN_PREPARE: + case CPU_DOWN_PREPARE_FROZEN: + bman_offline_cpu(cpu); + } + + return NOTIFY_OK; +} + +static struct notifier_block bman_hotplug_cpu_notifier = { + .notifier_call = bman_hotplug_cpu_callback, +}; +#endif /* CONFIG_HOTPLUG_CPU */ + /* Initialise the Bman driver. The meat of this function deals with portals. The * following describes the flow of portal-handling, the code "steps" refer to * this description; @@ -326,5 +365,9 @@ int __init bman_init(void) for_each_cpu(cpu, &offline_cpus) bman_offline_cpu(cpu); +#ifdef CONFIG_HOTPLUG_CPU + register_hotcpu_notifier(&bman_hotplug_cpu_notifier); +#endif + return 0; } -- 2.2.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC 10/10] fsl_qman: Add HOTPLUG_CPU support
From: Hai-Ying Wang Change-Id: Ica4d1b2b0fd3c3ae5e043663febd9f4cb7c762cf Signed-off-by: Hai-Ying Wang --- drivers/staging/fsl_qbman/qman_driver.c | 45 + 1 file changed, 45 insertions(+) diff --git a/drivers/staging/fsl_qbman/qman_driver.c b/drivers/staging/fsl_qbman/qman_driver.c index 5ca6221..7cd23bc 100644 --- a/drivers/staging/fsl_qbman/qman_driver.c +++ b/drivers/staging/fsl_qbman/qman_driver.c @@ -30,6 +30,9 @@ */ #include "qman_private.h" +#ifdef CONFIG_HOTPLUG_CPU +#include +#endif /* Global variable containing revision id (even on non-control plane systems * where CCSR isn't available) */ @@ -381,6 +384,45 @@ static void qman_offline_cpu(unsigned int cpu) } } +#ifdef CONFIG_HOTPLUG_CPU +static void qman_online_cpu(unsigned int cpu) +{ + struct qman_portal *p; + const struct qm_portal_config *pcfg; + p = (struct qman_portal *)affine_portals[cpu]; + if (p) { + pcfg = qman_get_qm_portal_config(p); + if (pcfg) { + irq_set_affinity(pcfg->public_cfg.irq, cpumask_of(cpu)); + qman_portal_update_sdest(pcfg, cpu); + } + } +} + +static int __cpuinit qman_hotplug_cpu_callback(struct notifier_block *nfb, + unsigned long action, void *hcpu) +{ + unsigned int cpu = (unsigned long)hcpu; + + switch (action) { + case CPU_ONLINE: + case CPU_ONLINE_FROZEN: + qman_online_cpu(cpu); + break; + case CPU_DOWN_PREPARE: + case CPU_DOWN_PREPARE_FROZEN: + qman_offline_cpu(cpu); + default: + break; + } + return NOTIFY_OK; +} + +static struct notifier_block qman_hotplug_cpu_notifier = { + .notifier_call = qman_hotplug_cpu_callback, +}; +#endif /* CONFIG_HOTPLUG_CPU */ + __init int qman_init(void) { struct cpumask slave_cpus; @@ -499,5 +541,8 @@ __init int qman_init(void) cpumask_andnot(&offline_cpus, cpu_possible_mask, cpu_online_mask); for_each_cpu(cpu, &offline_cpus) qman_offline_cpu(cpu); +#ifdef CONFIG_HOTPLUG_CPU + register_hotcpu_notifier(&qman_hotplug_cpu_notifier); +#endif return 0; } -- 2.2.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC 03/10] powerpc/mpc85xx: Add platform support for the Freescale DPAA BMan
From: Geoff Thorpe Change-Id: I59de17c040cdd304f86306336fcf89f130f7db2d Signed-off-by: Geoff Thorpe --- arch/powerpc/Kconfig | 33 +++ arch/powerpc/platforms/85xx/Kconfig | 11 + arch/powerpc/platforms/85xx/corenet_generic.c | 20 ++-- arch/powerpc/platforms/85xx/p1023_rdb.c | 20 +--- 4 files changed, 60 insertions(+), 24 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 89996f3..7b2e673 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -361,7 +361,7 @@ config PPC_TRANSACTIONAL_MEM select VSX default n ---help--- - Support user-mode Transactional Memory on POWERPC. +Support user-mode Transactional Memory on POWERPC. config IOMMU_HELPER def_bool PPC64 @@ -374,7 +374,7 @@ config SWIOTLB Support for IO bounce buffering for systems without an IOMMU. This allows us to DMA to the full physical address space on platforms where the size of a physical address is larger - than the bus address. Not all platforms support this. + than the bus address. Not all platforms support this. config HOTPLUG_CPU bool "Support for enabling/disabling CPUs" @@ -410,8 +410,8 @@ config KEXEC depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP)) help kexec is a system call that implements the ability to shutdown your - current kernel, and to start another kernel. It is like a reboot - but it is independent of the system firmware. And like a reboot + current kernel, and to start another kernel. It is like a reboot + but it is independent of the system firmware. And like a reboot you can start any kernel with it, not just Linux. The name comes from the similarity to the exec system call. @@ -450,7 +450,7 @@ config IRQ_ALL_CPUS help This option gives the kernel permission to distribute IRQs across multiple CPUs. Saying N here will route all IRQs to the first - CPU. Generally saying Y is safe, although some problems have been + CPU. Generally saying Y is safe, although some problems have been reported with SMP Power Macintoshes with this option enabled. config NUMA @@ -499,9 +499,9 @@ config ARCH_MEMORY_PROBE depends on MEMORY_HOTPLUG # Some NUMA nodes have memory ranges that span -# other nodes. Even though a pfn is valid and +# other nodes. Even though a pfn is valid and # between a node's start and end pfns, it may not -# reside on that node. See memmap_init_zone() +# reside on that node. See memmap_init_zone() # for details. config NODES_SPAN_OTHER_NODES def_bool y @@ -600,8 +600,8 @@ config FORCE_MAX_ZONEORDER This config option is actually maximum order plus one. For example, a value of 11 means that the largest free memory block is 2^10 pages. - The page size is not necessarily 4KB. For example, on 64-bit - systems, 64KB pages can be enabled via CONFIG_PPC_64K_PAGES. Keep + The page size is not necessarily 4KB. For example, on 64-bit + systems, 64KB pages can be enabled via CONFIG_PPC_64K_PAGES. Keep this in mind when choosing a value for this option. config PPC_SUBPAGE_PROT @@ -630,7 +630,7 @@ config PPC_DENORMALISATION default "y" if PPC_POWERNV ---help--- Add support for handling denormalisation of single precision - values. Useful for bare metal only. If unsure say Y here. + values. Useful for bare metal only. If unsure say Y here. config CMDLINE_BOOL bool "Default bootloader kernel arguments" @@ -740,7 +740,7 @@ config FSL_SOC bool config FSL_PCI - bool + bool select PPC_INDIRECT_PCI select PCI_QUIRKS @@ -778,12 +778,17 @@ config FSL_GTM help Freescale General-purpose Timers support +config HAS_FSL_QBMAN + bool "Datapath Acceleration Queue and Buffer management" + help + Datapath Acceleration Queue and Buffer management + # Yes MCA RS/6000s exist but Linux-PPC does not currently support any config MCA bool # Platforms that what PCI turned unconditionally just do select PCI -# in their config node. Platforms that want to choose at config +# in their config node. Platforms that want to choose at config # time should select PPC_PCI_CHOICE config PPC_PCI_CHOICE bool @@ -910,14 +915,14 @@ config DYNAMIC_MEMSTART select NONSTATIC_KERNEL help This option enables the kernel to be loaded at any page aligned - physical address. The kernel creates a mapping from KERNELBASE to + physical address. The kernel creates a mapping from KERNELBASE to the address where the kernel is loaded. The page size here implies the TLB page size
[RFC 04/10] powerpc/mpc85xx: Add platform support for the Freescale DPAA QMan
From: Geoff Thorpe Change-Id: I59de17c040cdd304f86306336fcf89f130f7db2d Signed-off-by: Geoff Thorpe --- arch/powerpc/platforms/85xx/corenet_generic.c | 8 +++- arch/powerpc/platforms/85xx/p1023_rdb.c | 8 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c index 74faab7..20b8f9a 100644 --- a/arch/powerpc/platforms/85xx/corenet_generic.c +++ b/arch/powerpc/platforms/85xx/corenet_generic.c @@ -198,15 +198,21 @@ static int __init corenet_generic_probe(void) } /* Early setup is required for large chunks of contiguous (and coarsely-aligned) - * memory. The following shoe-horns Bman "init_early" calls into the + * memory. The following shoe-horns Q/Bman "init_early" calls into the * platform setup to let them parse their CCSR nodes early on. */ +#ifdef CONFIG_FSL_QMAN_CONFIG +void __init qman_init_early(void); +#endif #ifdef CONFIG_FSL_BMAN_CONFIG void __init bman_init_early(void); #endif __init void corenet_ds_init_early(void) { +#ifdef CONFIG_FSL_QMAN_CONFIG + qman_init_early(); +#endif #ifdef CONFIG_FSL_BMAN_CONFIG bman_init_early(); #endif diff --git a/arch/powerpc/platforms/85xx/p1023_rdb.c b/arch/powerpc/platforms/85xx/p1023_rdb.c index 624d3d6..dc69801 100644 --- a/arch/powerpc/platforms/85xx/p1023_rdb.c +++ b/arch/powerpc/platforms/85xx/p1023_rdb.c @@ -106,14 +106,20 @@ static int __init p1023_rdb_probe(void) } /* Early setup is required for large chunks of contiguous (and coarsely-aligned) - * memory. The following shoe-horns Bman "init_early" calls into the + * memory. The following shoe-horns Q/Bman "init_early" calls into the * platform setup to let them parse their CCSR nodes early on. */ +#ifdef CONFIG_FSL_QMAN_CONFIG +void __init qman_init_early(void); +#endif #ifdef CONFIG_FSL_BMAN_CONFIG void __init bman_init_early(void); #endif static __init void p1023_rdb_init_early(void) { +#ifdef CONFIG_FSL_QMAN_CONFIG + qman_init_early(); +#endif #ifdef CONFIG_FSL_BMAN_CONFIG bman_init_early(); #endif -- 2.2.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC 07/10] fsl_bman: Add debugfs support
From: Geoff Thorpe Change-Id: I7eea7aea8a58ad0c28451b70801c0d101e88d263 Signed-off-by: Geoff Thorpe --- drivers/staging/fsl_qbman/Kconfig| 7 ++ drivers/staging/fsl_qbman/Makefile | 2 + drivers/staging/fsl_qbman/bman_debugfs.c | 119 +++ drivers/staging/fsl_qbman/bman_high.c| 19 + drivers/staging/fsl_qbman/dpa_sys.h | 1 + include/linux/fsl_bman.h | 6 ++ 6 files changed, 154 insertions(+) create mode 100644 drivers/staging/fsl_qbman/bman_debugfs.c diff --git a/drivers/staging/fsl_qbman/Kconfig b/drivers/staging/fsl_qbman/Kconfig index fdf2f3b..66a8361 100644 --- a/drivers/staging/fsl_qbman/Kconfig +++ b/drivers/staging/fsl_qbman/Kconfig @@ -74,6 +74,13 @@ config FSL_BMAN_TEST_THRESH "drainer" thread, and the other threads that they observe exactly the depletion state changes that are expected. +config FSL_BMAN_DEBUGFS + tristate "BMan debugfs interface" + depends on DEBUG_FS + default y + ---help--- + This option compiles debugfs code for BMan. + endif # FSL_BMAN config FSL_QMAN diff --git a/drivers/staging/fsl_qbman/Makefile b/drivers/staging/fsl_qbman/Makefile index 04d61f7..0287eab 100644 --- a/drivers/staging/fsl_qbman/Makefile +++ b/drivers/staging/fsl_qbman/Makefile @@ -9,6 +9,8 @@ obj-$(CONFIG_FSL_BMAN_TEST) += bman_tester.o bman_tester-y= bman_test.o bman_tester-$(CONFIG_FSL_BMAN_TEST_HIGH)+= bman_test_high.o bman_tester-$(CONFIG_FSL_BMAN_TEST_THRESH) += bman_test_thresh.o +obj-$(CONFIG_FSL_BMAN_DEBUGFS) += bman_debugfs_interface.o +bman_debugfs_interface-y = bman_debugfs.o # Qman obj-$(CONFIG_FSL_QMAN) += qman_high.o qman_utility.o diff --git a/drivers/staging/fsl_qbman/bman_debugfs.c b/drivers/staging/fsl_qbman/bman_debugfs.c new file mode 100644 index 000..b93e705 --- /dev/null +++ b/drivers/staging/fsl_qbman/bman_debugfs.c @@ -0,0 +1,119 @@ +/* Copyright 2010-2011 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +#include +#include +#include +#include + +static struct dentry *dfs_root; /* debugfs root directory */ + +/*** + * Query Buffer Pool State + **/ +static int query_bp_state_show(struct seq_file *file, void *offset) +{ + int ret; + struct bm_pool_state state; + int i, j; + u32 mask; + + memset(&state, 0, sizeof(struct bm_pool_state)); + ret = bman_query_pools(&state); + if (ret) { + seq_printf(file, "Error %d\n", ret); + return 0; + } + seq_puts(file, "bp_id free_buffers_avail bp_depleted\n"); + for (i = 0; i < 2; i++) { + mask = 0x8000; + for (j = 0; j < 32; j++) { + seq_printf(file, +" %-2u %-3s %-3s\n", +(i*32)+j, +(state.as.state.__state[i] & mask) ? "no" : "yes", +
[RFC 05/10] fsl_bman: Add self-tester
From: Geoff Thorpe Change-Id: If1b44bb013addc1e855c73a4e6ff74bc8b6e4829 Signed-off-by: Geoff Thorpe --- drivers/staging/fsl_qbman/Kconfig| 26 drivers/staging/fsl_qbman/Makefile | 16 ++- drivers/staging/fsl_qbman/bman_test.c| 56 drivers/staging/fsl_qbman/bman_test.h| 44 ++ drivers/staging/fsl_qbman/bman_test_high.c | 181 + drivers/staging/fsl_qbman/bman_test_thresh.c | 196 +++ 6 files changed, 513 insertions(+), 6 deletions(-) create mode 100644 drivers/staging/fsl_qbman/bman_test.c create mode 100644 drivers/staging/fsl_qbman/bman_test.h create mode 100644 drivers/staging/fsl_qbman/bman_test_high.c create mode 100644 drivers/staging/fsl_qbman/bman_test_thresh.c diff --git a/drivers/staging/fsl_qbman/Kconfig b/drivers/staging/fsl_qbman/Kconfig index db90fe5..1875dbf 100644 --- a/drivers/staging/fsl_qbman/Kconfig +++ b/drivers/staging/fsl_qbman/Kconfig @@ -48,6 +48,32 @@ config FSL_BMAN_CONFIG linux image is running as a guest OS under the hypervisor, only one guest OS ("the control plane") needs this option. +config FSL_BMAN_TEST + tristate "BMan self-tests" + default n + ---help--- + This option compiles self-test code for BMan. + +config FSL_BMAN_TEST_HIGH + bool "BMan high-level self-test" + depends on FSL_BMAN_TEST + default y + ---help--- + This requires the presence of cpu-affine portals, and performs + high-level API testing with them (whichever portal(s) are affine to + the cpu(s) the test executes on). + +config FSL_BMAN_TEST_THRESH + bool "BMan threshold test" + depends on FSL_BMAN_TEST + default y + ---help--- + Multi-threaded (SMP) test of BMan pool depletion. A pool is seeded + before multiple threads (one per cpu) create pool objects to track + depletion state changes. The pool is then drained to empty by a + "drainer" thread, and the other threads that they observe exactly + the depletion state changes that are expected. + endif # FSL_BMAN config FSL_QMAN diff --git a/drivers/staging/fsl_qbman/Makefile b/drivers/staging/fsl_qbman/Makefile index 399d87e..0fcdd84 100644 --- a/drivers/staging/fsl_qbman/Makefile +++ b/drivers/staging/fsl_qbman/Makefile @@ -1,11 +1,15 @@ # Common -obj-$(CONFIG_FSL_DPA) += dpa_alloc.o -obj-$(CONFIG_HAS_FSL_QBMAN)+= qbman_driver.o +obj-$(CONFIG_FSL_DPA) += dpa_alloc.o +obj-$(CONFIG_HAS_FSL_QBMAN)+= qbman_driver.o # Bman -obj-$(CONFIG_FSL_BMAN) += bman_high.o -obj-$(CONFIG_FSL_BMAN_CONFIG) += bman_config.o bman_driver.o +obj-$(CONFIG_FSL_BMAN) += bman_high.o +obj-$(CONFIG_FSL_BMAN_CONFIG) += bman_config.o bman_driver.o +obj-$(CONFIG_FSL_BMAN_TEST)+= bman_tester.o +bman_tester-y = bman_test.o +bman_tester-$(CONFIG_FSL_BMAN_TEST_HIGH) += bman_test_high.o +bman_tester-$(CONFIG_FSL_BMAN_TEST_THRESH) += bman_test_thresh.o # Qman -obj-$(CONFIG_FSL_QMAN) += qman_high.o qman_utility.o -obj-$(CONFIG_FSL_QMAN_CONFIG) += qman_config.o qman_driver.o +obj-$(CONFIG_FSL_QMAN) += qman_high.o qman_utility.o +obj-$(CONFIG_FSL_QMAN_CONFIG) += qman_config.o qman_driver.o diff --git a/drivers/staging/fsl_qbman/bman_test.c b/drivers/staging/fsl_qbman/bman_test.c new file mode 100644 index 000..1a261ee --- /dev/null +++ b/drivers/staging/fsl_qbman/bman_test.c @@ -0,0 +1,56 @@ +/* Copyright 2008-2011 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freesca
[RFC 01/10] fsl_bman: Add drivers for the Freescale DPAA BMan
From: Geoff Thorpe Change-Id: I075944acf740dbaae861104c17a9ff7247dec1be Signed-off-by: Geoff Thorpe --- drivers/staging/Kconfig |4 +- drivers/staging/Makefile |1 + drivers/staging/fsl_qbman/Kconfig| 52 ++ drivers/staging/fsl_qbman/Makefile |7 + drivers/staging/fsl_qbman/bman_config.c | 611 ++ drivers/staging/fsl_qbman/bman_driver.c | 330 ++ drivers/staging/fsl_qbman/bman_high.c| 1033 ++ drivers/staging/fsl_qbman/bman_low.h | 524 +++ drivers/staging/fsl_qbman/bman_private.h | 149 + drivers/staging/fsl_qbman/dpa_alloc.c| 404 drivers/staging/fsl_qbman/dpa_sys.h | 235 +++ drivers/staging/fsl_qbman/qbman_driver.c | 41 ++ include/linux/fsl_bman.h | 511 +++ 13 files changed, 3901 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/fsl_qbman/Kconfig create mode 100644 drivers/staging/fsl_qbman/Makefile create mode 100644 drivers/staging/fsl_qbman/bman_config.c create mode 100644 drivers/staging/fsl_qbman/bman_driver.c create mode 100644 drivers/staging/fsl_qbman/bman_high.c create mode 100644 drivers/staging/fsl_qbman/bman_low.h create mode 100644 drivers/staging/fsl_qbman/bman_private.h create mode 100644 drivers/staging/fsl_qbman/dpa_alloc.c create mode 100644 drivers/staging/fsl_qbman/dpa_sys.h create mode 100644 drivers/staging/fsl_qbman/qbman_driver.c create mode 100644 include/linux/fsl_bman.h diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 815de37..ffa8b2f 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -5,7 +5,7 @@ menuconfig STAGING This option allows you to select a number of drivers that are not of the "normal" Linux kernel quality level. These drivers are placed here in order to get a wider audience to make use of - them. Please note that these drivers are under heavy + them. Please note that these drivers are under heavy development, may or may not work, and may contain userspace interfaces that most likely will be changed in the near future. @@ -106,4 +106,6 @@ source "drivers/staging/unisys/Kconfig" source "drivers/staging/clocking-wizard/Kconfig" +source "drivers/staging/fsl_qbman/Kconfig" + endif # STAGING diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 33c640b..5403c54 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -45,3 +45,4 @@ obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/ obj-$(CONFIG_CRYPTO_SKEIN) += skein/ obj-$(CONFIG_UNISYSSPAR) += unisys/ obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/ +obj-$(CONFIG_FSL_DPA) += fsl_qbman/ diff --git a/drivers/staging/fsl_qbman/Kconfig b/drivers/staging/fsl_qbman/Kconfig new file mode 100644 index 000..9bf4e67 --- /dev/null +++ b/drivers/staging/fsl_qbman/Kconfig @@ -0,0 +1,52 @@ +config FSL_DPA + bool "Freescale Datapath Buffer management" + depends on HAS_FSL_QBMAN + default y + +menu "Freescale Datapath BMan options" + depends on FSL_DPA + +config FSL_DPA_CHECKING + bool "additional driver checking" + default n + ---help--- + Compiles in additional checks to sanity-check the drivers and any + use of it by other code. Not recommended for performance. + +config FSL_DPA_CAN_WAIT + bool + default y + +config FSL_DPA_CAN_WAIT_SYNC + bool + default y + +config FSL_DPA_PIRQ_FAST + bool + default y + +config FSL_DPA_PIRQ_SLOW + bool + default y + +config FSL_DPA_PORTAL_SHARE + bool + default y + +config FSL_BMAN + bool "Freescale Buffer Manager (BMan) support" + default y + +if FSL_BMAN + +config FSL_BMAN_CONFIG + bool "BMan device management" + default y + ---help--- + If this linux image is running natively, you need this option. If this + linux image is running as a guest OS under the hypervisor, only one + guest OS ("the control plane") needs this option. + +endif # FSL_BMAN + +endmenu diff --git a/drivers/staging/fsl_qbman/Makefile b/drivers/staging/fsl_qbman/Makefile new file mode 100644 index 000..d6e3605 --- /dev/null +++ b/drivers/staging/fsl_qbman/Makefile @@ -0,0 +1,7 @@ +# Common +obj-$(CONFIG_FSL_DPA) += dpa_alloc.o +obj-$(CONFIG_HAS_FSL_QBMAN)+= qbman_driver.o + +# Bman +obj-$(CONFIG_FSL_BMAN) += bman_high.o +obj-$(CONFIG_FSL_BMAN_CONFIG) += bman_config.o bman_driver.o diff --git a/drivers/staging/fsl_qbman/bman_config.c b/drivers/staging/fsl_qbman/bman_config.c new file mode 100644 index 000..1cd1d9a --- /dev/null +++ b/drivers/staging/fsl_qbman/bman_config.c @@ -0,0 +1,611 @@ +/* Copyright (c) 2009-2012 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with o
RE: [PATCH RFC] staging: comedi: dt282x: condition with no effect - if identical to else
On Tuesday, February 03, 2015 8:13 AM, Ian Abbott wrote: > On 03/02/15 12:38, Nicholas Mc Guire wrote: >> The if and the else branch code are identical - so the condition has no >> effect on the effective code - this patch removes the condition and the >> duplicated code. >> >> Signed-off-by: Nicholas Mc Guire >> --- >> >> The if and else branch are identical code thus the condition has no effect >> >> if (cmd->scan_begin_src == TRIG_FOLLOW) { >> /* internal trigger */ >> err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); >> } else { >> /* external trigger */ >> /* should be level/edge, hi/lo specification here */ >> err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); >> } >> > I think what that comment means is that it should allow scan_begin_arg > to have various combinations of the CR_EDGE and CR_INVERT bits set. > I.e. it ought to allow whatever combination of CR_EDGE and CR_INVERT > better describes the nature of the external trigger signal, in addition > to allowing the lazy default value 0. > > I don't know what the nature of the external trigger signal is, as I > haven't seen the manual. I think Hartley might have seen one. According to the manual, the external trigger is not "programmable". It's a Schmitt trigger input, enables on TTL logic low, with a 22K pullup. Since the 'scan_begin_arg' is not actually used for the analog input async command, I think removing the comments completely is fine. Just change the check to: err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); Regards, Hartley ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH RFC] staging: comedi: dt282x: condition with no effect - if identical to else
On Wed, 04 Feb 2015, Hartley Sweeten wrote: > On Tuesday, February 03, 2015 8:13 AM, Ian Abbott wrote: > > On 03/02/15 12:38, Nicholas Mc Guire wrote: > >> The if and the else branch code are identical - so the condition has no > >> effect on the effective code - this patch removes the condition and the > >> duplicated code. > >> > >> Signed-off-by: Nicholas Mc Guire > >> --- > >> > >> The if and else branch are identical code thus the condition has no effect > >> > >> if (cmd->scan_begin_src == TRIG_FOLLOW) { > >> /* internal trigger */ > >> err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); > >> } else { > >> /* external trigger */ > >> /* should be level/edge, hi/lo specification here */ > >> err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); > >> } > >> > > I think what that comment means is that it should allow scan_begin_arg > > to have various combinations of the CR_EDGE and CR_INVERT bits set. > > I.e. it ought to allow whatever combination of CR_EDGE and CR_INVERT > > better describes the nature of the external trigger signal, in addition > > to allowing the lazy default value 0. > > > > I don't know what the nature of the external trigger signal is, as I > > haven't seen the manual. I think Hartley might have seen one. > > According to the manual, the external trigger is not "programmable". It's > a Schmitt trigger input, enables on TTL logic low, with a 22K pullup. > > Since the 'scan_begin_arg' is not actually used for the analog input async > command, I think removing the comments completely is fine. Just change > the check to: > > err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); > thanks for that clarification - will fix it up and resend. thx! hofrat ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: comedi: dt282x: condition with no effect - if identical to else
The if and the else branch code are identical - so the condition has no effect on the effective code - this patch removes the condition and the duplicated code. Signed-off-by: Nicholas Mc Guire --- v2: Review notes from Ian Abbott and Hartley Sweeten confirm that the condition is not needed and, as suggested, the misleading comment is completely removed. Patch was only compile tested for x86_64_defconfig + CONFIG_STAGING=y CONFIG_COMEDI=m, COMEDI_ISA_DRIVERS=y, CONFIG_COMEDI_DT282X=m Patch is against 3.19.0-rc7 (localversion = -next-20150204) drivers/staging/comedi/drivers/dt282x.c |9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 051dfb2..db21d21 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -685,14 +685,7 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->scan_begin_src == TRIG_FOLLOW) { - /* internal trigger */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - } else { - /* external trigger */ - /* should be level/edge, hi/lo specification here */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - } + err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 4000); -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: gdm724x: gdm_tty: Fix for possible null pointer dereference
2015-02-02 17:36 GMT+01:00 Sudip Mukherjee : > On Thu, Jan 29, 2015 at 07:46:10PM +0100, Rickard Strandqvist wrote: >> Fix a possible null pointer dereference, there is >> otherwise a risk of a possible null pointer dereference. >> >> This was found using a static code analysis program called cppcheck >> >> Signed-off-by: Rickard Strandqvist >> --- >> drivers/staging/gdm724x/gdm_tty.c |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/gdm724x/gdm_tty.c >> b/drivers/staging/gdm724x/gdm_tty.c >> index 001348c..66b356e 100644 >> --- a/drivers/staging/gdm724x/gdm_tty.c >> +++ b/drivers/staging/gdm724x/gdm_tty.c >> @@ -145,7 +145,7 @@ static int gdm_tty_recv_complete(void *data, >> struct gdm *gdm = tty_dev->gdm[index]; >> >> if (!GDM_TTY_READY(gdm)) { >> - if (complete == RECV_PACKET_PROCESS_COMPLETE) >> + if (gdm && complete == RECV_PACKET_PROCESS_COMPLETE) > GDM_TTY_READY() is already checking for gdm, there is no chance that gdm can > be null at this point. so this additional check is not required. > > regards > sudip >> gdm_tty_recv(gdm, gdm_tty_recv_complete); >> return TO_HOST_PORT_CLOSE; >> } >> -- >> 1.7.10.4 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in >> the body of a message to majord...@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> Please read the FAQ at http://www.tux.org/lkml/ Hi Sudip Yes, GDM_TTY_READY checks gdm, but this is a if(! ) Kind regards Rickard Strandqvist ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: comedi: dt282x: condition with no effect - if identical to else
On 04/02/15 17:02, Nicholas Mc Guire wrote: The if and the else branch code are identical - so the condition has no effect on the effective code - this patch removes the condition and the duplicated code. Signed-off-by: Nicholas Mc Guire --- v2: Review notes from Ian Abbott and Hartley Sweeten confirm that the condition is not needed and, as suggested, the misleading comment is completely removed. Patch was only compile tested for x86_64_defconfig + CONFIG_STAGING=y CONFIG_COMEDI=m, COMEDI_ISA_DRIVERS=y, CONFIG_COMEDI_DT282X=m Patch is against 3.19.0-rc7 (localversion = -next-20150204) drivers/staging/comedi/drivers/dt282x.c |9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 051dfb2..db21d21 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -685,14 +685,7 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->scan_begin_src == TRIG_FOLLOW) { - /* internal trigger */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - } else { - /* external trigger */ - /* should be level/edge, hi/lo specification here */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - } + err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 4000); Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 0/4] Drivers: hv: Further protection for the rescind path
> -Original Message- > From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] > Sent: Tuesday, February 3, 2015 9:01 AM > To: KY Srinivasan; de...@linuxdriverproject.org > Cc: Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui; Jason Wang > Subject: [PATCH 0/4] Drivers: hv: Further protection for the rescind path > > This series is a continuation of the "Drivers: hv: vmbus: serialize Offer and > Rescind offer". I'm trying to address a number of theoretically possible > issues > with rescind offer handling. All these complications come from the fact that a > rescind offer results in vmbus channel being freed and we must ensure > nobody still uses it. Instead of introducing new locks I suggest we switch > channels usage to the get/put workflow. > > The main part of the series is [PATCH 1/4] which introduces the workflow for > vmbus channels, all other patches fix different corner cases using this > workflow. I'm not sure all such cases are covered with this series (probably > not), but in case protection is required in some other places it should become > relatively easy to add one. > > I did some sanity testing with CONFIG_DEBUG_LOCKDEP=y and nothing > popped out, however, additional testing would be much appreciated. > > K.Y., Haiyang, I'm not sending this series to netdev@ and linux-scsi@ as it is > supposed to be applied as a whole, please resend these patches with your > sign-offs when (and if) we're done with reviews. Thanks! Vitaly, Thanks for looking into this issue. While today, rescind offer results in the freeing of the channel, I don't think that is required. By not freeing up the channel in the rescind path, we can have a safe way to access the channel and that does not have to involve taking a reference on the channel every time you access it - the get/put workflow in your patch set. As part of the network performance improvement work, I had eliminated all locks in the receive path by setting up per-cpu data structures for mapping the relid to channel etc. These set of patches introduces locking/atomic operations in performance critical code paths to deal with an event that is truly rare - the channel getting rescinded. All channel messages are handled in a single work context: vmbus_on_msg_dpc() -> vmbus_onmessage_work()-> Various channel messages [offer, rescind etc.] So, the rescind message cannot be processed while we are processing the offer message and since an offer cannot be rescinded before it is offered, offer and rescind are naturally serialized (I think I have patchset in my queue from you that is trying to solve the concurrent execution of offer and rescind and looking at the code I cannot see how this can occur). As part of handling the rescind message, we will just set the channel state to indicate that the offer is rescinded (we can add the rescind state to the channel states already defined and this will be done under the protection of the channel lock). The cleanup of the channel and sending of the RELID release message will only be done in the context of the driver as part of driver remove function. I think this should be doable in a way that does not penalize the normal path. If it is ok with you, I will try to put together a patch along the lines I have described here. Regards, K. Y > > Vitaly Kuznetsov (4): > Drivers: hv: vmbus: implement get/put usage workflow for vmbus > channels > Drivers: hv: vmbus: do not lose rescind offer on failure in > vmbus_process_offer() > Drivers: hv: vmbus: protect vmbus_get_outgoing_channel() against > channel removal > hyperv: netvsc: improve protection against rescind offer > > drivers/hv/channel_mgmt.c | 75 > + > drivers/hv/connection.c | 7 +++-- > drivers/hv/hyperv_vmbus.h | 4 +++ > drivers/net/hyperv/netvsc.c | 10 -- drivers/scsi/storvsc_drv.c | 2 ++ > include/linux/hyperv.h | 13 > 6 files changed, 95 insertions(+), 16 deletions(-) > > -- > 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC 00/10] Freescale DPAA B/QMan drivers
On Wed, Feb 04, 2015 at 08:48:32AM -0600, Emil Medve wrote: > > Hello, > > > This is the first attempt to publish the Freescale DPAA B/QMan drivers. They > are > not to be applied yet. At this stage, this is more or less the drivers from > the > Freescale PowerPC SDK roughly squashed and split in a sequence of component > patches. They still needs some work and cleanup before we expect to have them > applied, but we appreciate early feedback First off, why put these in staging? What's keeping them from being merged "properly"? Secondly, if they are going to go into staging, then I need a TODO file in the directory of the driver listing what needs to be done to move the code out of staging, and who is responsible for the code. Ideally a MAINTAINERS entry as well. And finally, staging drivers should be self-contained, your .h files: > include/linux/fsl_bman.h| 517 + > include/linux/fsl_qman.h| 1955 + Need to be in drivers/staging// not in include/linux/ espeically as nothing outside of your driver needs these .h files. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1 linux-next] staging: lustre: make obd_updatemax_lock static
obd_updatemax_lock is only used in class_obd.c Signed-off-by: Fabian Frederick --- drivers/staging/lustre/lustre/obdclass/class_obd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 89a3fb2..29456e1 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -61,7 +61,7 @@ __u64 obd_alloc; EXPORT_SYMBOL(obd_alloc); __u64 obd_pages; EXPORT_SYMBOL(obd_pages); -DEFINE_SPINLOCK(obd_updatemax_lock); +static DEFINE_SPINLOCK(obd_updatemax_lock); /* The following are visible and mutable through /proc/sys/lustre/. */ unsigned int obd_alloc_fail_rate = 0; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: rtl8192u: r8192U_core: Fix for possible null pointer dereference
2015-02-02 17:51 GMT+01:00 Sudip Mukherjee : > On Thu, Jan 29, 2015 at 07:59:12PM +0100, Rickard Strandqvist wrote: >> Fix a possible null pointer dereference, there is >> otherwise a risk of a possible null pointer dereference. >> >> This was found using a static code analysis program called cppcheck >> >> Signed-off-by: Rickard Strandqvist >> --- >> drivers/staging/rtl8192u/r8192U_core.c |8 >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/staging/rtl8192u/r8192U_core.c >> b/drivers/staging/rtl8192u/r8192U_core.c >> index e031a25..4a29237 100644 >> --- a/drivers/staging/rtl8192u/r8192U_core.c >> +++ b/drivers/staging/rtl8192u/r8192U_core.c >> @@ -4476,11 +4476,11 @@ static void query_rxdesc_status(struct sk_buff *skb, >> >> /* for debug 2008.5.29 */ >> >> - //added by vivi, for MP, 20080108 >> - stats->RxIs40MHzPacket = driver_info->BW; >> - if (stats->RxDrvInfoSize != 0) >> + if (driver_info && stats->RxDrvInfoSize != 0) { >> + //added by vivi, for MP, 20080108 >> + stats->RxIs40MHzPacket = driver_info->BW; >> TranslateRxSignalStuff819xUsb(skb, stats, driver_info); >> - >> + } > but isn't the logic getting changed here? > > regards > sudip > >> } Hi Sudip Yes partly, but that's too ensure that driver_info is not null. Se call TranslateRxSignalStuff819xUsb() -> call rtl8192_query_rxphystatus() Where driver_info is pdrvinfo, and is used as: pdrvinfo->RxHT && pdrvinfo->RxRate and more. Or perhaps change in rtl8192_query_rxphystatus() instead? Kind regards Rickard Strandqvist ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Caro usuário
Caro usuário, Esta é para informá-lo que alguém estava tentando entrar sua conta email de um local diferente {IP:37. 187.138.129 {França: 22/01/2015 02:36 GTM} Se você não estiver por favor siga as instruções abaixo para atualizar e Verifique apenas 12 horas de sua conta para fazer isso fim de manter seu endereço de e-mail está ativo. Email: SENHA: RE-CONTRASENA: Data de nascimento: Este e-mail é sujeito à fiscalização obrigatória, Não-conformidade resultaria na suspensão da sua conta de e-mail eletrônico. Atenciosamente Equipe de suporte técnico. Esta mensagem, incluindo seus anexos, pode conter informacoes privilegiadas e/ou de carater confidencial, nao podendo ser retransmitida sem autorizacao do remetente. Se voce nao e o destinatario ou pessoa autorizada a recebe-la, informamos que o seu uso, divulgacao, copia ou arquivamento sao proibidos. Portanto, se você recebeu esta mensagem por engano, por favor, nos informe respondendo imediatamente a este e-mail e ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC 00/10] Freescale DPAA B/QMan drivers
Hello Greg, Thanks for looking at this On 02/04/2015 12:40 PM, Greg KH wrote: > On Wed, Feb 04, 2015 at 08:48:32AM -0600, Emil Medve wrote: >> >> Hello, >> >> >> This is the first attempt to publish the Freescale DPAA B/QMan drivers. They >> are >> not to be applied yet. At this stage, this is more or less the drivers from >> the >> Freescale PowerPC SDK roughly squashed and split in a sequence of component >> patches. They still needs some work and cleanup before we expect to have them >> applied, but we appreciate early feedback > > First off, why put these in staging? What's keeping them from being > merged "properly"? I was thinking they'll go into drivers/soc. Past some cleanup and some integration issues, nothing holds them back > Secondly, if they are going to go into staging, then I need a TODO file > in the directory of the driver listing what needs to be done to move the > code out of staging, and who is responsible for the code. Ideally a > MAINTAINERS entry as well. Will get both lists, say, for the next post > And finally, staging drivers should be self-contained, your .h files: > >> include/linux/fsl_bman.h| 517 + >> include/linux/fsl_qman.h| 1955 + > > Need to be in drivers/staging// not in include/linux/ > espeically as nothing outside of your driver needs these .h files. These files contain the public interface(s) used by other devices connected to the B/QMan: FMan, PME, RMan, DCE, etc. Every driver/piece of code in need of a HW queue (QMan) or HW buffer allocator (BMan) will use these files Cheers, ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net] hyperv: Fix the error processing in netvsc_send()
> -Original Message- > From: Jason Wang [mailto:jasow...@redhat.com] > Sent: Wednesday, February 4, 2015 2:29 AM > > The EAGAIN error doesn't normally happen, because we set the hi water > > mark > > to stop send queue. > > This is not true since only txq was stopped which means only network > stack stop sending packets but not for control path e.g > rndis_filter_send_request() or other callers who call > vmbus_sendpacket() directly (e.g recv completion). > > For control path, user may meet several errors when they want to change > mac address under heavy load. > > What's more serious is netvsc_send_recv_completion(), it can not even > recover from more than 3 times of EAGAIN. > > I must say mixing data packets with control packets with the same > channel sounds really scary. Since control packets could be blocked or > even dropped because of data packets already queued during heavy load, > and you need to synchronize two paths carefully (e.g I didn't see any > tx lock were held if rndis_filter_send_request() call netsc_send() > which may stop or start a queue). The RING_AVAIL_PERCENT_HIWATER is defined to be 20, so the data traffic can only occupy 20% of the ring buffer before stopping the txq. So, this mechanism ensures the control messages are not blocked by data traffic. > > If in really rare case, the ring buffer is full and there > > is no outstanding sends, we can't stop queue here because there will > > be no > > send-completion msg to wake it up. > > Confused, I believe only txq is stopped but we may still get completion > interrupt in this case. If there is no outstanding sends in this queue (queue_sends[q_idx]), we won't receive any more send-completion msg. > > > And, the ring buffer is likely to be > > occupied by other special msg, e.g. receive-completion msg (not a > > normal case), > > so we can't assume there are available slots. > > Then why not checking hv_ringbuf_avail_percent() instead? And there's > no need to check queue_sends since it does not count recv completion. When ret == -EAGAIN, which means the ring is full, we don't need to check hv_ringbuf_avail_percent(). > > We don't request retry from > > the upper layer in this case to avoid possible busy retry. > > Can't we just do this by stopping txq and depending on tx interrupt to > wake it? There is no tx interrupt. Do you mean rx interrupt for the send-completion? In usual cases, when we hit the high water mark, the stopped queue depends on the send-completion msg to wake up. But, not in some special cases. As said above, we won't receive any more send-completion msg when there is no outstanding sends in this queue. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next v2] hyper-v: allow access to vmbus from userspace driver
This is enables the hyper-v driver for DPDK . The hv_uio driver needs to access the shared vmbus monitor pages. I would also like to put hv_uio in upstream kernel like other uio drivers, but need to get API accepted with DPDK first. Signed-off-by: Stas Egorov Signed-off-by: Stephen Hemminger --- v2 - simplify and rename to vmbus_get_monitor_pages drivers/hv/connection.c | 20 +--- include/linux/hyperv.h |3 +++ 2 files changed, 20 insertions(+), 3 deletions(-) --- a/drivers/hv/connection.c 2015-02-03 10:58:51.751752450 -0800 +++ b/drivers/hv/connection.c 2015-02-04 14:59:51.636194383 -0800 @@ -64,6 +64,15 @@ static __u32 vmbus_get_next_version(__u3 } } +void vmbus_get_monitor_pages(unsigned long *int_page, +unsigned long monitor_pages[2]) +{ + *int_page = (unsigned long)vmbus_connection.int_page; + monitor_pages[0] = (unsigned long)vmbus_connection.monitor_pages[0]; + monitor_pages[1] = (unsigned long)vmbus_connection.monitor_pages[1]; +} +EXPORT_SYMBOL_GPL(vmbus_get_monitor_pages); + static int vmbus_negotiate_version(struct vmbus_channel_msginfo *msginfo, __u32 version) { @@ -347,10 +356,7 @@ static void process_chn_event(u32 relid) else bytes_to_read = 0; } while (read_state && (bytes_to_read != 0)); - } else { - pr_err("no channel callback for relid - %u\n", relid); } - } /* --- a/include/linux/hyperv.h2015-02-03 10:58:51.751752450 -0800 +++ b/include/linux/hyperv.h2015-02-04 15:00:26.388355012 -0800 @@ -868,6 +868,9 @@ extern int vmbus_recvpacket_raw(struct v extern void vmbus_ontimer(unsigned long data); +extern void vmbus_get_monitor_pages(unsigned long *int_page, + unsigned long monitor_pages[2]); + /* Base driver object */ struct hv_driver { const char *name; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC 00/10] Freescale DPAA B/QMan drivers
On Wed, Feb 04, 2015 at 04:16:30PM -0600, Emil Medve wrote: > Hello Greg, > > > Thanks for looking at this > > On 02/04/2015 12:40 PM, Greg KH wrote: > > On Wed, Feb 04, 2015 at 08:48:32AM -0600, Emil Medve wrote: > >> > >> Hello, > >> > >> > >> This is the first attempt to publish the Freescale DPAA B/QMan drivers. > >> They are > >> not to be applied yet. At this stage, this is more or less the drivers > >> from the > >> Freescale PowerPC SDK roughly squashed and split in a sequence of component > >> patches. They still needs some work and cleanup before we expect to have > >> them > >> applied, but we appreciate early feedback > > > > First off, why put these in staging? What's keeping them from being > > merged "properly"? > > I was thinking they'll go into drivers/soc. Past some cleanup and some > integration issues, nothing holds them back Then spend the day or so to do that work and avoid staging entirely! > > Secondly, if they are going to go into staging, then I need a TODO file > > in the directory of the driver listing what needs to be done to move the > > code out of staging, and who is responsible for the code. Ideally a > > MAINTAINERS entry as well. > > Will get both lists, say, for the next post > > > And finally, staging drivers should be self-contained, your .h files: > > > >> include/linux/fsl_bman.h| 517 + > >> include/linux/fsl_qman.h| 1955 + > > > > Need to be in drivers/staging// not in include/linux/ > > espeically as nothing outside of your driver needs these .h files. > > These files contain the public interface(s) used by other devices > connected to the B/QMan: FMan, PME, RMan, DCE, etc. Every driver/piece > of code in need of a HW queue (QMan) or HW buffer allocator (BMan) will > use these files Ok, but you can't have in-kernel code depend on staging tree code, sorry, so if you want it in staging, it has to be self-contained. Yet another reason for you to clean it up properly and merge it to the correct place first. good luck, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[Patch v4 01/23] ACPICA: Resources: Provide common part for struct acpi_resource_address structures.
From: Lv Zheng struct acpi_resource_address and struct acpi_resource_extended_address64 share substracts just at different offsets. To unify the parsing functions, OSPMs like Linux need a new ACPI_ADDRESS64_ATTRIBUTE as their substructs, so they can extract the shared data. This patch also synchronizes the structure changes to the Linux kernel. The usages are searched by matching the following keywords: 1. acpi_resource_address 2. acpi_resource_extended_address 3. ACPI_RESOURCE_TYPE_ADDRESS 4. ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS And we found and fixed the usages in the following files: arch/ia64/kernel/acpi-ext.c arch/ia64/pci/pci.c arch/x86/pci/acpi.c arch/x86/pci/mmconfig-shared.c drivers/xen/xen-acpi-memhotplug.c drivers/acpi/acpi_memhotplug.c drivers/acpi/pci_root.c drivers/acpi/resource.c drivers/char/hpet.c drivers/pnp/pnpacpi/rsparser.c drivers/hv/vmbus_drv.c Build tests are passed with defconfig/allnoconfig/allyesconfig and defconfig+CONFIG_ACPI=n. Original-by: Thomas Gleixner Original-by: Jiang Liu Signed-off-by: Lv Zheng Signed-off-by: Jiang Liu --- arch/ia64/kernel/acpi-ext.c |6 ++-- arch/ia64/pci/pci.c | 14 - arch/x86/pci/acpi.c | 26 arch/x86/pci/mmconfig-shared.c|6 ++-- drivers/acpi/acpi_memhotplug.c|8 ++--- drivers/acpi/acpica/rsaddr.c |9 +++--- drivers/acpi/acpica/rsdumpinfo.c | 59 +++-- drivers/acpi/acpica/rsxface.c | 10 +++ drivers/acpi/pci_root.c |6 ++-- drivers/acpi/resource.c | 24 +++ drivers/char/hpet.c |4 +-- drivers/hv/vmbus_drv.c|4 +-- drivers/pnp/pnpacpi/rsparser.c| 16 +- drivers/xen/xen-acpi-memhotplug.c |8 ++--- include/acpi/acrestyp.h | 40 +++-- 15 files changed, 125 insertions(+), 115 deletions(-) diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c index 8b9318d311a0..bd09bf74f187 100644 --- a/arch/ia64/kernel/acpi-ext.c +++ b/arch/ia64/kernel/acpi-ext.c @@ -69,10 +69,10 @@ static acpi_status find_csr_space(struct acpi_resource *resource, void *data) status = acpi_resource_to_address64(resource, &addr); if (ACPI_SUCCESS(status) && addr.resource_type == ACPI_MEMORY_RANGE && - addr.address_length && + addr.address.address_length && addr.producer_consumer == ACPI_CONSUMER) { - space->base = addr.minimum; - space->length = addr.address_length; + space->base = addr.address.minimum; + space->length = addr.address.address_length; return AE_CTRL_TERMINATE; } return AE_OK; /* keep looking */ diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 900cc93e5409..48cc65705db4 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -188,12 +188,12 @@ static u64 add_io_space(struct pci_root_info *info, name = (char *)(iospace + 1); - min = addr->minimum; - max = min + addr->address_length - 1; + min = addr->address.minimum; + max = min + addr->address.address_length - 1; if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION) sparse = 1; - space_nr = new_space(addr->translation_offset, sparse); + space_nr = new_space(addr->address.translation_offset, sparse); if (space_nr == ~0) goto free_resource; @@ -247,7 +247,7 @@ static acpi_status resource_to_window(struct acpi_resource *resource, if (ACPI_SUCCESS(status) && (addr->resource_type == ACPI_MEMORY_RANGE || addr->resource_type == ACPI_IO_RANGE) && - addr->address_length && + addr->address.address_length && addr->producer_consumer == ACPI_PRODUCER) return AE_OK; @@ -284,7 +284,7 @@ static acpi_status add_window(struct acpi_resource *res, void *data) if (addr.resource_type == ACPI_MEMORY_RANGE) { flags = IORESOURCE_MEM; root = &iomem_resource; - offset = addr.translation_offset; + offset = addr.address.translation_offset; } else if (addr.resource_type == ACPI_IO_RANGE) { flags = IORESOURCE_IO; root = &ioport_resource; @@ -297,8 +297,8 @@ static acpi_status add_window(struct acpi_resource *res, void *data) resource = &info->res[info->res_num]; resource->name = info->name; resource->flags = flags; - resource->start = addr.minimum + offset; - resource->end = resource->start + addr.address_length - 1; + resource->start = addr.address.minimum + offset; + resource->end = resource->start + addr.address.address_length - 1; info->res_offset[info->res_num] = offset; if (insert_resource(root, resource)) { diff --git
[PATCH] storvsc: assign wait_for_completion_timeout to appropriately typed var
wait_for_completion_timeout() returns unsigned long not int. This assigns the return value to an appropriately typed variable. Signed-off-by: Nicholas Mc Guire --- As a suitable typed and named variable "timeout" is available and there is no conflict in this case no new variable is needed rather the declaration is simply updated. Patch was only compile tested for x86_64_defconfig + CONFIG_X86_VSMP=y CONFIG_HYPERV=m, SCSI_LOWLEVEL=y, CONFIG_HYPERV_STORAGE=m Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/scsi/storvsc_drv.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index efc6e44..a993d12 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -796,7 +796,8 @@ static void handle_multichannel_storage(struct hv_device *device, int max_chns) int num_sc; struct storvsc_cmd_request *request; struct vstor_packet *vstor_packet; - int ret, t; + int ret; + unsigned long t; num_sc = ((max_chns > num_cpus) ? num_cpus : max_chns); stor_device = get_out_stor_device(device); @@ -861,7 +862,8 @@ static int storvsc_channel_init(struct hv_device *device) struct storvsc_device *stor_device; struct storvsc_cmd_request *request; struct vstor_packet *vstor_packet; - int ret, t; + int ret; + unsigned long t; int max_chns; bool process_sub_channels = false; -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel