[PATCH] Add errseq_t documentation to the tree

2017-12-22 Thread Matthew Wilcox

 - Add it under 'Core API' because I think that's where it lives.
 - Promote the header to a more prominent header type, otherwise we get three
   entries in the table of contents.
 - Reformat the table to look nicer and be a little more proportional in
   terms of horizontal width per bit (the SF bit is still disproportionately
   large, but there's no way to fix that).

Signed-off-by: Matthew Wilcox 

diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
index eb16ba30aeb6..b8ec120c24f9 100644
--- a/Documentation/core-api/index.rst
+++ b/Documentation/core-api/index.rst
@@ -22,6 +22,7 @@ Core utilities
flexible-arrays
librs
genalloc
+   ../errseq
 
 Interfaces for kernel debugging
 ===
diff --git a/Documentation/errseq.rst b/Documentation/errseq.rst
index 4c29bd5afbc5..7c3ac9639ebf 100644
--- a/Documentation/errseq.rst
+++ b/Documentation/errseq.rst
@@ -1,5 +1,7 @@
+=
 The errseq_t datatype
 =
+
 An errseq_t is a way of recording errors in one place, and allowing any
 number of "subscribers" to tell whether it has changed since a previous
 point where it was sampled.
@@ -21,12 +23,13 @@ a flag to tell whether the value has been sampled since a 
new value was
 recorded.  That allows us to avoid bumping the counter if no one has
 sampled it since the last time an error was recorded.
 
-Thus we end up with a value that looks something like this::
+Thus we end up with a value that looks something like this:
 
-bit:  31..131211..0
-+-+++
-| counter | SF |  errno |
-+-+++
++--+++
+| 31..13   | 12 | 11..0  |
++--+++
+| counter  | SF | errno  |
++--+++
 
 The general idea is for "watchers" to sample an errseq_t value and keep
 it as a running cursor.  That value can later be used to tell whether
@@ -42,6 +45,7 @@ has ever been an error set since it was first initialized.
 
 API usage
 =
+
 Let me tell you a story about a worker drone.  Now, he's a good worker
 overall, but the company is a little...management heavy.  He has to
 report to 77 supervisors today, and tomorrow the "big boss" is coming in
@@ -125,6 +129,7 @@ not usable by anyone else.
 
 Serializing errseq_t cursor updates
 ===
+
 Note that the errseq_t API does not protect the errseq_t cursor during a
 check_and_advance_operation. Only the canonical error code is handled
 atomically.  In a situation where more than one task might be using the
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add errseq_t documentation to the tree

2017-12-22 Thread Jeff Layton
On Fri, 2017-12-22 at 05:04 -0800, Matthew Wilcox wrote:
>  - Add it under 'Core API' because I think that's where it lives.
>  - Promote the header to a more prominent header type, otherwise we get three
>entries in the table of contents.
>  - Reformat the table to look nicer and be a little more proportional in
>terms of horizontal width per bit (the SF bit is still disproportionately
>large, but there's no way to fix that).
> 
> Signed-off-by: Matthew Wilcox 
> 
> diff --git a/Documentation/core-api/index.rst 
> b/Documentation/core-api/index.rst
> index eb16ba30aeb6..b8ec120c24f9 100644
> --- a/Documentation/core-api/index.rst
> +++ b/Documentation/core-api/index.rst
> @@ -22,6 +22,7 @@ Core utilities
> flexible-arrays
> librs
> genalloc
> +   ../errseq
> 

Should we also move the file into core-api/ dir?

>  
>  Interfaces for kernel debugging
>  ===
> diff --git a/Documentation/errseq.rst b/Documentation/errseq.rst
> index 4c29bd5afbc5..7c3ac9639ebf 100644
> --- a/Documentation/errseq.rst
> +++ b/Documentation/errseq.rst
> @@ -1,5 +1,7 @@
> +=
>  The errseq_t datatype
>  =
> +
>  An errseq_t is a way of recording errors in one place, and allowing any
>  number of "subscribers" to tell whether it has changed since a previous
>  point where it was sampled.
> @@ -21,12 +23,13 @@ a flag to tell whether the value has been sampled since a 
> new value was
>  recorded.  That allows us to avoid bumping the counter if no one has
>  sampled it since the last time an error was recorded.
>  
> -Thus we end up with a value that looks something like this::
> +Thus we end up with a value that looks something like this:
>  
> -bit:  31..131211..0
> -+-+++
> -| counter | SF |  errno |
> -+-+++
> ++--+++
> +| 31..13   | 12 | 11..0  |
> ++--+++
> +| counter  | SF | errno  |
> ++--+++
>  
>  The general idea is for "watchers" to sample an errseq_t value and keep
>  it as a running cursor.  That value can later be used to tell whether
> @@ -42,6 +45,7 @@ has ever been an error set since it was first initialized.
>  
>  API usage
>  =
> +
>  Let me tell you a story about a worker drone.  Now, he's a good worker
>  overall, but the company is a little...management heavy.  He has to
>  report to 77 supervisors today, and tomorrow the "big boss" is coming in
> @@ -125,6 +129,7 @@ not usable by anyone else.
>  
>  Serializing errseq_t cursor updates
>  ===
> +
>  Note that the errseq_t API does not protect the errseq_t cursor during a
>  check_and_advance_operation. Only the canonical error code is handled
>  atomically.  In a situation where more than one task might be using the

Thanks for the cleanup, looks good.

Reviewed-by: Jeff Layton 
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add errseq_t documentation to the tree

2017-12-22 Thread Matthew Wilcox
On Fri, Dec 22, 2017 at 08:29:34AM -0500, Jeff Layton wrote:
> > +++ b/Documentation/core-api/index.rst
> > @@ -22,6 +22,7 @@ Core utilities
> > flexible-arrays
> > librs
> > genalloc
> > +   ../errseq
> > 
> 
> Should we also move the file into core-api/ dir?

I was wondering the same thing.  I'll do a v2.  I was also thinking about
including the kernel-doc from lib/errseq.c into this file.  Seems like the
logical thing to do.

> Reviewed-by: Jeff Layton 

Merci!
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] errseq: Add to documentation tree

2017-12-22 Thread Matthew Wilcox
From: Matthew Wilcox 

 - Move errseq.rst into core-api
 - Add errseq to the core-api index
 - Promote the header to a more prominent header type, otherwise we get three
   entries in the table of contents.
 - Reformat the table to look nicer and be a little more proportional in
   terms of horizontal width per bit (the SF bit is still disproportionately
   large, but there's no way to fix that).
 - Include errseq kernel-doc in the errseq.rst
 - Neaten some kernel-doc markup

Signed-off-by: Matthew Wilcox 
Reviewed-by: Jeff Layton 
---
 Documentation/{ => core-api}/errseq.rst | 20 +-
 Documentation/core-api/index.rst|  1 +
 include/linux/errseq.h  |  2 +-
 lib/errseq.c| 37 +++--
 4 files changed, 38 insertions(+), 22 deletions(-)
 rename Documentation/{ => core-api}/errseq.rst (92%)

diff --git a/Documentation/errseq.rst b/Documentation/core-api/errseq.rst
similarity index 92%
rename from Documentation/errseq.rst
rename to Documentation/core-api/errseq.rst
index 4c29bd5afbc5..ff332e272405 100644
--- a/Documentation/errseq.rst
+++ b/Documentation/core-api/errseq.rst
@@ -1,5 +1,7 @@
+=
 The errseq_t datatype
 =
+
 An errseq_t is a way of recording errors in one place, and allowing any
 number of "subscribers" to tell whether it has changed since a previous
 point where it was sampled.
@@ -21,12 +23,13 @@ a flag to tell whether the value has been sampled since a 
new value was
 recorded.  That allows us to avoid bumping the counter if no one has
 sampled it since the last time an error was recorded.
 
-Thus we end up with a value that looks something like this::
+Thus we end up with a value that looks something like this:
 
-bit:  31..131211..0
-+-+++
-| counter | SF |  errno |
-+-+++
++--+++
+| 31..13   | 12 | 11..0  |
++--+++
+| counter  | SF | errno  |
++--+++
 
 The general idea is for "watchers" to sample an errseq_t value and keep
 it as a running cursor.  That value can later be used to tell whether
@@ -42,6 +45,7 @@ has ever been an error set since it was first initialized.
 
 API usage
 =
+
 Let me tell you a story about a worker drone.  Now, he's a good worker
 overall, but the company is a little...management heavy.  He has to
 report to 77 supervisors today, and tomorrow the "big boss" is coming in
@@ -125,6 +129,7 @@ not usable by anyone else.
 
 Serializing errseq_t cursor updates
 ===
+
 Note that the errseq_t API does not protect the errseq_t cursor during a
 check_and_advance_operation. Only the canonical error code is handled
 atomically.  In a situation where more than one task might be using the
@@ -147,3 +152,8 @@ errseq_check_and_advance after taking the lock. e.g.::
 
 That avoids the spinlock in the common case where nothing has changed
 since the last time it was checked.
+
+Functions
+=
+
+.. kernel-doc:: lib/errseq.c
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
index eb16ba30aeb6..b226d05df1c3 100644
--- a/Documentation/core-api/index.rst
+++ b/Documentation/core-api/index.rst
@@ -22,6 +22,7 @@ Core utilities
flexible-arrays
librs
genalloc
+   errseq
 
 Interfaces for kernel debugging
 ===
diff --git a/include/linux/errseq.h b/include/linux/errseq.h
index 6ffae9c5052d..fc270768 100644
--- a/include/linux/errseq.h
+++ b/include/linux/errseq.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /*
- * See Documentation/errseq.rst and lib/errseq.c
+ * See Documentation/core-api/errseq.rst and lib/errseq.c
  */
 #ifndef _LINUX_ERRSEQ_H
 #define _LINUX_ERRSEQ_H
diff --git a/lib/errseq.c b/lib/errseq.c
index 79cc66897db4..df782418b333 100644
--- a/lib/errseq.c
+++ b/lib/errseq.c
@@ -46,14 +46,14 @@
  * @eseq: errseq_t field that should be set
  * @err: error to set (must be between -1 and -MAX_ERRNO)
  *
- * This function sets the error in *eseq, and increments the sequence counter
+ * This function sets the error in @eseq, and increments the sequence counter
  * if the last sequence was sampled at some point in the past.
  *
  * Any error set will always overwrite an existing error.
  *
- * We do return the latest value here, primarily for debugging purposes. The
- * return value should not be used as a previously sampled value in later calls
- * as it will not have the SEEN flag set.
+ * Return: The previous value, primarily for debugging purposes. The
+ * return value should not be used as a previously sampled value in later
+ * 

Re: [PATCH 05/11] media: dvb_vb2: fix a warning about streamoff logic

2017-12-22 Thread Mauro Carvalho Chehab
Em Thu, 21 Dec 2017 14:18:04 -0200
Mauro Carvalho Chehab  escreveu:

> The streamoff logic is causing those warnings:
> 
>  WARNING: CPU: 3 PID: 3382 at drivers/media/v4l2-core/videobuf2-core.c:1652 
> __vb2_queue_cancel+0x177/0x250 [videobuf2_core]
>  Modules linked in: bnep fuse xt_CHECKSUM iptable_mangle tun ebtable_filter 
> ebtables ip6table_filter ip6_tables xt_physdev br_netfilter bluetooth bridge 
> rfkill ecdh_generic stp llc nf_log_ipv4 nf_log_common xt_LOG xt_conntrack 
> ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 
> nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c sunrpc vfat fat 
> snd_hda_codec_hdmi rc_dib0700_nec i915 rc_pinnacle_pctv_hd em28xx_rc a8293 
> ts2020 m88ds3103 i2c_mux em28xx_dvb dib8000 dvb_usb_dib0700 dib0070 dib7000m 
> dib0090 dvb_usb dvb_core uvcvideo snd_usb_audio videobuf2_v4l2 dib3000mc 
> videobuf2_vmalloc videobuf2_memops dibx000_common videobuf2_core rc_core 
> snd_usbmidi_lib snd_rawmidi em28xx tveeprom v4l2_common videodev media 
> intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_intel
>  kvm_intel snd_hda_codec kvm snd_hwdep snd_hda_core snd_seq irqbypass 
> crct10dif_pclmul crc32_pclmul i2c_algo_bit ghash_clmulni_intel snd_seq_device 
> drm_kms_helper snd_pcm intel_cstate intel_uncore snd_timer tpm_tis drm 
> mei_wdt iTCO_wdt iTCO_vendor_support tpm_tis_core snd intel_rapl_perf mei_me 
> mei tpm i2c_i801 soundcore lpc_ich video binfmt_misc hid_logitech_hidpp 
> hid_logitech_dj e1000e crc32c_intel ptp pps_core analog gameport joydev
>  CPU: 3 PID: 3382 Comm: lt-dvbv5-zap Not tainted 4.14.0+ #3
>  Hardware name:  /D53427RKE, BIOS 
> RKPPT10H.86A.0048.2017.0506.1545 05/06/2017
>  task: 94b93bbe1e40 task.stack: b7a98320c000
>  RIP: 0010:__vb2_queue_cancel+0x177/0x250 [videobuf2_core]
>  RSP: 0018:b7a98320fd40 EFLAGS: 00010202
>  RAX: 0001 RBX: 94b92ff72428 RCX: 
>  RDX: 0001 RSI: 0001 RDI: 94b92ff72428
>  RBP: b7a98320fd68 R08: 94b92ff725d8 R09: b7a98320fcc8
>  R10: 94b978003d98 R11: 94b92ff72428 R12: 94b92ff72428
>  R13: 0282 R14: 94b92059ae20 R15: dead0100
>  FS:  () GS:94b99e38() knlGS:
>  CS:  0010 DS:  ES:  CR0: 80050033
>  CR2: 555953007d70 CR3: 00012be09004 CR4: 001606e0
>  Call Trace:
>   vb2_core_streamoff+0x28/0x90 [videobuf2_core]
>   dvb_vb2_stream_off+0xd1/0x150 [dvb_core]
>   dvb_dvr_release+0x114/0x120 [dvb_core]
>   __fput+0xdf/0x1e0
>   fput+0xe/0x10
>   task_work_run+0x94/0xc0
>   do_exit+0x2dc/0xba0
>   do_group_exit+0x47/0xb0
>   SyS_exit_group+0x14/0x20
>   entry_SYSCALL_64_fastpath+0x1a/0xa5
>  RIP: 0033:0x7f775e931ed8
>  RSP: 002b:7fff07019d68 EFLAGS: 0246 ORIG_RAX: 00e7
>  RAX: ffda RBX: 01d02690 RCX: 7f775e931ed8
>  RDX: 0001 RSI: 003c RDI: 0001
>  RBP: 7fff0701a500 R08: 00e7 R09: ff70
>  R10: 7f775e854dd8 R11: 0246 R12: 
>  R13: 035fa000 R14: 000a R15: 000a
>  Code: 00 00 04 74 1c 44 89 e8 49 83 c5 01 41 39 84 24 88 01 00 00 77 8a 5b 
> 41 5c 41 5d 41 5e 41 5f 5d c3 48 89 df e8 bb fd ff ff eb da <0f> ff 41 8b b4 
> 24 88 01 00 00 85 f6 74 34 bb 01 00 00 00 eb 10
> 
> There are actually two issues here:
> 
> 1) list_del() should be called when changing the buffer state;
> 
> 2) The logic with marks the buffers as done is at the wrong place.
> 
> Signed-off-by: Mauro Carvalho Chehab 

I ended by sending a wrong version. The one I sent causes a list
corruption, as it deletes a queued value without marking the buffer
as done:

[  627.233534] list_del corruption, a0aa01182e20->next is 
LIST_POISON1 (dead0100)


Regards,
Mauro



[PATCH] media: dvb_vb2: fix a warning about streamoff logic

The streamoff logic is causing those warnings:

 WARNING: CPU: 3 PID: 3382 at drivers/media/v4l2-core/videobuf2-core.c:1652 
__vb2_queue_cancel+0x177/0x250 [videobuf2_core]
 Modules linked in: bnep fuse xt_CHECKSUM iptable_mangle tun ebtable_filter 
ebtables ip6table_filter ip6_tables xt_physdev br_netfilter bluetooth bridge 
rfkill ecdh_generic stp llc nf_log_ipv4 nf_log_common xt_LOG xt_conntrack 
ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_conntrack_ipv4 
nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack libcrc32c sunrpc vfat fat 
snd_hda_codec_hdmi rc_dib0700_nec i915 rc_pinnacle_pctv_hd em28xx_rc a8293 
ts2020 m88ds3103 i2c_mux em28xx_dvb dib8000 dvb_usb_dib0700 dib0070 dib7000m 
dib0090 dvb_usb dvb_core uvcvideo snd_usb_audio videobuf2_v4l2 dib3000mc 
videobuf2_vmalloc videobuf2_memops dibx000_common videobuf2_core rc_core 
snd_usbmidi_lib snd_rawmidi em28xx tveeprom v4l2_common videodev media 
intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_intel
 kvm_intel snd_hda_codec kvm snd_h

[PATCH] doc: md: Fix a file name to md-fault.c in fault-injection.txt

2017-12-22 Thread Masanari Iida
drivers/md/faulty.c has been renamed to md-faulty.c after
following commit merged int to the main line.

  935fe0983e09f4f7331ebf5ea4ae2124f6e9f9e8 .

But the file name in fault-injection.txt has not been changed.
Now the actual file name and document are in sync.

Signed-off-by: Masanari Iida 
---
 Documentation/fault-injection/fault-injection.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/fault-injection/fault-injection.txt 
b/Documentation/fault-injection/fault-injection.txt
index 918972babcd8..1c0bfbbf7869 100644
--- a/Documentation/fault-injection/fault-injection.txt
+++ b/Documentation/fault-injection/fault-injection.txt
@@ -1,7 +1,7 @@
 Fault injection capabilities infrastructure
 ===
 
-See also drivers/md/faulty.c and "every_nth" module option for scsi_debug.
+See also drivers/md/md-faulty.c and "every_nth" module option for scsi_debug.
 
 
 Available fault injection capabilities
-- 
2.15.1.433.g936d1b989416

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] errseq: Add to documentation tree

2017-12-22 Thread Randy Dunlap
On 12/22/2017 06:32 AM, Matthew Wilcox wrote:
> From: Matthew Wilcox 
> 
>  - Move errseq.rst into core-api
>  - Add errseq to the core-api index
>  - Promote the header to a more prominent header type, otherwise we get three
>entries in the table of contents.
>  - Reformat the table to look nicer and be a little more proportional in
>terms of horizontal width per bit (the SF bit is still disproportionately
>large, but there's no way to fix that).
>  - Include errseq kernel-doc in the errseq.rst
>  - Neaten some kernel-doc markup
> 
> Signed-off-by: Matthew Wilcox 
> Reviewed-by: Jeff Layton 
> ---
>  Documentation/{ => core-api}/errseq.rst | 20 +-
>  Documentation/core-api/index.rst|  1 +
>  include/linux/errseq.h  |  2 +-
>  lib/errseq.c| 37 
> +++--
>  4 files changed, 38 insertions(+), 22 deletions(-)
>  rename Documentation/{ => core-api}/errseq.rst (92%)


Nice.  Thanks.

Reviewed-by: Randy Dunlap 


-- 
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html