linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laura Abbott <labbott@redhat.com>
To: "Murtaza, Alexandru" <alexandru.murtaza@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "Baluta, Teodora" <teodora.baluta@intel.com>
Subject: Re: [RFC][PATCH] Oops messages transfer using QR codes
Date: Mon, 9 Nov 2015 16:27:01 -0800	[thread overview]
Message-ID: <564139D5.2040407@redhat.com> (raw)
In-Reply-To: <70CA577BF349C64188E42B39029FE9AD135AB591@IRSMSX102.ger.corp.intel.com>

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

      reply	other threads:[~2015-11-10  0:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 15:03 [RFC][PATCH] Oops messages transfer using QR codes Murtaza Alexandru
2015-10-30 22:05 ` Randy Dunlap
2015-11-04 13:40   ` Murtaza, Alexandru
2015-11-02 18:56 ` Laura Abbott
2015-11-04 11:32   ` Murtaza, Alexandru
2015-11-10  0:27     ` Laura Abbott [this message]

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=564139D5.2040407@redhat.com \
    --to=labbott@redhat.com \
    --cc=alexandru.murtaza@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=teodora.baluta@intel.com \
    /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).