* Debug flag parameter for SCSI tape driver [not found] <2027096335.17236699.1402433423338.JavaMail.zimbra@redhat.com> @ 2014-06-10 20:51 ` Laurence Oberman 2014-06-10 23:48 ` [PATCH]: add debug " Laurence Oberman 0 siblings, 1 reply; 13+ messages in thread From: Laurence Oberman @ 2014-06-10 20:51 UTC (permalink / raw) To: linux-scsi Hello I am tired of building modules to enable SCSI tape driver debug so I am hoping this patch is acceptable. Tested using kernel 3.14.6 Usage example: modprobe st debug_flag=1 diff -Nur a/st.c b/st.c --- a/st.c 2014-06-10 16:45:18.522354105 -0400 +++ b/st.c 2014-06-10 16:45:33.953765908 -0400 @@ -80,6 +80,7 @@ static int try_direct_io = TRY_DIRECT_IO; static int try_rdio = 1; static int try_wdio = 1; +static int debug_flag = 0; static struct class st_sysfs_class; static const struct attribute_group *st_dev_groups[]; @@ -100,6 +101,9 @@ MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); module_param_named(try_direct_io, try_direct_io, int, 0); MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); +module_param_named(debug_flag, debug_flag, int, 0); +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting DEBUG 1 in source"); + /* Extra parameters for testing */ module_param_named(try_rdio, try_rdio, int, 0); @@ -124,6 +128,9 @@ }, { "try_direct_io", &try_direct_io + }, + { + "debug_flag", &debug_flag } }; #endif @@ -4277,7 +4284,9 @@ static int __init init_st(void) { int err; - + debugging = (debug_flag > 0) ? debug_flag : DEBUG; + if (debugging) + printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",debugging); validate_options(); printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", Thanks Laurence ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH]: add debug flag parameter for SCSI tape driver 2014-06-10 20:51 ` Debug flag parameter for SCSI tape driver Laurence Oberman @ 2014-06-10 23:48 ` Laurence Oberman 2014-06-11 18:03 ` "Kai Mäkisara (Kolumbus)" 0 siblings, 1 reply; 13+ messages in thread From: Laurence Oberman @ 2014-06-10 23:48 UTC (permalink / raw) To: linux-scsi Hello Take 2 of this patch, changed module description and subject line. This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. Usage: mpdprobe st debug_flag=1 Signed-off-by: Laurence Oberman <loberman@redhat.com> diff -Nur a/st.c b/st.c --- a/st.c 2014-06-10 16:45:18.522354105 -0400 +++ b/st.c 2014-06-10 19:40:39.774387990 -0400 @@ -80,6 +80,7 @@ static int try_direct_io = TRY_DIRECT_IO; static int try_rdio = 1; static int try_wdio = 1; +static int debug_flag = 0; static struct class st_sysfs_class; static const struct attribute_group *st_dev_groups[]; @@ -100,6 +101,9 @@ MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); module_param_named(try_direct_io, try_direct_io, int, 0); MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); +module_param_named(debug_flag, debug_flag, int, 0); +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); + /* Extra parameters for testing */ module_param_named(try_rdio, try_rdio, int, 0); @@ -124,6 +128,9 @@ }, { "try_direct_io", &try_direct_io + }, + { + "debug_flag", &debug_flag } }; #endif @@ -4277,7 +4284,9 @@ static int __init init_st(void) { int err; - + debugging = (debug_flag > 0) ? debug_flag : DEBUG; + if (debugging) + printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",debugging); validate_options(); printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", Thanks Laurence ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH]: add debug flag parameter for SCSI tape driver 2014-06-10 23:48 ` [PATCH]: add debug " Laurence Oberman @ 2014-06-11 18:03 ` "Kai Mäkisara (Kolumbus)" 2014-06-11 18:24 ` Laurence Oberman 2014-10-17 20:20 ` [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request Laurence Oberman 0 siblings, 2 replies; 13+ messages in thread From: "Kai Mäkisara (Kolumbus)" @ 2014-06-11 18:03 UTC (permalink / raw) To: Laurence Oberman; +Cc: linux-scsi On 11.6.2014, at 2.48, Laurence Oberman <loberman@redhat.com> wrote: > Hello > > Take 2 of this patch, changed module description and subject line. > > This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. > Usage: mpdprobe st debug_flag=1 > > Signed-off-by: Laurence Oberman <loberman@redhat.com> > What is wrong with the existing methods to control debugging? You can enable and disable debugging for each device with ioctl() (as described in the driver documentation). You can use mt-st to do this from command line. Your patch just allows one to change the default for all devices. The real problem may be that the distributions don’t compile the debugging code into the drivets but your patch does not change this. Kai -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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] 13+ messages in thread
* Re: [PATCH]: add debug flag parameter for SCSI tape driver 2014-06-11 18:03 ` "Kai Mäkisara (Kolumbus)" @ 2014-06-11 18:24 ` Laurence Oberman 2014-06-11 19:35 ` Dale R. Worley 2014-06-11 19:54 ` Laurence Oberman 2014-10-17 20:20 ` [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request Laurence Oberman 1 sibling, 2 replies; 13+ messages in thread From: Laurence Oberman @ 2014-06-11 18:24 UTC (permalink / raw) To: Kai Mäkisara (Kolumbus); +Cc: linux-scsi Kai, Thank you for considering this. With #define DEBUG 0 We still include #define DEB(a) #define DEBC(a) With the debug_flag we then provide the needed debug I am looking for at module load time. But I agree that it enables it for all devices and that may not be optimal I don't change the default, I just allow the parameter to control it. In the last few issues I have been working I have had to recompile and provide the st module to get what I needed captured for debugging so I decided to try the patch submission. Thank You Laurence ----- Original Message ----- From: "Kai Mäkisara (Kolumbus)" <kai.makisara@kolumbus.fi> To: "Laurence Oberman" <loberman@redhat.com> Cc: linux-scsi@vger.kernel.org Sent: Wednesday, June 11, 2014 2:03:15 PM Subject: Re: [PATCH]: add debug flag parameter for SCSI tape driver On 11.6.2014, at 2.48, Laurence Oberman <loberman@redhat.com> wrote: > Hello > > Take 2 of this patch, changed module description and subject line. > > This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. > Usage: mpdprobe st debug_flag=1 > > Signed-off-by: Laurence Oberman <loberman@redhat.com> > What is wrong with the existing methods to control debugging? You can enable and disable debugging for each device with ioctl() (as described in the driver documentation). You can use mt-st to do this from command line. Your patch just allows one to change the default for all devices. The real problem may be that the distributions don’t compile the debugging code into the drivets but your patch does not change this. Kai -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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] 13+ messages in thread
* Re: [PATCH]: add debug flag parameter for SCSI tape driver 2014-06-11 18:24 ` Laurence Oberman @ 2014-06-11 19:35 ` Dale R. Worley 2014-06-11 19:54 ` Laurence Oberman 1 sibling, 0 replies; 13+ messages in thread From: Dale R. Worley @ 2014-06-11 19:35 UTC (permalink / raw) To: Laurence Oberman; +Cc: kai.makisara, linux-scsi This thread leads me to ask: Do people use ANSI-formatted tapes any more? That is, tape volumes with miltiple files, header and trailer labels, etc.? Dale ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH]: add debug flag parameter for SCSI tape driver 2014-06-11 18:24 ` Laurence Oberman 2014-06-11 19:35 ` Dale R. Worley @ 2014-06-11 19:54 ` Laurence Oberman 2014-06-13 21:18 ` Debug " Dale R. Worley 1 sibling, 1 reply; 13+ messages in thread From: Laurence Oberman @ 2014-06-11 19:54 UTC (permalink / raw) To: Kai Mäkisara (Kolumbus); +Cc: linux-scsi Kai, Its likely not worth doing this, I cross checked and indeed many distros have this compiled out. So lets leave it as is. Thanks Laurence ----- Original Message ----- From: "Laurence Oberman" <loberman@redhat.com> To: "Kai Mäkisara (Kolumbus)" <kai.makisara@kolumbus.fi> Cc: linux-scsi@vger.kernel.org Sent: Wednesday, June 11, 2014 2:24:25 PM Subject: Re: [PATCH]: add debug flag parameter for SCSI tape driver Kai, Thank you for considering this. With #define DEBUG 0 We still include #define DEB(a) #define DEBC(a) With the debug_flag we then provide the needed debug I am looking for at module load time. But I agree that it enables it for all devices and that may not be optimal I don't change the default, I just allow the parameter to control it. In the last few issues I have been working I have had to recompile and provide the st module to get what I needed captured for debugging so I decided to try the patch submission. Thank You Laurence ----- Original Message ----- From: "Kai Mäkisara (Kolumbus)" <kai.makisara@kolumbus.fi> To: "Laurence Oberman" <loberman@redhat.com> Cc: linux-scsi@vger.kernel.org Sent: Wednesday, June 11, 2014 2:03:15 PM Subject: Re: [PATCH]: add debug flag parameter for SCSI tape driver On 11.6.2014, at 2.48, Laurence Oberman <loberman@redhat.com> wrote: > Hello > > Take 2 of this patch, changed module description and subject line. > > This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. > Usage: mpdprobe st debug_flag=1 > > Signed-off-by: Laurence Oberman <loberman@redhat.com> > What is wrong with the existing methods to control debugging? You can enable and disable debugging for each device with ioctl() (as described in the driver documentation). You can use mt-st to do this from command line. Your patch just allows one to change the default for all devices. The real problem may be that the distributions don’t compile the debugging code into the drivets but your patch does not change this. Kai -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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] 13+ messages in thread
* Re: Debug flag parameter for SCSI tape driver 2014-06-11 19:54 ` Laurence Oberman @ 2014-06-13 21:18 ` Dale R. Worley 0 siblings, 0 replies; 13+ messages in thread From: Dale R. Worley @ 2014-06-13 21:18 UTC (permalink / raw) To: linux-scsi Are ANSI-formatted tapes used on Linux? That is, tapes that contain multiple files and use the the ANSI (= ECMA-13) tape labels. My uderstanding is that a lot of the modern cartridge tapes record only fixed-length blocks and/or that is how they are always used these days. Dale ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request 2014-06-11 18:03 ` "Kai Mäkisara (Kolumbus)" 2014-06-11 18:24 ` Laurence Oberman @ 2014-10-17 20:20 ` Laurence Oberman 2014-10-17 20:41 ` Laurence Oberman 2014-10-19 8:54 ` "Kai Mäkisara (Kolumbus)" 1 sibling, 2 replies; 13+ messages in thread From: Laurence Oberman @ 2014-10-17 20:20 UTC (permalink / raw) To: Kai Mäkisara (Kolumbus), Rob Evers; +Cc: linux-scsi Hello Kai You have seen this patch before. The first time around, given that we don't enable DEBUG by default, I let it go. However we have been looking into defining DEBUG 1 by default here at Redhat and then setting the default to disabled. Are you open to considering changing the driver based on this patch. i.e. default DEFINE 1 and adding this code with default set to off. Note that with DEBUG 0, as you know you need to change that and recompile. That is exactly what I am trying to avoid with Enterprise customers. This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. Note that now DEBUG 1 is the default with this patch. Usage: modprobe st debug_flag=1 Signed-off-by: Laurence Oberman <loberman@redhat.com> diff -Nur a/st.c b/st.c --- a/st.c 2014-10-17 16:15:54.103810627 -0400 +++ b/st.c 2014-10-17 16:22:12.303810392 -0400 @@ -56,7 +56,7 @@ /* The driver prints some debugging information on the console if DEBUG is defined and non-zero. */ -#define DEBUG 0 +#define DEBUG 1 #define ST_DEB_MSG KERN_NOTICE #if DEBUG @@ -80,6 +80,7 @@ static int try_direct_io = TRY_DIRECT_IO; static int try_rdio = 1; static int try_wdio = 1; +static int debug_flag = 0; static struct class st_sysfs_class; static const struct attribute_group *st_dev_groups[]; @@ -100,6 +101,9 @@ MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); module_param_named(try_direct_io, try_direct_io, int, 0); MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); +module_param_named(debug_flag, debug_flag, int, 0); +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); + /* Extra parameters for testing */ module_param_named(try_rdio, try_rdio, int, 0); @@ -124,6 +128,9 @@ }, { "try_direct_io", &try_direct_io + }, + { + "debug_flag", &debug_flag } }; #endif @@ -4306,6 +4313,11 @@ validate_options(); + debugging = (debug_flag > 0) ? debug_flag : DEBUG; + if (debugging) + printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",debugging); + + printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", verstr, st_fixed_buffer_size, st_max_sg_segs); ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request 2014-10-17 20:20 ` [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request Laurence Oberman @ 2014-10-17 20:41 ` Laurence Oberman 2014-10-19 8:54 ` "Kai Mäkisara (Kolumbus)" 1 sibling, 0 replies; 13+ messages in thread From: Laurence Oberman @ 2014-10-17 20:41 UTC (permalink / raw) To: Kai Mäkisara (Kolumbus); +Cc: linux-scsi Oops, patch was defaulting to 1. Here is v2 properly defining DEBUG 1 and defaulting to 0 unless debug_flag=1 This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. Note that now DEBUG 1 is the default with this patch. Usage: modprobe st Signed-off-by: Laurence Oberman <loberman@redhat.com> diff -Nur a/st.c b/st.c --- a/st.c 2014-10-17 16:15:54.103810627 -0400 +++ b/st.c 2014-10-17 16:42:45.992809531 -0400 @@ -56,7 +56,8 @@ /* The driver prints some debugging information on the console if DEBUG is defined and non-zero. */ -#define DEBUG 0 +#define DEBUG 1 +#define NO_DEBUG 0 #define ST_DEB_MSG KERN_NOTICE #if DEBUG @@ -80,6 +81,7 @@ static int try_direct_io = TRY_DIRECT_IO; static int try_rdio = 1; static int try_wdio = 1; +static int debug_flag = 0; static struct class st_sysfs_class; static const struct attribute_group *st_dev_groups[]; @@ -100,6 +102,9 @@ MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); module_param_named(try_direct_io, try_direct_io, int, 0); MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); +module_param_named(debug_flag, debug_flag, int, 0); +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); + /* Extra parameters for testing */ module_param_named(try_rdio, try_rdio, int, 0); @@ -124,6 +129,9 @@ }, { "try_direct_io", &try_direct_io + }, + { + "debug_flag", &debug_flag } }; #endif @@ -4306,6 +4314,11 @@ validate_options(); + debugging = (debug_flag > 0) ? debug_flag : NO_DEBUG; + if (debugging) + printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",debugging); + + printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", verstr, st_fixed_buffer_size, st_max_sg_segs); ----- Original Message ----- From: "Laurence Oberman" <loberman@redhat.com> To: "Kai Mäkisara (Kolumbus)" <kai.makisara@kolumbus.fi>, "Rob Evers" <revers@redhat.com> Cc: linux-scsi@vger.kernel.org Sent: Friday, October 17, 2014 4:20:29 PM Subject: Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request Hello Kai You have seen this patch before. The first time around, given that we don't enable DEBUG by default, I let it go. However we have been looking into defining DEBUG 1 by default here at Redhat and then setting the default to disabled. Are you open to considering changing the driver based on this patch. i.e. default DEFINE 1 and adding this code with default set to off. Note that with DEBUG 0, as you know you need to change that and recompile. That is exactly what I am trying to avoid with Enterprise customers. This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. Note that now DEBUG 1 is the default with this patch. Usage: modprobe st debug_flag=1 Signed-off-by: Laurence Oberman <loberman@redhat.com> diff -Nur a/st.c b/st.c --- a/st.c 2014-10-17 16:15:54.103810627 -0400 +++ b/st.c 2014-10-17 16:22:12.303810392 -0400 @@ -56,7 +56,7 @@ /* The driver prints some debugging information on the console if DEBUG is defined and non-zero. */ -#define DEBUG 0 +#define DEBUG 1 #define ST_DEB_MSG KERN_NOTICE #if DEBUG @@ -80,6 +80,7 @@ static int try_direct_io = TRY_DIRECT_IO; static int try_rdio = 1; static int try_wdio = 1; +static int debug_flag = 0; static struct class st_sysfs_class; static const struct attribute_group *st_dev_groups[]; @@ -100,6 +101,9 @@ MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); module_param_named(try_direct_io, try_direct_io, int, 0); MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); +module_param_named(debug_flag, debug_flag, int, 0); +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); + /* Extra parameters for testing */ module_param_named(try_rdio, try_rdio, int, 0); @@ -124,6 +128,9 @@ }, { "try_direct_io", &try_direct_io + }, + { + "debug_flag", &debug_flag } }; #endif @@ -4306,6 +4313,11 @@ validate_options(); + debugging = (debug_flag > 0) ? debug_flag : DEBUG; + if (debugging) + printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",debugging); + + printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", verstr, st_fixed_buffer_size, st_max_sg_segs); -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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] 13+ messages in thread
* Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request 2014-10-17 20:20 ` [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request Laurence Oberman 2014-10-17 20:41 ` Laurence Oberman @ 2014-10-19 8:54 ` "Kai Mäkisara (Kolumbus)" 2014-10-19 13:44 ` Laurence Oberman 1 sibling, 1 reply; 13+ messages in thread From: "Kai Mäkisara (Kolumbus)" @ 2014-10-19 8:54 UTC (permalink / raw) To: Laurence Oberman; +Cc: Rob Evers, linux-scsi Hello, I am responding to this, but noticed your next, fixed version. > On 17.10.2014, at 23.20, Laurence Oberman <loberman@redhat.com> wrote: > > Hello Kai > > You have seen this patch before. The first time around, given that we don't enable DEBUG by default, I let it go. > However we have been looking into defining DEBUG 1 by default here at Redhat and then setting the default to disabled. > > Are you open to considering changing the driver based on this patch. > i.e. default DEFINE 1 and adding this code with default set to off. > Yes. I certainly think defining DEBUG 1 and changing the default to zero should be done if it is useful for supporting users. The runtime overhead is negligible and the extra code does not matter nowadays (it did matter, at least theoretically, for years ago). I am not so sure about the module option. When the debugging code is compiled in, debugging can be enabled and disabled for each device by the MTIOCTOP ioctl (e.g., mtst -f tape_device stsetoptions debug). The module option enables debugging for all tape devices. However, if you think this additional module option is useful, I am not against it. It does not remove the possibility for controlling debugging for each device for those who want to do it that way. Anyway, you should modify the documentation (Documentation/scsi/st.txt) according to the changes. > Note that with DEBUG 0, as you know you need to change that and recompile. > That is exactly what I am trying to avoid with Enterprise customers. > I have also noticed this when someone has asked me about some tape problems. > This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. > Note that now DEBUG 1 is the default with this patch. > > Usage: modprobe st debug_flag=1 > > Signed-off-by: Laurence Oberman <loberman@redhat.com> > > diff -Nur a/st.c b/st.c > --- a/st.c 2014-10-17 16:15:54.103810627 -0400 > +++ b/st.c 2014-10-17 16:22:12.303810392 -0400 > @@ -56,7 +56,7 @@ > > /* The driver prints some debugging information on the console if DEBUG > is defined and non-zero. */ > -#define DEBUG 0 > +#define DEBUG 1 > > #define ST_DEB_MSG KERN_NOTICE > #if DEBUG > @@ -80,6 +80,7 @@ > static int try_direct_io = TRY_DIRECT_IO; > static int try_rdio = 1; > static int try_wdio = 1; > +static int debug_flag = 0; > > static struct class st_sysfs_class; > static const struct attribute_group *st_dev_groups[]; > @@ -100,6 +101,9 @@ > MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); > module_param_named(try_direct_io, try_direct_io, int, 0); > MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); > +module_param_named(debug_flag, debug_flag, int, 0); > +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); > + > > /* Extra parameters for testing */ > module_param_named(try_rdio, try_rdio, int, 0); > @@ -124,6 +128,9 @@ > }, > { > "try_direct_io", &try_direct_io > + }, > + { > + "debug_flag", &debug_flag > } > }; > #endif > @@ -4306,6 +4313,11 @@ > > validate_options(); > > + debugging = (debug_flag > 0) ? debug_flag : DEBUG; > + if (debugging) > + printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",debugging); > + > + I think you have an extra newline here? I also think that the kernel log would look nicer if the print below would be before setting the option. The driver would introduce itself first and print the debug flag status after that. > printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", > verstr, st_fixed_buffer_size, st_max_sg_segs); Thanks, Kai ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request 2014-10-19 8:54 ` "Kai Mäkisara (Kolumbus)" @ 2014-10-19 13:44 ` Laurence Oberman 2014-10-19 19:37 ` "Kai Mäkisara (Kolumbus)" 2014-10-23 17:11 ` Christoph Hellwig 0 siblings, 2 replies; 13+ messages in thread From: Laurence Oberman @ 2014-10-19 13:44 UTC (permalink / raw) To: Kai Mäkisara (Kolumbus); +Cc: linux-scsi Hello Kai Thanks. Here is v3 This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. Note that now DEBUG 1 is the default with this patch. Usage: modprobe st debug_flag=1 Signed-off-by: Laurence Oberman <loberman@redhat.com> diff -Nur a/Documentation/scsi/st.txt b/Documentation/scsi/st.txt --- a/Documentation/scsi/st.txt 2014-10-19 09:36:52.243863716 -0400 +++ b/Documentation/scsi/st.txt 2014-10-19 09:43:19.222863447 -0400 @@ -506,9 +506,11 @@ DEBUGGING HINTS -To enable debugging messages, edit st.c and #define DEBUG 1. As seen -above, debugging can be switched off with an ioctl if debugging is -compiled into the driver. The debugging output is not voluminous. +Debugging code is now compiled in by default but debugging is turned off with +the kernel module parameter debug_flag defaulting to 0. +Debugging can still be switched on and off with an ioctl. +To enable debug at module load time add debug_flag=1 to the module load +options, the debugging output is not voluminous. If the tape seems to hang, I would be very interested to hear where the driver is waiting. With the command 'ps -l' you can see the state diff -Nur a/drivers/scsi/st.c b/drivers/scsi/st.c --- a/drivers/scsi/st.c 2014-10-19 09:35:45.673863756 -0400 +++ b/drivers/scsi/st.c 2014-10-19 09:35:30.621863483 -0400 @@ -56,7 +56,8 @@ /* The driver prints some debugging information on the console if DEBUG is defined and non-zero. */ -#define DEBUG 0 +#define DEBUG 1 +#define NO_DEBUG 0 #define ST_DEB_MSG KERN_NOTICE #if DEBUG @@ -80,6 +81,7 @@ static int try_direct_io = TRY_DIRECT_IO; static int try_rdio = 1; static int try_wdio = 1; +static int debug_flag = 0; static struct class st_sysfs_class; static const struct attribute_group *st_dev_groups[]; @@ -100,6 +102,9 @@ MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); module_param_named(try_direct_io, try_direct_io, int, 0); MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); +module_param_named(debug_flag, debug_flag, int, 0); +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); + /* Extra parameters for testing */ module_param_named(try_rdio, try_rdio, int, 0); @@ -124,6 +129,9 @@ }, { "try_direct_io", &try_direct_io + }, + { + "debug_flag", &debug_flag } }; #endif @@ -4309,6 +4317,10 @@ printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", verstr, st_fixed_buffer_size, st_max_sg_segs); + debugging = (debug_flag > 0) ? debug_flag : NO_DEBUG; + if (debugging) + printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",debugging); + err = class_register(&st_sysfs_class); if (err) { pr_err("Unable register sysfs class for SCSI tapes\n"); ----- Original Message ----- From: "Kai Mäkisara (Kolumbus)" <kai.makisara@kolumbus.fi> To: "Laurence Oberman" <loberman@redhat.com> Cc: "Rob Evers" <revers@redhat.com>, linux-scsi@vger.kernel.org Sent: Sunday, October 19, 2014 4:54:10 AM Subject: Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request Hello, I am responding to this, but noticed your next, fixed version. > On 17.10.2014, at 23.20, Laurence Oberman <loberman@redhat.com> wrote: > > Hello Kai > > You have seen this patch before. The first time around, given that we don't enable DEBUG by default, I let it go. > However we have been looking into defining DEBUG 1 by default here at Redhat and then setting the default to disabled. > > Are you open to considering changing the driver based on this patch. > i.e. default DEFINE 1 and adding this code with default set to off. > Yes. I certainly think defining DEBUG 1 and changing the default to zero should be done if it is useful for supporting users. The runtime overhead is negligible and the extra code does not matter nowadays (it did matter, at least theoretically, for years ago). I am not so sure about the module option. When the debugging code is compiled in, debugging can be enabled and disabled for each device by the MTIOCTOP ioctl (e.g., mtst -f tape_device stsetoptions debug). The module option enables debugging for all tape devices. However, if you think this additional module option is useful, I am not against it. It does not remove the possibility for controlling debugging for each device for those who want to do it that way. Anyway, you should modify the documentation (Documentation/scsi/st.txt) according to the changes. > Note that with DEBUG 0, as you know you need to change that and recompile. > That is exactly what I am trying to avoid with Enterprise customers. > I have also noticed this when someone has asked me about some tape problems. > This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. > Note that now DEBUG 1 is the default with this patch. > > Usage: modprobe st debug_flag=1 > > Signed-off-by: Laurence Oberman <loberman@redhat.com> > > diff -Nur a/st.c b/st.c > --- a/st.c 2014-10-17 16:15:54.103810627 -0400 > +++ b/st.c 2014-10-17 16:22:12.303810392 -0400 > @@ -56,7 +56,7 @@ > > /* The driver prints some debugging information on the console if DEBUG > is defined and non-zero. */ > -#define DEBUG 0 > +#define DEBUG 1 > > #define ST_DEB_MSG KERN_NOTICE > #if DEBUG > @@ -80,6 +80,7 @@ > static int try_direct_io = TRY_DIRECT_IO; > static int try_rdio = 1; > static int try_wdio = 1; > +static int debug_flag = 0; > > static struct class st_sysfs_class; > static const struct attribute_group *st_dev_groups[]; > @@ -100,6 +101,9 @@ > MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); > module_param_named(try_direct_io, try_direct_io, int, 0); > MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); > +module_param_named(debug_flag, debug_flag, int, 0); > +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); > + > > /* Extra parameters for testing */ > module_param_named(try_rdio, try_rdio, int, 0); > @@ -124,6 +128,9 @@ > }, > { > "try_direct_io", &try_direct_io > + }, > + { > + "debug_flag", &debug_flag > } > }; > #endif > @@ -4306,6 +4313,11 @@ > > validate_options(); > > + debugging = (debug_flag > 0) ? debug_flag : DEBUG; > + if (debugging) > + printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",debugging); > + > + I think you have an extra newline here? I also think that the kernel log would look nicer if the print below would be before setting the option. The driver would introduce itself first and print the debug flag status after that. > printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", > verstr, st_fixed_buffer_size, st_max_sg_segs); Thanks, Kai -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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] 13+ messages in thread
* Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request 2014-10-19 13:44 ` Laurence Oberman @ 2014-10-19 19:37 ` "Kai Mäkisara (Kolumbus)" 2014-10-23 17:11 ` Christoph Hellwig 1 sibling, 0 replies; 13+ messages in thread From: "Kai Mäkisara (Kolumbus)" @ 2014-10-19 19:37 UTC (permalink / raw) To: Laurence Oberman; +Cc: linux-scsi > On 19.10.2014, at 16.44, Laurence Oberman <loberman@redhat.com> wrote: > > Hello Kai > > Thanks. > > Here is v3 > > This patch adds a debug_flag parameter that can be set on module load, and allows the DEBUG facility without a module recompile. > Note that now DEBUG 1 is the default with this patch. > > Usage: modprobe st debug_flag=1 > > Signed-off-by: Laurence Oberman <loberman@redhat.com> Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi> Thanks, Kai > > diff -Nur a/Documentation/scsi/st.txt b/Documentation/scsi/st.txt > --- a/Documentation/scsi/st.txt 2014-10-19 09:36:52.243863716 -0400 > +++ b/Documentation/scsi/st.txt 2014-10-19 09:43:19.222863447 -0400 > @@ -506,9 +506,11 @@ > > DEBUGGING HINTS > > -To enable debugging messages, edit st.c and #define DEBUG 1. As seen > -above, debugging can be switched off with an ioctl if debugging is > -compiled into the driver. The debugging output is not voluminous. > +Debugging code is now compiled in by default but debugging is turned off with > +the kernel module parameter debug_flag defaulting to 0. > +Debugging can still be switched on and off with an ioctl. > +To enable debug at module load time add debug_flag=1 to the module load > +options, the debugging output is not voluminous. > > If the tape seems to hang, I would be very interested to hear where > the driver is waiting. With the command 'ps -l' you can see the state > > diff -Nur a/drivers/scsi/st.c b/drivers/scsi/st.c > --- a/drivers/scsi/st.c 2014-10-19 09:35:45.673863756 -0400 > +++ b/drivers/scsi/st.c 2014-10-19 09:35:30.621863483 -0400 > @@ -56,7 +56,8 @@ > > /* The driver prints some debugging information on the console if DEBUG > is defined and non-zero. */ > -#define DEBUG 0 > +#define DEBUG 1 > +#define NO_DEBUG 0 > > #define ST_DEB_MSG KERN_NOTICE > #if DEBUG > @@ -80,6 +81,7 @@ > static int try_direct_io = TRY_DIRECT_IO; > static int try_rdio = 1; > static int try_wdio = 1; > +static int debug_flag = 0; > > static struct class st_sysfs_class; > static const struct attribute_group *st_dev_groups[]; > @@ -100,6 +102,9 @@ > MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)"); > module_param_named(try_direct_io, try_direct_io, int, 0); > MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)"); > +module_param_named(debug_flag, debug_flag, int, 0); > +MODULE_PARM_DESC(debug_flag, "Enable DEBUG, same as setting debugging=1"); > + > > /* Extra parameters for testing */ > module_param_named(try_rdio, try_rdio, int, 0); > @@ -124,6 +129,9 @@ > }, > { > "try_direct_io", &try_direct_io > + }, > + { > + "debug_flag", &debug_flag > } > }; > #endif > @@ -4309,6 +4317,10 @@ > printk(KERN_INFO "st: Version %s, fixed bufsize %d, s/g segs %d\n", > verstr, st_fixed_buffer_size, st_max_sg_segs); > > + debugging = (debug_flag > 0) ? debug_flag : NO_DEBUG; > + if (debugging) > + printk(KERN_INFO "st: Debugging enabled debug_flag = %d\n",debugging); > + > err = class_register(&st_sysfs_class); > if (err) { > pr_err("Unable register sysfs class for SCSI tapes\n"); -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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] 13+ messages in thread
* Re: [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request 2014-10-19 13:44 ` Laurence Oberman 2014-10-19 19:37 ` "Kai Mäkisara (Kolumbus)" @ 2014-10-23 17:11 ` Christoph Hellwig 1 sibling, 0 replies; 13+ messages in thread From: Christoph Hellwig @ 2014-10-23 17:11 UTC (permalink / raw) To: Laurence Oberman; +Cc: Kai M??kisara (Kolumbus), linux-scsi Thanks, I've applied this patch to the core-for-3.19 branch after fixing a few whitespace issues. ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-10-23 17:11 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <2027096335.17236699.1402433423338.JavaMail.zimbra@redhat.com>
2014-06-10 20:51 ` Debug flag parameter for SCSI tape driver Laurence Oberman
2014-06-10 23:48 ` [PATCH]: add debug " Laurence Oberman
2014-06-11 18:03 ` "Kai Mäkisara (Kolumbus)"
2014-06-11 18:24 ` Laurence Oberman
2014-06-11 19:35 ` Dale R. Worley
2014-06-11 19:54 ` Laurence Oberman
2014-06-13 21:18 ` Debug " Dale R. Worley
2014-10-17 20:20 ` [PATCH]: add debug flag parameter for SCSI tape driver - 2nd request Laurence Oberman
2014-10-17 20:41 ` Laurence Oberman
2014-10-19 8:54 ` "Kai Mäkisara (Kolumbus)"
2014-10-19 13:44 ` Laurence Oberman
2014-10-19 19:37 ` "Kai Mäkisara (Kolumbus)"
2014-10-23 17:11 ` Christoph Hellwig
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).