Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1263966 > unrolled thread

[PATCH] mmc: add ifdef around fault_create_debugfs_attr()

Started byAdrien Schildknecht <adrien+dev@schischi.me>
First post2015-11-06 13:20 +0100
Last post2015-11-10 20:20 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mmc: add ifdef around fault_create_debugfs_attr() Adrien Schildknecht <adrien+dev@schischi.me> - 2015-11-06 13:20 +0100
    Re: [PATCH] mmc: add ifdef around fault_create_debugfs_attr() Ulf Hansson <ulf.hansson@linaro.org> - 2015-11-09 14:40 +0100
      Re: [PATCH] mmc: add ifdef around fault_create_debugfs_attr() Adrien Schildknecht <adrien+dev@schischi.me> - 2015-11-10 16:10 +0100
        Re: [PATCH] mmc: add ifdef around fault_create_debugfs_attr() Ulf Hansson <ulf.hansson@linaro.org> - 2015-11-10 18:30 +0100
          [PATCH v2] mmc: kconfig: replace FAULT_INJECTION with FAULT_INJECTION_DEBUG_FS Adrien Schildknecht <adrien+dev@schischi.me> - 2015-11-10 20:20 +0100

#1263966 — [PATCH] mmc: add ifdef around fault_create_debugfs_attr()

FromAdrien Schildknecht <adrien+dev@schischi.me>
Date2015-11-06 13:20 +0100
Subject[PATCH] mmc: add ifdef around fault_create_debugfs_attr()
Message-ID<qrO9P-4nf-1@gated-at.bofh.it>
FAIL_MMC_REQUEST can be used without FAULT_INJECTION_DEBUG_FS.
In this case fault_create_debugfs_attr() will always return an error and
lead to the deletion of the whole debugfs directory.

This patch makes sure that FAULT_INJECTION_DEBUG_FS is enabled before
attempting to create the debugfs atttribute.

Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
---
 drivers/mmc/core/debugfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 154aced..13e842c 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -259,11 +259,13 @@ void mmc_add_host_debugfs(struct mmc_host *host)
 	if (fail_request)
 		setup_fault_attr(&fail_default_attr, fail_request);
 	host->fail_mmc_request = fail_default_attr;
+#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
 	if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request",
 					     root,
 					     &host->fail_mmc_request)))
 		goto err_node;
 #endif
+#endif
 	return;
 
 err_node:
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1265672

FromUlf Hansson <ulf.hansson@linaro.org>
Date2015-11-09 14:40 +0100
Message-ID<qsUPV-70f-35@gated-at.bofh.it>
In reply to#1263966
On 6 November 2015 at 13:15, Adrien Schildknecht <adrien+dev@schischi.me> wrote:
> FAIL_MMC_REQUEST can be used without FAULT_INJECTION_DEBUG_FS.
> In this case fault_create_debugfs_attr() will always return an error and
> lead to the deletion of the whole debugfs directory.
>
> This patch makes sure that FAULT_INJECTION_DEBUG_FS is enabled before
> attempting to create the debugfs atttribute.
>
> Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
> ---
>  drivers/mmc/core/debugfs.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> index 154aced..13e842c 100644
> --- a/drivers/mmc/core/debugfs.c
> +++ b/drivers/mmc/core/debugfs.c
> @@ -259,11 +259,13 @@ void mmc_add_host_debugfs(struct mmc_host *host)
>         if (fail_request)
>                 setup_fault_attr(&fail_default_attr, fail_request);
>         host->fail_mmc_request = fail_default_attr;
> +#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
>         if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request",
>                                              root,
>                                              &host->fail_mmc_request)))
>                 goto err_node;
>  #endif
> +#endif
>         return;
>
>  err_node:
> --
> 2.6.2
>

I think you are solving this in the wrong way. Will it really makes
sense to use FAIL_MMC_REQUEST unless FAULT_INJECTION_DEBUG_FS is set,
I don't think so.

I suggest you to change FAIL_MMC_REQUEST from depending on
FAULT_INJECTION to FAULT_INJECTION_DEBUG_FS in /lib/Kconfig.debug.

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266566

FromAdrien Schildknecht <adrien+dev@schischi.me>
Date2015-11-10 16:10 +0100
Message-ID<qtiIy-6FU-13@gated-at.bofh.it>
In reply to#1265672
On Mon, 9 Nov 2015 14:33:11 +0100
Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 6 November 2015 at 13:15, Adrien Schildknecht
> <adrien+dev@schischi.me> wrote:  
> > FAIL_MMC_REQUEST can be used without FAULT_INJECTION_DEBUG_FS.
> > In this case fault_create_debugfs_attr() will always return an
> > error and lead to the deletion of the whole debugfs directory.
> >
> > This patch makes sure that FAULT_INJECTION_DEBUG_FS is enabled
> > before attempting to create the debugfs atttribute.
> >
> > Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
> > ---
> >  drivers/mmc/core/debugfs.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> > index 154aced..13e842c 100644
> > --- a/drivers/mmc/core/debugfs.c
> > +++ b/drivers/mmc/core/debugfs.c
> > @@ -259,11 +259,13 @@ void mmc_add_host_debugfs(struct mmc_host
> > *host) if (fail_request)
> >                 setup_fault_attr(&fail_default_attr, fail_request);
> >         host->fail_mmc_request = fail_default_attr;
> > +#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
> >         if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request",
> >                                              root,
> >                                              &host->fail_mmc_request)))
> >                 goto err_node;
> >  #endif
> > +#endif
> >         return;
> >
> >  err_node:
> > --
> > 2.6.2
> >    
> 
> I think you are solving this in the wrong way. Will it really makes
> sense to use FAIL_MMC_REQUEST unless FAULT_INJECTION_DEBUG_FS is set,
> I don't think so.  
The fault attribute can be configured using either the debugfs or the
module parameter "fail_request". It is thus possible to use
FAIL_MMC_REQUEST without FAULT_INJECTION_DEBUG_FS (even if it is less
convenient).

> I suggest you to change FAIL_MMC_REQUEST from depending on
> FAULT_INJECTION to FAULT_INJECTION_DEBUG_FS in /lib/Kconfig.debug.  
The other systems that use the fault injection infrastructure (futex,
alloc_pages, slab...) can be used without the dependency on
FAULT_INJECTION_DEBUG_FS. They also use nested #ifdef to handle this
configuration. I chose the #ifdef approach for the sake of coherence.

-- 
Adrien Schildknecht
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266660

FromUlf Hansson <ulf.hansson@linaro.org>
Date2015-11-10 18:30 +0100
Message-ID<qtkU1-7ZW-7@gated-at.bofh.it>
In reply to#1266566
On 10 November 2015 at 16:04, Adrien Schildknecht
<adrien+dev@schischi.me> wrote:
> On Mon, 9 Nov 2015 14:33:11 +0100
> Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> On 6 November 2015 at 13:15, Adrien Schildknecht
>> <adrien+dev@schischi.me> wrote:
>> > FAIL_MMC_REQUEST can be used without FAULT_INJECTION_DEBUG_FS.
>> > In this case fault_create_debugfs_attr() will always return an
>> > error and lead to the deletion of the whole debugfs directory.
>> >
>> > This patch makes sure that FAULT_INJECTION_DEBUG_FS is enabled
>> > before attempting to create the debugfs atttribute.
>> >
>> > Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
>> > ---
>> >  drivers/mmc/core/debugfs.c | 2 ++
>> >  1 file changed, 2 insertions(+)
>> >
>> > diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
>> > index 154aced..13e842c 100644
>> > --- a/drivers/mmc/core/debugfs.c
>> > +++ b/drivers/mmc/core/debugfs.c
>> > @@ -259,11 +259,13 @@ void mmc_add_host_debugfs(struct mmc_host
>> > *host) if (fail_request)
>> >                 setup_fault_attr(&fail_default_attr, fail_request);
>> >         host->fail_mmc_request = fail_default_attr;
>> > +#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
>> >         if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request",
>> >                                              root,
>> >                                              &host->fail_mmc_request)))
>> >                 goto err_node;
>> >  #endif
>> > +#endif
>> >         return;
>> >
>> >  err_node:
>> > --
>> > 2.6.2
>> >
>>
>> I think you are solving this in the wrong way. Will it really makes
>> sense to use FAIL_MMC_REQUEST unless FAULT_INJECTION_DEBUG_FS is set,
>> I don't think so.
> The fault attribute can be configured using either the debugfs or the
> module parameter "fail_request". It is thus possible to use
> FAIL_MMC_REQUEST without FAULT_INJECTION_DEBUG_FS (even if it is less
> convenient).
>
>> I suggest you to change FAIL_MMC_REQUEST from depending on
>> FAULT_INJECTION to FAULT_INJECTION_DEBUG_FS in /lib/Kconfig.debug.
> The other systems that use the fault injection infrastructure (futex,
> alloc_pages, slab...) can be used without the dependency on
> FAULT_INJECTION_DEBUG_FS. They also use nested #ifdef to handle this

There are also those that chosen to depend on
FAULT_INJECTION_DEBUG_FS, such as FAULT_INJECTION_STACKTRACE_FILTER.

> configuration. I chose the #ifdef approach for the sake of coherence.

I would like to keep the amount of #ifdefs around in the code to a
minimal. In this case it doesn't even make sense and as there are no
consistent behaviour to consider, could you please adopt the Kconfig
solution instead!?

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266731 — [PATCH v2] mmc: kconfig: replace FAULT_INJECTION with FAULT_INJECTION_DEBUG_FS

FromAdrien Schildknecht <adrien+dev@schischi.me>
Date2015-11-10 20:20 +0100
Subject[PATCH v2] mmc: kconfig: replace FAULT_INJECTION with FAULT_INJECTION_DEBUG_FS
Message-ID<qtmCt-IR-7@gated-at.bofh.it>
In reply to#1266660
Fault-injection capability for MMC IO uses debugfs entries to configure
the attributes.
FAULT_INJECTION_DEBUG_FS must be enabled to use FAIL_MMC_REQUEST.

Replace FAULT_INJECTION with FAULT_INJECTION_DEBUG_FS.
Also remove 'select DEBUG_FS' since FAULT_INJECTION_DEBUG_FS depends on
it.

Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
---
 lib/Kconfig.debug | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 749e886..5c038d2 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1523,8 +1523,7 @@ config FAIL_IO_TIMEOUT
 
 config FAIL_MMC_REQUEST
 	bool "Fault-injection capability for MMC IO"
-	select DEBUG_FS
-	depends on FAULT_INJECTION && MMC
+	depends on FAULT_INJECTION_DEBUG_FS && MMC
 	help
 	  Provide fault-injection capability for MMC IO.
 	  This will make the mmc core return data errors. This is
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web