linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: David Miller <davem@davemloft.net>
Cc: joe@perches.com, mingo@elte.hu, greearb@candelatech.com,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	arnd@arndb.de, netdev@vger.kernel.org
Subject: Re: [patch] net/core/filter.c: Fix build error
Date: Thu, 26 May 2011 11:57:21 -0700	[thread overview]
Message-ID: <20110526115721.ee83aefc.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20110526.143843.205897228685761536.davem@davemloft.net>

On Thu, 26 May 2011 14:38:43 -0400 (EDT) David Miller wrote:

> From: Joe Perches <joe@perches.com>
> Date: Thu, 26 May 2011 08:31:06 -0700
> 
> > My suggestion would be to see about again adding
> > #include <linux/ratelimit.h> somehow
> > back to kernel.h which commit 3fff4c42bd0a removed
> > in 2009 because of the spinlock issues.
> > 
> > Any suggestion on how best to fix it generically?
> 
> I don't think we want spinlock_t's definition being sucked
> into kernel.h's dependency food chain.
> 
> Even if desirable, I think it'd be quite a bit of surgery,
> too much to do at this stage.
> 
> So for now how about we make the ratelimit warn interfaces be a true,
> instead of a pseudo, dependency on ratelimit.h by moving those
> definitions into ratelimit.h?

Works for me.  Thanks.

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>


> diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
> index 9178484..dfb0ec6 100644
> --- a/include/asm-generic/bug.h
> +++ b/include/asm-generic/bug.h
> @@ -162,46 +162,6 @@ extern void warn_slowpath_null(const char *file, const int line);
>  	unlikely(__ret_warn_once);				\
>  })
>  
> -#ifdef CONFIG_PRINTK
> -
> -#define WARN_ON_RATELIMIT(condition, state)			\
> -		WARN_ON((condition) && __ratelimit(state))
> -
> -#define __WARN_RATELIMIT(condition, state, format...)		\
> -({								\
> -	int rtn = 0;						\
> -	if (unlikely(__ratelimit(state)))			\
> -		rtn = WARN(condition, format);			\
> -	rtn;							\
> -})
> -
> -#define WARN_RATELIMIT(condition, format...)			\
> -({								\
> -	static DEFINE_RATELIMIT_STATE(_rs,			\
> -				      DEFAULT_RATELIMIT_INTERVAL,	\
> -				      DEFAULT_RATELIMIT_BURST);	\
> -	__WARN_RATELIMIT(condition, &_rs, format);		\
> -})
> -
> -#else
> -
> -#define WARN_ON_RATELIMIT(condition, state)			\
> -	WARN_ON(condition)
> -
> -#define __WARN_RATELIMIT(condition, state, format...)		\
> -({								\
> -	int rtn = WARN(condition, format);			\
> -	rtn;							\
> -})
> -
> -#define WARN_RATELIMIT(condition, format...)			\
> -({								\
> -	int rtn = WARN(condition, format);			\
> -	rtn;							\
> -})
> -
> -#endif
> -
>  /*
>   * WARN_ON_SMP() is for cases that the warning is either
>   * meaningless for !SMP or may even cause failures.
> diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
> index 03ff67b..2f00715 100644
> --- a/include/linux/ratelimit.h
> +++ b/include/linux/ratelimit.h
> @@ -41,4 +41,44 @@ extern struct ratelimit_state printk_ratelimit_state;
>  extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
>  #define __ratelimit(state) ___ratelimit(state, __func__)
>  
> +#ifdef CONFIG_PRINTK
> +
> +#define WARN_ON_RATELIMIT(condition, state)			\
> +		WARN_ON((condition) && __ratelimit(state))
> +
> +#define __WARN_RATELIMIT(condition, state, format...)		\
> +({								\
> +	int rtn = 0;						\
> +	if (unlikely(__ratelimit(state)))			\
> +		rtn = WARN(condition, format);			\
> +	rtn;							\
> +})
> +
> +#define WARN_RATELIMIT(condition, format...)			\
> +({								\
> +	static DEFINE_RATELIMIT_STATE(_rs,			\
> +				      DEFAULT_RATELIMIT_INTERVAL,	\
> +				      DEFAULT_RATELIMIT_BURST);	\
> +	__WARN_RATELIMIT(condition, &_rs, format);		\
> +})
> +
> +#else
> +
> +#define WARN_ON_RATELIMIT(condition, state)			\
> +	WARN_ON(condition)
> +
> +#define __WARN_RATELIMIT(condition, state, format...)		\
> +({								\
> +	int rtn = WARN(condition, format);			\
> +	rtn;							\
> +})
> +
> +#define WARN_RATELIMIT(condition, format...)			\
> +({								\
> +	int rtn = WARN(condition, format);			\
> +	rtn;							\
> +})
> +
> +#endif
> +
>  #endif /* _LINUX_RATELIMIT_H */
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 0e3622f..36f975f 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -38,6 +38,7 @@
>  #include <asm/unaligned.h>
>  #include <linux/filter.h>
>  #include <linux/reciprocal_div.h>
> +#include <linux/ratelimit.h>
>  
>  /* No hurry in this branch */
>  static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size)
> --


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

  reply	other threads:[~2011-05-26 18:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1305657014-32736-1-git-send-email-greearb@candelatech.com>
     [not found] ` <1305658349.1722.30.camel@Joe-Laptop>
     [not found]   ` <20110517.152357.85105240786269960.davem@davemloft.net>
     [not found]     ` <4DD2CDA9.7000009@candelatech.com>
     [not found]       ` <1305662020.1722.42.camel@Joe-Laptop>
     [not found]         ` <4DD2DB9D.6050306@candelatech.com>
2011-05-17 21:13           ` RFC: Add WARN_RATELIMIT to bug.h (was: Re: [PATCH] sk-filter: Rate-limit WARNing, print dbg info.) Joe Perches
2011-05-17 21:13             ` Joe Perches
2011-05-21 17:48             ` [PATCH 0/2] Add and use WARN_RATELIMIT Joe Perches
2011-05-21 17:48               ` Joe Perches
2011-05-21 17:48               ` [PATCH 1/2] bug.h: Add WARN_RATELIMIT Joe Perches
2011-05-21 17:48                 ` Joe Perches
2011-05-21 17:48               ` [PATCH 2/2] net: filter: Use WARN_RATELIMIT Joe Perches
2011-05-26 12:31                 ` [patch] net/core/filter.c: Fix build error Ingo Molnar
2011-05-26 15:31                   ` Joe Perches
2011-05-26 15:31                     ` Joe Perches
2011-05-26 18:38                     ` David Miller
2011-05-26 18:57                       ` Randy Dunlap [this message]
2011-05-26 19:00                         ` David Miller
2011-05-26 19:07                       ` Joe Perches
2011-05-26 19:07                         ` Joe Perches
2011-05-26 19:09                       ` Ingo Molnar
2011-05-26 19:09                         ` Ingo Molnar
2011-05-26 19:12                         ` Ingo Molnar
2011-05-26 19:12                           ` Ingo Molnar
2011-05-23 21:38               ` [PATCH 0/2] Add and use WARN_RATELIMIT David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110526115721.ee83aefc.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=greearb@candelatech.com \
    --cc=joe@perches.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).