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


Groups > linux.kernel > #1262227 > unrolled thread

RE: [RFC][PATCH] Oops messages transfer using QR codes

Started by"Murtaza, Alexandru" <alexandru.murtaza@intel.com>
First post2015-11-04 12:40 +0100
Last post2015-11-10 01:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  RE: [RFC][PATCH] Oops messages transfer using QR codes "Murtaza, Alexandru" <alexandru.murtaza@intel.com> - 2015-11-04 12:40 +0100
    Re: [RFC][PATCH] Oops messages transfer using QR codes Laura Abbott <labbott@redhat.com> - 2015-11-10 01:30 +0100

#1262227 — RE: [RFC][PATCH] Oops messages transfer using QR codes

From"Murtaza, Alexandru" <alexandru.murtaza@intel.com>
Date2015-11-04 12:40 +0100
SubjectRE: [RFC][PATCH] Oops messages transfer using QR codes
Message-ID<qr4A2-8gn-7@gated-at.bofh.it>
> I'm glad to see someone continuing on this work. For the next version, can
> you break it up for ease of review? I'd say put the lib/qr/ addition as one
> patch and then the print_oops as a second patch.

I will do this for the next version, I just didn't really know what would be best.

> Go ahead and drop any __cplusplus wrappers.

Thanks for carefully looking into the patch, this was from the old version and
I only refactored the qr library just so it can pass checkpatch.pl. 

> The preferred style is to not have #ifdef in functions if it can be
> avoided. #ifdef in the header file for print_qr_err would be better.

Could you please refer some example? I don't exactly understand what is
the desired way in this case.

> I gave it a quick test with just a 'echo c > /proc/sysrq-trigger'
> and got a scheduling while atomic warning in addition to not seeing a
> QR code. I don't think waking up a thread on panic is the correct approach
> here. Can you elaborate more on what problem you were trying to solve by
> adding a thread?

You are right. It doesn't do anything for panics. Currently only Oopses are
handled, but this approach should work fine for panics too, with some code 
changes. Basically, what runs inside the qr_thread_func can run after the panic 
with no problem (at least the ASCII version of QR codes). 

> Not quite sure what this is doing here, can you split this out into a
> separate patch?

Oops, Teodora told me I have to change this back and I totally forgot. Sorry.

> This function is defined a few places elsewhere in the kernel, it
> might be worth it to pull it out to a generic header file (bitops.h?)

I will look into this and if applicable, I will do a separate patch.

> I'm guessing this is atomic because it's not possible to determine
> the gfp flags?

As I understood from Teodora, this was a quick fix in case multiple CPUs are 
having an Oops. I will change this and make it more clear.

> This function doesn't help anything. Just put the kzalloc inline.

> This and a bunch of the other functions need to return actual
> error codes and not just -1

> These are already defined in ctypes.h do, do they need to be redefined?

Same explanation as for __cplusplus. I will fix these too.

Thank you very much for your feedback. Please let me know what you think of it
after you test it with Oops messages.
--
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]


#1266112

FromLaura Abbott <labbott@redhat.com>
Date2015-11-10 01:30 +0100
Message-ID<qt4YW-65g-13@gated-at.bofh.it>
In reply to#1262227
On 11/04/2015 03:32 AM, Murtaza, Alexandru wrote:
>> The preferred style is to not have #ifdef in functions if it can be
>> avoided. #ifdef in the header file for print_qr_err would be better.
>
> Could you please refer some example? I don't exactly understand what is
> the desired way in this case.
>

In print_oops.h you can do

#ifdef CONFIG_QR_OOPS
void print_qr_err(void);
#else
static inline void print_qr_err(void);
#endif

This way if CONFIG_QR_OOPS is disabled the function just gets stubbed out.
  
>> I gave it a quick test with just a 'echo c > /proc/sysrq-trigger'
>> and got a scheduling while atomic warning in addition to not seeing a
>> QR code. I don't think waking up a thread on panic is the correct approach
>> here. Can you elaborate more on what problem you were trying to solve by
>> adding a thread?
>
> You are right. It doesn't do anything for panics. Currently only Oopses are
> handled, but this approach should work fine for panics too, with some code
> changes. Basically, what runs inside the qr_thread_func can run after the panic
> with no problem (at least the ASCII version of QR codes).
>


Even without the waking up of the thread or the panic there still seem to be
scheduling while atomic issues. This is the rough code flow:

print_qr_err
   make_bk1_message (mutexes)
      make_bk1_packet (vmalloc)
         compress
            compr_init (vmalloc)
         qrcode_encode_data
            qrcode_encode_data_real
                qrcode_encode_mask
                    init_rs
                        init_rs_internal (mutex)

x86 oops_begin takes spinlocks and disables IRQs (as does ARM) so everything
that happens in the oops needs to be done in atomic mode which means no
vmalloc or mutexes. Most of this in kernel_oops can be refactored pretty
easily but you might need to think about how the Reed-Solomon code can be
refactored to avoid the mutex.

One other point I noticed: qr_thread_func has an msleep(100). Polling like
that isn't good style in the kernel. You should look into converting that
to the completion API (wait_for_completion, complete)

Can you share what you used for testing? I'm still not seeing any QR output.

Thanks,
Laura
--
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