From patchwork Mon Sep 17 21:31:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 10603441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 32D9B17D5 for ; Mon, 17 Sep 2018 21:31:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2667B2A83B for ; Mon, 17 Sep 2018 21:31:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AF0E2A83E; Mon, 17 Sep 2018 21:31:52 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 C80562A83A for ; Mon, 17 Sep 2018 21:31:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727672AbeIRDA7 (ORCPT ); Mon, 17 Sep 2018 23:00:59 -0400 Received: from mx2.mailbox.org ([80.241.60.215]:56156 "EHLO mx2.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727329AbeIRDA7 (ORCPT ); Mon, 17 Sep 2018 23:00:59 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 624D441238; Mon, 17 Sep 2018 23:31:49 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id sYB__rwx_4PS; Mon, 17 Sep 2018 23:31:48 +0200 (CEST) From: Hauke Mehrtens To: johannes@sipsolutions.net Cc: backports@vger.kernel.org, john@phrozen.org, Hauke Mehrtens Subject: [PATCH 6/7] header: Add u64_stats_update_{begin,end}_irqsave() Date: Mon, 17 Sep 2018 23:31:41 +0200 Message-Id: <20180917213142.7875-6-hauke@hauke-m.de> In-Reply-To: <20180917213142.7875-1-hauke@hauke-m.de> References: <20180917213142.7875-1-hauke@hauke-m.de> Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP These functions are currently used by the usbnet driver. These functions were introduced in upstream commit 2695578b896ae ("net: usbnet: fix potential deadlock on 32bit hosts") Signed-off-by: Hauke Mehrtens --- backport/backport-include/linux/u64_stats_sync.h | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/backport/backport-include/linux/u64_stats_sync.h b/backport/backport-include/linux/u64_stats_sync.h index 112a4094..0d221238 100644 --- a/backport/backport-include/linux/u64_stats_sync.h +++ b/backport/backport-include/linux/u64_stats_sync.h @@ -151,4 +151,29 @@ static inline bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *syncp, #endif #endif /* LINUX_VERSION_IS_LESS(3,13,0) */ +#if LINUX_VERSION_IS_LESS(4,16,0) && \ + !LINUX_VERSION_IN_RANGE(4,14,44, 4,15,0) +static inline unsigned long +u64_stats_update_begin_irqsave(struct u64_stats_sync *syncp) +{ + unsigned long flags = 0; + +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) + local_irq_save(flags); + write_seqcount_begin(&syncp->seq); +#endif + return flags; +} + +static inline void +u64_stats_update_end_irqrestore(struct u64_stats_sync *syncp, + unsigned long flags) +{ +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) + write_seqcount_end(&syncp->seq); + local_irq_restore(flags); +#endif +} +#endif /* < 4.16 */ + #endif /* __BACKPORT_LINUX_U64_STATS_SYNC_H */