Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] compat-wireless: add iwlwifi RCU compat
@ 2011-10-18  8:07 Johannes Berg
  2011-11-16  7:51 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2011-10-18  8:07 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: Hauke Mehrtens, linux-wireless

From: Johannes Berg <johannes.berg@intel.com>

We need to patch the new kfree_rcu() reference in
iwlwifi out and add rcu_barrier() to make it safe.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
Obviously the patch needing this isn't upstream yet, but I wanted to
give you this patch for when it comes upstream. If you prefer we hold
the compat patch and send it together with the kernel patch let me know
we can try to do that.

diff --git a/patches/41-no-kfree-rcu.patch b/patches/41-no-kfree-rcu.patch
index c18b50d..37c5c1b 100644
--- a/patches/41-no-kfree-rcu.patch
+++ b/patches/41-no-kfree-rcu.patch
@@ -81,3 +81,42 @@
  
  static int ieee80211_compatible_rates(const u8 *supp_rates, int supp_rates_len,
  				      struct ieee80211_supported_band *sband,
+--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c	2011-10-17 18:29:19.000000000 +0200
++++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c	2011-10-18 10:00:27.000000000 +0200
+@@ -1032,6 +1032,14 @@ static int iwlagn_rx_reply_rx(struct iwl
+ 	return 0;
+ }
+ 
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,40))
++static void kfree_noa_data(struct rcu_head *head)
++{
++	void *data = container_of(head, struct iwl_wipan_noa_data, rcu_head);
++	kfree(data);
++}
++#endif
++
+ static int iwlagn_rx_noa_notification(struct iwl_priv *priv,
+ 				      struct iwl_rx_mem_buffer *rxb,
+ 				      struct iwl_device_cmd *cmd)
+@@ -1071,7 +1079,11 @@ static int iwlagn_rx_noa_notification(st
+ 	rcu_assign_pointer(priv->noa_data, new_data);
+ 
+ 	if (old_data)
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,40))
++		call_rcu(&old_data->rcu_head, kfree_noa_data);
++#else
+ 		kfree_rcu(old_data, rcu_head);
++#endif
+ 
+ 	return 0;
+ }
+--- a/drivers/net/wireless/iwlwifi/iwl-agn.c	2011-10-17 18:29:19.000000000 +0200
++++ b/drivers/net/wireless/iwlwifi/iwl-agn.c	2011-10-18 10:00:44.000000000 +0200
+@@ -3460,6 +3460,7 @@ static void __exit iwl_exit(void)
+ {
+ 	iwl_pci_unregister_driver();
+ 	iwlagn_rate_control_unregister();
++	rcu_barrier();
+ }
+ 
+ module_exit(iwl_exit);



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] compat-wireless: add iwlwifi RCU compat
  2011-10-18  8:07 [PATCH] compat-wireless: add iwlwifi RCU compat Johannes Berg
@ 2011-11-16  7:51 ` Johannes Berg
  2011-11-16  7:57   ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2011-11-16  7:51 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: Hauke Mehrtens, linux-wireless

On Tue, 2011-10-18 at 10:07 +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> We need to patch the new kfree_rcu() reference in
> iwlwifi out and add rcu_barrier() to make it safe.

Ping. Need to apply this now, see
http://mid.gmane.org/20111116104133.E58B.2E210E2F@nifty.com

johannes

> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> Obviously the patch needing this isn't upstream yet, but I wanted to
> give you this patch for when it comes upstream. If you prefer we hold
> the compat patch and send it together with the kernel patch let me know
> we can try to do that.
> 
> diff --git a/patches/41-no-kfree-rcu.patch b/patches/41-no-kfree-rcu.patch
> index c18b50d..37c5c1b 100644
> --- a/patches/41-no-kfree-rcu.patch
> +++ b/patches/41-no-kfree-rcu.patch
> @@ -81,3 +81,42 @@
>   
>   static int ieee80211_compatible_rates(const u8 *supp_rates, int supp_rates_len,
>   				      struct ieee80211_supported_band *sband,
> +--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c	2011-10-17 18:29:19.000000000 +0200
> ++++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c	2011-10-18 10:00:27.000000000 +0200
> +@@ -1032,6 +1032,14 @@ static int iwlagn_rx_reply_rx(struct iwl
> + 	return 0;
> + }
> + 
> ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,40))
> ++static void kfree_noa_data(struct rcu_head *head)
> ++{
> ++	void *data = container_of(head, struct iwl_wipan_noa_data, rcu_head);
> ++	kfree(data);
> ++}
> ++#endif
> ++
> + static int iwlagn_rx_noa_notification(struct iwl_priv *priv,
> + 				      struct iwl_rx_mem_buffer *rxb,
> + 				      struct iwl_device_cmd *cmd)
> +@@ -1071,7 +1079,11 @@ static int iwlagn_rx_noa_notification(st
> + 	rcu_assign_pointer(priv->noa_data, new_data);
> + 
> + 	if (old_data)
> ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,40))
> ++		call_rcu(&old_data->rcu_head, kfree_noa_data);
> ++#else
> + 		kfree_rcu(old_data, rcu_head);
> ++#endif
> + 
> + 	return 0;
> + }
> +--- a/drivers/net/wireless/iwlwifi/iwl-agn.c	2011-10-17 18:29:19.000000000 +0200
> ++++ b/drivers/net/wireless/iwlwifi/iwl-agn.c	2011-10-18 10:00:44.000000000 +0200
> +@@ -3460,6 +3460,7 @@ static void __exit iwl_exit(void)
> + {
> + 	iwl_pci_unregister_driver();
> + 	iwlagn_rate_control_unregister();
> ++	rcu_barrier();
> + }
> + 
> + module_exit(iwl_exit);
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] compat-wireless: add iwlwifi RCU compat
  2011-11-16  7:51 ` Johannes Berg
@ 2011-11-16  7:57   ` Johannes Berg
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2011-11-16  7:57 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: Hauke Mehrtens, linux-wireless

On Wed, 2011-11-16 at 08:51 +0100, Johannes Berg wrote:
> On Tue, 2011-10-18 at 10:07 +0200, Johannes Berg wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> > 
> > We need to patch the new kfree_rcu() reference in
> > iwlwifi out and add rcu_barrier() to make it safe.
> 
> Ping. Need to apply this now, see
> http://mid.gmane.org/20111116104133.E58B.2E210E2F@nifty.com

Or do Hauke's other proposed kfree_rcu backport of course :-)

johannes


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-16  7:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18  8:07 [PATCH] compat-wireless: add iwlwifi RCU compat Johannes Berg
2011-11-16  7:51 ` Johannes Berg
2011-11-16  7:57   ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox