From patchwork Fri Dec 16 22:30:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 9478601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 16C97607EE for ; Fri, 16 Dec 2016 22:31:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0703C28581 for ; Fri, 16 Dec 2016 22:31:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFE092866B; Fri, 16 Dec 2016 22:31:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4B9928581 for ; Fri, 16 Dec 2016 22:31:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758161AbcLPWbC (ORCPT ); Fri, 16 Dec 2016 17:31:02 -0500 Received: from mail-pg0-f54.google.com ([74.125.83.54]:36811 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753596AbcLPWbA (ORCPT ); Fri, 16 Dec 2016 17:31:00 -0500 Received: by mail-pg0-f54.google.com with SMTP id f188so36456300pgc.3 for ; Fri, 16 Dec 2016 14:30:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=BLuF3Hx0dtAJofuJHRWwSsDtCoCYW2jG69Xpqimi0ts=; b=P/N4Tw4Cu7qHBrAmyDwcrsCWKhuoSy0Ue1UVu170xDBgw4hMgoEevk3F8GNWKxNuoB IsAsdK5ztM1PDSkk/JGujGEeD/Gosg/OrvTRWrIiISZCkb6Q5gTVEJWsv7LbfeSOYNQ6 0S1CI8Kbd1J212DDzKJvJ52wUygOC1nKmQ6MT3bS/QPk+d2RR31KSHJByLXz9lRq/6X/ OsZCX8pOCtu6MVWcKguMEnaJ8rVVE0DCVa78Q6fA1qG203EuHj8SAyIHcQxUVxd+fknn xkeZzrdHoMGUT2W+b22J32wj78s3YBZKrf8tjYM2HolmhnatOB/ld6qebK3nUbOgwsFL RD8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BLuF3Hx0dtAJofuJHRWwSsDtCoCYW2jG69Xpqimi0ts=; b=WMxEr/kpbNtE8ao1zooC7yiCjCEBTNdkoHwhrPogaAkk4eY4HU/Vw5IcBIaHJjwt3l /iSM2ORvscnr7rYZHaqoarTvmruDpmRKkXZks4HoyGSE3kHd+tpv0nD0nrSiSXFp67mt SupXM3FJ4t4jP/FFfcKpT9bpztxcXHNLc9gz61GczmlXJj7D1mNCGjgWSxxTfSdlp68k oJAOyIEleQkjQB4NA/+1Dn0ZdUzRvA4HC+sIel94LghE0kkTZ1FfG/3FHMRtk/QXQi5q WJUYcQp1//9h8ILKVRzRYsxWryidOant7RBNAdg+sVXMQ+A6ZAIbV0yDzar6dorVYsN6 +syg== X-Gm-Message-State: AKaTC01kHaZJ6fRh92QahexedbisIkcwKG0GEaG2H0aHe6+Ck27jJ4Rn/LzWXmGAC+Sq1Etq X-Received: by 10.84.174.129 with SMTP id r1mr11688017plb.19.1481927459265; Fri, 16 Dec 2016 14:30:59 -0800 (PST) Received: from dmatlack.sea.corp.google.com ([100.100.206.82]) by smtp.gmail.com with ESMTPSA id u3sm14103510pfk.3.2016.12.16.14.30.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Dec 2016 14:30:58 -0800 (PST) From: David Matlack To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com, peterz@infradead.org, haokexin@gmail.com, mpe@ellerman.id.au, yongjun_wei@trendmicro.com.cn, rusty@rustcorp.com.au, jbaron@akamai.com, David Matlack Subject: [PATCH 1/2] jump_labels: API for flushing deferred jump label updates Date: Fri, 16 Dec 2016 14:30:35 -0800 Message-Id: <1481927436-104568-1-git-send-email-dmatlack@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Modules that use static_key_deferred need a way to synchronize with any delayed work that is still pending when the module is unloaded. Introduce static_key_deferred_flush() which flushes any pending jump label updates. Signed-off-by: David Matlack Acked-by: Peter Zijlstra (Intel) --- include/linux/jump_label_ratelimit.h | 5 +++++ kernel/jump_label.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/include/linux/jump_label_ratelimit.h b/include/linux/jump_label_ratelimit.h index 089f70f..23da3af 100644 --- a/include/linux/jump_label_ratelimit.h +++ b/include/linux/jump_label_ratelimit.h @@ -14,6 +14,7 @@ struct static_key_deferred { #ifdef HAVE_JUMP_LABEL extern void static_key_slow_dec_deferred(struct static_key_deferred *key); +extern void static_key_deferred_flush(struct static_key_deferred *key); extern void jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); @@ -26,6 +27,10 @@ static inline void static_key_slow_dec_deferred(struct static_key_deferred *key) STATIC_KEY_CHECK_USE(); static_key_slow_dec(&key->key); } +static inline void static_key_deferred_flush(struct static_key_deferred *key) +{ + STATIC_KEY_CHECK_USE(); +} static inline void jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl) diff --git a/kernel/jump_label.c b/kernel/jump_label.c index 93ad6c1..a9b8cf5 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c @@ -182,6 +182,13 @@ void static_key_slow_dec_deferred(struct static_key_deferred *key) } EXPORT_SYMBOL_GPL(static_key_slow_dec_deferred); +void static_key_deferred_flush(struct static_key_deferred *key) +{ + STATIC_KEY_CHECK_USE(); + flush_delayed_work(&key->work); +} +EXPORT_SYMBOL_GPL(static_key_deferred_flush); + void jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl) {