Skip to contentSkip to conversation

Move an assert under DEBUG_KERNEL.

PATCH In review Rob Landley 3 participants 7 messages Jan 6, 2011 – Jan 11, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Move an assert under DEBUG_KERNEL.

From: Rob Landley <[email protected]>

Move an assert under DEBUG_KERNEL.

---

Saves about 3k from x86-64 defconfig according to scripts/bloat-o-meter.

 include/linux/rtnetlink.h |    4 ++++
 1 file changed, 4 insertions(+)
include/linux/rtnetlink.h +4 -0
index bbad657..28c4025 100644
@@ -782,6 +782,7 @@ extern struct netdev_queue *dev_ingress_queue_create(struct net_device *dev);
 extern void rtnetlink_init(void);
 extern void __rtnl_unlock(void);
 
+#ifdef CONFIG_DEBUG_KERNEL
 #define ASSERT_RTNL() do { \
 	if (unlikely(!rtnl_is_locked())) { \
 		printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \
@@ -789,6 +790,9 @@ extern void __rtnl_unlock(void);
 		dump_stack(); \
 	} \
 } while(0)
+#else
+#define ASSERT_RTNL()
+#endif
 
 static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
 {
#1 lore raw
Quoted 26 lines · On Thu, 6 Jan 2011 02:13:38 -0600 Rob Landley <[email protected]> wrote:

From: Rob Landley <[email protected]>

Move an assert under DEBUG_KERNEL.

---

Saves about 3k from x86-64 defconfig according to scripts/bloat-o-meter.

  include/linux/rtnetlink.h |    4 ++++
  1 file changed, 4 insertions(+)
include/linux/rtnetlink.h +1 -0
index bbad657..28c4025 100644
@@ -782,6 +782,7 @@ extern struct netdev_queue 
 *dev_ingress_queue_create(struct net_device *dev);
  extern void rtnetlink_init(void);
  extern void __rtnl_unlock(void);
 
+#ifdef CONFIG_DEBUG_KERNEL
  #define ASSERT_RTNL() do { \
  	if (unlikely(!rtnl_is_locked())) { \
  		printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \

include/linux/rtnetlink.h extern void __rtnl_unlock(void); · line 798

Quoted 9 lines
include/linux/rtnetlink.h +3 -0
@@ -789,6 +790,9 @@ extern void __rtnl_unlock(void);
  		dump_stack(); \
  	} \
  } while(0)
+#else
+#define ASSERT_RTNL()
+#endif
 
  static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
  {

Probably a worthwhile thing to do, IMO. If there's some net-specific CONFIG_DEBUG_ setting then that wold be a better thing to use.

However the patch was a) wordwrapped, b) space-stuffed and c) not cc'ed to the networking list. So its prospects are dim.

#2 lore raw
Quoted 12 lines · Andrew Morton
Quoted 12 lines
include/linux/rtnetlink.h +4 -0
+#ifdef CONFIG_DEBUG_KERNEL
   #define ASSERT_RTNL() do { \
   	if (unlikely(!rtnl_is_locked())) { \
   		printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \
@@ -789,6 +790,9 @@ extern void __rtnl_unlock(void);
   		dump_stack(); \
   	} \
   } while(0)
+#else
+#define ASSERT_RTNL()
+#endif
 
Quoted 5 lines

include/linux/rtnetlink.h extern void __rtnl_unlock(void); · line 798

Quoted 2 lines
include/linux/rtnetlink.h +0 -0
   static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
   {

Probably a worthwhile thing to do, IMO. If there's some net-specific CONFIG_DEBUG_ setting then that wold be a better thing to use.

I looked and didn't find one. lib/Kconfig.debug has DEBUG_OBJECTS and PROVE_LOCKING and such but nothing quite on topic. The only "DEBUG" in net/Kconfig is NETFLITER_DEBUG. Nothing relevant in drivers/net/Kconfig, there isn't a Kconfig in net/core...

I thought about adding a new symbol, but CONFIG_DEBUG_KERNEL is already used in a few existing places:

arch/powerpc/kernel/sysfs.c
arch/parisc/mm/init.c
arch/blackfin/include/asm/entry.h

So this isn't the first instance of it, but that doesn't mean those uses are correct. :)

Quoted 2 lines

However the patch was a) wordwrapped, b) space-stuffed and c) not cc'ed to the networking list. So its prospects are dim.

Sorry, finally gave up on kmail and set up thunderbird. Still trying to beat the darn thing into submission. (It looked right before I hit send. And I cursored over the tabs to make sure. :)

I'll work out my email issues and then cc: the networking list on the resubmit.

Thanks,

Rob

#3 lore raw

PATCH 1/1 Move an assert under DEBUG_KERNEL. (attempt 2)

In reply to Andrew Morton
Quoted 5 lines · Andrew Morton

Probably a worthwhile thing to do, IMO. If there's some net-specific CONFIG_DEBUG_ setting then that wold be a better thing to use.

However the patch was a) wordwrapped, b) space-stuffed and c) not cc'ed to the networking list. So its prospects are dim.

Ok, either I've beaten thunderbird into submission, or I'll be submitting a patch to Documentation/email-clients.txt. (Whether or not I need to find a different smtp server to send this through remains an open question.)

(Confirming: I looked for a more specific DEBUG symbol, but couldn't find one. I can add one, but this seems a bit small to have its own symbol, and DEBUG_KERNEL is already used in a few *.c files.)

From: Rob Landley <[email protected]>

Move an assert under DEBUG_KERNEL. (Minor cleanup to save a few bytes.)

---

 include/linux/rtnetlink.h |    4 ++++
 1 file changed, 4 insertions(+)
include/linux/rtnetlink.h +4 -0
index bbad657..28c4025 100644
@@ -782,6 +782,7 @@ extern struct netdev_queue *dev_ingress_queue_create(struct net_device *dev);
 extern void rtnetlink_init(void);
 extern void __rtnl_unlock(void);
 
+#ifdef CONFIG_DEBUG_KERNEL
 #define ASSERT_RTNL() do { \
 	if (unlikely(!rtnl_is_locked())) { \
 		printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \
@@ -789,6 +790,9 @@ extern void __rtnl_unlock(void);
 		dump_stack(); \
 	} \
 } while(0)
+#else
+#define ASSERT_RTNL()
+#endif
 
 static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
 {
#4 lore raw

Re: [PATCH] Move an assert under DEBUG_KERNEL. (attempt 2)

Quoted 8 lines · On Mon, 10 Jan 2011 02:35:33 -0600 Rob Landley wrote:
Quoted 5 lines · Andrew Morton

Probably a worthwhile thing to do, IMO. If there's some net-specific CONFIG_DEBUG_ setting then that wold be a better thing to use.

However the patch was a) wordwrapped, b) space-stuffed and c) not cc'ed to the networking list. So its prospects are dim.

Ok, either I've beaten thunderbird into submission, or I'll be submitting a patch to Documentation/email-clients.txt. (Whether or not I need to find a different smtp server to send this through remains an open question.)

Hi Rob,
The patch applies cleanly. However, if you have any additions/updates to Documentation/email-clients.txt, please send them along.

and please do hard CR/LF every 70-72 characters or so, instead of very_long_lines.

Quoted 25 lines

(Confirming: I looked for a more specific DEBUG symbol, but couldn't find one. I can add one, but this seems a bit small to have its own symbol, and DEBUG_KERNEL is already used in a few *.c files.)

From: Rob Landley <[email protected]>

Move an assert under DEBUG_KERNEL. (Minor cleanup to save a few bytes.)

---

 include/linux/rtnetlink.h |    4 ++++
 1 file changed, 4 insertions(+)
include/linux/rtnetlink.h +1 -0
index bbad657..28c4025 100644
@@ -782,6 +782,7 @@ extern struct netdev_queue *dev_ingress_queue_create(struct net_device *dev);
 extern void rtnetlink_init(void);
 extern void __rtnl_unlock(void);
 
+#ifdef CONFIG_DEBUG_KERNEL
 #define ASSERT_RTNL() do { \
 	if (unlikely(!rtnl_is_locked())) { \
 		printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \

include/linux/rtnetlink.h extern void __rtnl_unlock(void);

Quoted 10 lines
include/linux/rtnetlink.h +3 -1
@@ -789,6 +790,9 @@ extern void __rtnl_unlock(void);
 		dump_stack(); \
 	} \
 } while(0)
+#else
+#define ASSERT_RTNL()
+#endif
 
 static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
 {
--

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#5 lore raw

PATCH 1/1 update Thunderbird docs with wordwrap plugin.

Quoted 10 lines · Randy Dunlap
Quoted 8 lines · On Mon, 10 Jan 2011 02:35:33 -0600 Rob Landley wrote:
Quoted 6 lines · Andrew Morton

Probably a worthwhile thing to do, IMO. If there's some net-specific CONFIG_DEBUG_ setting then that wold be a better thing to use.

However the patch was a) wordwrapped, b) space-stuffed and c) not cc'ed to the networking list. So its prospects are dim.

Quoted 7 lines
Quoted 4 lines

Ok, either I've beaten thunderbird into submission, or I'll be submitting a patch to Documentation/email-clients.txt. (Whether or not I need to find a different smtp server to send this through
remains an open question.)

Hi Rob, The patch applies cleanly.

Yay!

Quoted 5 lines

However, if you have any additions/updates to Documentation/email-clients.txt, please send them along.

and please do hard CR/LF every 70-72 characters or so, instead of very_long_lines.

[Long rant about baked-in stupidity in Thunderbird mercifully deleted.]

I dug up a wordwrap extension and installed it, giving me an "options->enable wordwrap" control. I had to undo one of the steps in email-clients.txt to get it to work, and rewrote email-clients.txt accordingly:

From: Rob Landley <[email protected]>

Show how to install the "toggle wordwrap" extension in thunderbird.

---

 Documentation/email-clients.txt |   43 ++++++++++++++++--------------
 1 file changed, 23 insertions(+), 20 deletions(-)
Documentation/email-clients.txt +23 -20
index 945ff3f..714b8ca 100644
@@ -179,26 +179,8 @@ Sylpheed (GUI)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Thunderbird (GUI)
 
-By default, thunderbird likes to mangle text, but there are ways to
-coerce it into being nice.
-
-- Under account settings, composition and addressing, uncheck "Compose
-  messages in HTML format".
-
-- Edit your Thunderbird config settings to tell it not to wrap lines:
-      user_pref("mailnews.wraplength", 0);
-
-- Edit your Thunderbird config settings so that it won't use format=flowed:
-      user_pref("mailnews.send_plaintext_flowed", false);
-
-- You need to get Thunderbird into preformat mode:
-. If you compose HTML messages by default, it's not too hard. Just select
-  "Preformat" from the drop-down box just under the subject line.
-. If you compose in text by default, you have to tell it to compose a new
-  message in HTML (just as a one-off), and then force it from there back to
-  text, else it will wrap lines. To do this, use shift-click on the Write
-  icon to compose to get HTML compose mode, then select "Preformat" from
-  the drop-down box just under the subject line.
+Thunderbird is an Outlook clone that likes to mangle text, but there are ways
+to coerce it into behaving.
 
 - Allows use of an external editor:
   The easiest thing to do with Thunderbird and patches is to use an
@@ -208,6 +190,27 @@ coerce it into being nice.
   View->Toolbars->Customize... and finally just click on it when in the
   Compose dialog.
 
+To beat some sense out of the internal editor, do this:
+
+- Under account settings, composition and addressing, uncheck "Compose
+  messages in HTML format".
+
+- Edit your Thunderbird config settings so that it won't use format=flowed.
+  Go to "edit->preferences->advanced->config editor" to bring up the
+  thunderbird's registry editor, and set "mailnews.send_plaintext_flowed" to
+  "false".
+
+- Enable "preformat" mode: Shft-click on the Write icon to bring up the HTML
+  composer, select "Preformat" from the drop-down box just under the subject
+  line, then close the message without saving.  (This setting also applies to
+  the text composer, but the only control for it is in the HTML composer.)
+
+- Install the "toggle wordwrap" extension.  Download the file from:
+    https://addons.mozilla.org/thunderbird/addon/2351/
+  Then go to "tools->add ons", select "install" at the bottom of the screen,
+  and browse to where you saved the .xul file.  This adds an "Enable
+  Wordwrap" entry under the Options menu of the message composer.
+
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 TkRat (GUI)
 
#6 lore raw

Re: [PATCH] Move an assert under DEBUG_KERNEL. (attempt 2)

In reply to Rob Landley
Quoted 13 lines · On Mon, 10 Jan 2011 02:35:33 -0600 Rob Landley wrote:
Quoted 5 lines · Andrew Morton

Probably a worthwhile thing to do, IMO. If there's some net-specific CONFIG_DEBUG_ setting then that wold be a better thing to use.

However the patch was a) wordwrapped, b) space-stuffed and c) not cc'ed to the networking list. So its prospects are dim.

Ok, either I've beaten thunderbird into submission, or I'll be submitting a patch to Documentation/email-clients.txt. (Whether or not I need to find a different smtp server to send this through remains an open question.)

(Confirming: I looked for a more specific DEBUG symbol, but couldn't find one. I can add one, but this seems a bit small to have its own symbol, and DEBUG_KERNEL is already used in a few *.c files.)

From: Rob Landley <[email protected]>

Quoted 7 lines

Move an assert under DEBUG_KERNEL. (Minor cleanup to save a few bytes.)

---

 include/linux/rtnetlink.h |    4 ++++
 1 file changed, 4 insertions(+)

Hm, cc to linux-net should be to netdev instead (so I changed it).

Quoted 13 lines
include/linux/rtnetlink.h +1 -0
index bbad657..28c4025 100644
@@ -782,6 +782,7 @@ extern struct netdev_queue *dev_ingress_queue_create(struct net_device *dev);
 extern void rtnetlink_init(void);
 extern void __rtnl_unlock(void);
 
+#ifdef CONFIG_DEBUG_KERNEL
 #define ASSERT_RTNL() do { \
 	if (unlikely(!rtnl_is_locked())) { \
 		printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \

include/linux/rtnetlink.h extern void __rtnl_unlock(void); · line 795

Quoted 6 lines
include/linux/rtnetlink.h +3 -0
@@ -789,6 +790,9 @@ extern void __rtnl_unlock(void);
 		dump_stack(); \
 	} \
 } while(0)
+#else
+#define ASSERT_RTNL()
+#endif

Empty macros in Linux usually take the (preferred) form of this one from kernel.h:

#define might_resched() do { } while (0)

although it's up to DaveM in this case.

include/linux/rtnetlink.h extern void __rtnl_unlock(void);

Quoted 4 lines
include/linux/rtnetlink.h +0 -1
 static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
 {
--

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***