public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jroedel@suse.de
Cc: kvm@vger.kernel.org
Subject: [bug report] x86/sev: Split up runtime #VC handler for correct state tracking
Date: Wed, 4 Aug 2021 12:57:25 +0300	[thread overview]
Message-ID: <20210804095725.GA8011@kili> (raw)

Hello Joerg Roedel,

The patch be1a5408868a: "x86/sev: Split up runtime #VC handler for
correct state tracking" from Jun 18, 2021, leads to the following
static checker warning:

	arch/x86/kernel/kvm.c:153 kvm_async_pf_task_wait_schedule()
	warn: sleeping in atomic context

arch/x86/kernel/sev.c
  1416           * Handle #DB before calling into !noinstr code to avoid recursive #DB.
  1417           */
  1418          if (vc_is_db(error_code)) {
  1419                  exc_debug(regs);
  1420                  return;
  1421          }
  1422  
  1423          irq_state = irqentry_nmi_enter(regs);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
preempt disabled inside irqentry_nmi_enter().

  1424  
  1425          instrumentation_begin();
  1426  
  1427          if (!vc_raw_handle_exception(regs, error_code)) {
                     ^^^^^^^^^^^^^^^^^^^^^^^^

These sleeping in atomic static checker warnings come with a lot of
caveats because the call tree is very long and it's easy to have false
positives.

--> vc_raw_handle_exception()
    --> vc_forward_exception()
        --> exc_page_fault()

Page faults always sleep right?

  1428                  /* Show some debug info */
  1429                  show_regs(regs);
  1430  
  1431                  /* Ask hypervisor to sev_es_terminate */
  1432                  sev_es_terminate(GHCB_SEV_ES_REASON_GENERAL_REQUEST);
  1433  
  1434                  /* If that fails and we get here - just panic */
  1435                  panic("Returned from Terminate-Request to Hypervisor\n");
  1436          }
  1437  
  1438          instrumentation_end();
  1439          irqentry_nmi_exit(regs, irq_state);
  1440  }

regards,
dan carpenter

             reply	other threads:[~2021-08-04  9:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  9:57 Dan Carpenter [this message]
2021-08-04 12:38 ` [bug report] x86/sev: Split up runtime #VC handler for correct state tracking Joerg Roedel
2021-08-04 12:58   ` Dan Carpenter
2021-08-04 13:35     ` Joerg Roedel
2021-08-04 13:42       ` Dan Carpenter
2021-08-04 14:23     ` Joerg Roedel
2021-08-06  8:35       ` Dan Carpenter

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=20210804095725.GA8011@kili \
    --to=dan.carpenter@oracle.com \
    --cc=jroedel@suse.de \
    --cc=kvm@vger.kernel.org \
    /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