From owner-freebsd-net@FreeBSD.ORG Wed Jan 28 17:07:20 2015 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ACAE216B for ; Wed, 28 Jan 2015 17:07:20 +0000 (UTC) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [IPv6:2001:4f8:3:ffe0:406a:0:50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A6F6E39 for ; Wed, 28 Jan 2015 17:07:20 +0000 (UTC) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [127.0.1.5]) by phabric-backend.isc.freebsd.org (8.14.9/8.14.9) with ESMTP id t0SH7K7d081075 for ; Wed, 28 Jan 2015 17:07:20 GMT (envelope-from mat@phabric-backend.isc.freebsd.org) Received: (from root@localhost) by phabric-backend.isc.freebsd.org (8.14.9/8.14.9/Submit) id t0SH7Kcp081074; Wed, 28 Jan 2015 17:07:20 GMT (envelope-from mat) Date: Wed, 28 Jan 2015 17:07:20 +0000 To: freebsd-net@freebsd.org From: "rrs (Randall Stewart)" Subject: [Differential] [Request, 895 lines] D1711: Changes to the callout code to restore active semantics and also add a test-framework and test to validate thecallout code (and potentially for use by other tests). Message-ID: X-Priority: 3 Thread-Topic: D1711: Changes to the callout code to restore active semantics and also add a test-framework and test to validate the callout code (and potentially for use by other tests). X-Herald-Rules: none X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-Cc: Thread-Index: Y2JjMTcyODJkYzgxM2NkZDFjY2RhOGRmMTlk X-Phabricator-Sent-This-Message: Yes X-Mail-Transport-Agent: MetaMTA X-Auto-Response-Suppress: All X-Phabricator-Mail-Tags: , , , MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2015 17:07:20 -0000 rrs created this revision. rrs added reviewers: gnn, rwatson, imp, hselasky, adrian, sbruno, lstewart. rrs added a subscriber: freebsd-net. REVISION SUMMARY The callout code had two specific bugs within it after the new CPU migration feature was added. 1) The callout_active() call at times could lie to the KPI user, this is because during a migration the ACTIVE flag would have been removed so that the semantics were broken. This could cause problems for KPI users since the active flag is a key feature used by those declaring themselves MPSAFE and using there own lock (think TCP). 2) There was a bug in the callout code where if a migration was going on and two calls were made to callout_reset (the first starting the migration) the second call would possibly corrupt the linked list (if it was the active callout about to execute) and thus we would spin forever in soft clock and this would result in a panic, spin lock held to long. TEST PLAN I have added the kernel test framework and a callout_test module. This allows us to pound on the callout code with multiple threads resetting, draining and stopping callouts all at about the same time. This test without the fixes would lock up and panic with a spin lock held to long vs now it does not. I have also begun testing this on Netflix Caches to further validate that it does no harm and instead gets rid of a panic or two ;-) REVISION DETAIL https://reviews.freebsd.org/D1711 AFFECTED FILES sys/amd64/conf/GENERIC sys/conf/files sys/conf/options sys/kern/kern_testfrwk.c sys/kern/kern_timeout.c sys/modules/Makefile sys/modules/callout_test/Makefile sys/modules/callout_test/callout_test.c sys/sys/callout.h sys/sys/callout_test.h sys/sys/kern_testfrwk.h To: rrs, gnn, rwatson, imp, hselasky, adrian, sbruno, lstewart Cc: freebsd-net