From patchwork Fri Dec 4 11:34:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 1410968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sipsolutions.net Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Mk7mJ/bZ; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CnVx93505z9sPB for ; Fri, 4 Dec 2020 22:34:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=76SBTr90XtCXYdN0gBMOl8Nh1ODpf0fH/xpnepuozwg=; b=Mk7mJ/bZ813kam5+kebHG/EVVd 8txKhsPT5BlsuSSsolmfRHI2kzsqPj3eIgIBGfyp+3wlKx0Qjkt7/fenJyUjyBolpUn15sp+o5U6q j/dT77yNQ0smt//e2ilwns6Bgin0sKrTTfB3KViQgQKA7lLKIYRdYkJQ/6urA5cmDNhMfh62Nmt+D u7alKzktYONuSiDBvOOT5kgnUYU3E424puI6XlKTcYxbC3E3bZ8Nw7ak2hCPTzjn7L6xNRhyK0Nr4 jZDMaIpm3cF7xtzYqzS3lODWNJHFBP4c4dJhaDk+M3Q1EgNIdiQOzhV8zpcyzZrJYqJgXwrHTzxhk hCqs3DXg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl9MP-0008Er-4x; Fri, 04 Dec 2020 11:34:49 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2] helo=sipsolutions.net) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl9MM-0008Dr-DE for linux-um@lists.infradead.org; Fri, 04 Dec 2020 11:34:47 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1kl9MI-002Mmq-K5; Fri, 04 Dec 2020 12:34:42 +0100 From: Johannes Berg To: linux-um@lists.infradead.org Subject: [PATCH] um: time-travel: avoid multiple identical propagations Date: Fri, 4 Dec 2020 12:34:34 +0100 Message-Id: <20201204123433.01282063e81f.I6cdf9966c9d253628195b50d800c8a688f829b46@changeid> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_063446_505052_1090692B X-CRM114-Status: GOOD ( 11.30 ) X-Spam-Score: 0.4 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Johannes Berg Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Johannes Berg If there is some kind of interrupt negotation or such then it may happen that we send an update message multiple times, avoid that in the interest of efficiency by storing the last transmitted value and only sending a new update if it's not the same as the last update. Signed-off-by: Johannes Berg --- arch/um/kernel/time.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index 5ac084deac7e..2c1c04f4ef27 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -198,7 +198,13 @@ static void time_travel_ext_update_request(unsigned long long time) void __time_travel_propagate_time(void) { + static unsigned long long last_propagated; + + if (last_propagated == time_travel_time) + return; + time_travel_ext_req(UM_TIMETRAVEL_UPDATE, time_travel_time); + last_propagated = time_travel_time; } EXPORT_SYMBOL_GPL(__time_travel_propagate_time);