All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: ira.weiny@intel.com
Cc: linux-acpi@vger.kernel.org
Subject: [bug report] acpi/ghes: Process CXL Component Events
Date: Wed, 31 Jan 2024 10:37:06 +0300	[thread overview]
Message-ID: <b963c490-2c13-4b79-bbe7-34c6568423c7@moroto.mountain> (raw)

Hello Ira Weiny,

The patch 671a794c33c6: "acpi/ghes: Process CXL Component Events"
from Dec 20, 2023 (linux-next), leads to the following Smatch static
checker warning:

	drivers/acpi/apei/ghes.c:724 cxl_cper_post_event()
	warn: sleeping in atomic context

drivers/acpi/apei/ghes.c
    709 static void cxl_cper_post_event(enum cxl_event_type event_type,
    710                                 struct cxl_cper_event_rec *rec)
    711 {
    712         if (rec->hdr.length <= sizeof(rec->hdr) ||
    713             rec->hdr.length > sizeof(*rec)) {
    714                 pr_err(FW_WARN "CXL CPER Invalid section length (%u)\n",
    715                        rec->hdr.length);
    716                 return;
    717         }
    718 
    719         if (!(rec->hdr.validation_bits & CPER_CXL_COMP_EVENT_LOG_VALID)) {
    720                 pr_err(FW_WARN "CXL CPER invalid event\n");
    721                 return;
    722         }
    723 
--> 724         guard(rwsem_read)(&cxl_cper_rw_sem);

rwsem_read is a sleeping lock however there are several callers which
hold spinlocks or disable preemption.

    725         if (cper_callback)
    726                 cper_callback(event_type, rec);
    727 }

Here are the call trees that trigger the Smatch warning.

ghes_poll_func() <- disables preempt
ghes_irq_func() <- disables preempt
ghes_notify_hed() <- disables preempt
ghes_probe() <- disables preempt
-> ghes_proc()
   -> ghes_do_proc()
      -> cxl_cper_post_event()

Probe for example is holding spin_lock_irqsave(&ghes_notify_lock_irq, flags);

regards,
dan carpenter

                 reply	other threads:[~2024-01-31  7:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=b963c490-2c13-4b79-bbe7-34c6568423c7@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=ira.weiny@intel.com \
    --cc=linux-acpi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.