lkml.org 
[lkml]   [2014]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 04/10] ACPI/EC: Refine command storm prevention support.
    Date
    This patch refines EC command storm prevention support.

    Ideally, we should only enable storm prevention for the current command so
    that the next command can try the efficient interrupt mode again.

    Signed-off-by: Lv Zheng <lv.zheng@intel.com>
    ---
    drivers/acpi/ec.c | 21 +++++++++------------
    1 file changed, 9 insertions(+), 12 deletions(-)

    diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
    index 5049981..d4c07b9 100644
    --- a/drivers/acpi/ec.c
    +++ b/drivers/acpi/ec.c
    @@ -76,7 +76,6 @@ enum ec_command {

    enum {
    EC_FLAGS_QUERY_PENDING, /* Query is pending */
    - EC_FLAGS_GPE_STORM, /* GPE storm detected */
    EC_FLAGS_HANDLERS_INSTALLED, /* Handlers for GPE and
    * OpReg are installed */
    EC_FLAGS_STARTED, /* Driver is started */
    @@ -243,8 +242,14 @@ err:
    * otherwise will take a not handled IRQ as a false one.
    */
    if (!(status & ACPI_EC_FLAG_SCI)) {
    - if (in_interrupt() && t)
    - ++t->irq_count;
    + if (in_interrupt() && t) {
    + if (t->irq_count < ec_storm_threshold)
    + ++t->irq_count;
    + if (t->irq_count == ec_storm_threshold) {
    + pr_debug("+++++ Polling enabled +++++\n");
    + acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
    + }
    + }
    }
    return wakeup;
    }
    @@ -318,23 +323,15 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
    acpi_enable_gpe(NULL, ec->gpe);
    pr_debug("***** Command(%s) started *****\n",
    acpi_ec_cmd_string(t->command));
    - if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
    - pr_debug("+++++ Polling enabled +++++\n");
    - acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
    - }
    start_transaction(ec);
    if (ec->curr->command == ACPI_EC_COMMAND_QUERY)
    clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
    spin_unlock_irqrestore(&ec->lock, tmp);
    ret = ec_poll(ec);
    spin_lock_irqsave(&ec->lock, tmp);
    - if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
    + if (t->irq_count == ec_storm_threshold) {
    acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
    pr_debug("+++++ Polling disabled +++++\n");
    - } else if (t->irq_count > ec_storm_threshold) {
    - pr_debug("+++++ Polling scheduled (%d GPE) +++++\n",
    - t->irq_count);
    - set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
    }
    pr_debug("***** Command(%s) stopped *****\n",
    acpi_ec_cmd_string(t->command));
    --
    1.7.10


    \
     
     \ /
      Last update: 2014-07-15 09:41    [W:4.052 / U:0.100 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site