From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 10 16:48:47 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5642937B401 for ; Thu, 10 Apr 2003 16:48:47 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 4959543FA3 for ; Thu, 10 Apr 2003 16:48:46 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 32590 invoked by uid 1000); 10 Apr 2003 23:48:47 -0000 Date: Thu, 10 Apr 2003 16:48:47 -0700 (PDT) From: Nate Lawson To: current@freebsd.org, hackers@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1708314112-1050018527=:32578" Subject: MPSAFE patch for fxp(4) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Apr 2003 23:48:47 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-1708314112-1050018527=:32578 Content-Type: TEXT/PLAIN; charset=US-ASCII I have completed a patch for fxp(4) to enable MPSAFE operation. Please test it if you have one of these devices. Particularly interesting cases are DEVICE_POLLING and SMP and non-i386 archs. I have tested it thoroughly on an i386 UP box both as a module and compiled into the kernel. The one necessary fix by gallatin@ to vm/uma_core.c is included as well. -Nate Make fxp(4) INTR_MPSAFE: - Add fxp_start_body() and change fxp_start() to just acquire locks and then call fxp_start_body(). Places that would call fxp_start() with locks held (mutex recursion) now call fxp_start_body() directly. Remove MTX_RECURSE flag from sc_mtx. [gallatin] - Change fxp_attach() to work without the softc lock, saving interrupt hooking until the head of fxp_attach(). - Call ether_ifattach() before overriding ifp parameters. This reverts part of 1.155. - Remove multiple error paths in fxp_attach(). - Teardown interrupt in fxp_detach() before unlocking the softc. - Add locking to fxp_suspend, fxp_resume, fxp_start, fxp_intr, fxp_poll, fxp_tick, fxp_ioctl, fxp_watchdog. - Pass in ifp to fxp_intr_body since its callers sometimes already use it. - Add compatibility define for INTR_MPSAFE for 4.x. [gallatin] Ideas from: gallatin, mux Tested by: >200M packets of dd/ssh, NFS, ping on i386 UP --0-1708314112-1050018527=:32578 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="fxp-mpsafe.diff" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="fxp-mpsafe.diff" SW5kZXg6IGlmX2Z4cC5jDQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQpSQ1Mg ZmlsZTogL2hvbWUvbmN2cy9zcmMvc3lzL2Rldi9meHAvaWZfZnhwLmMsdg0K cmV0cmlldmluZyByZXZpc2lvbiAxLjE2Ng0KZGlmZiAtdSAtcjEuMTY2IGlm X2Z4cC5jDQotLS0gaWZfZnhwLmMJOCBBcHIgMjAwMyAxODo1Njo0NSAtMDAw MAkxLjE2Ng0KKysrIGlmX2Z4cC5jCTEwIEFwciAyMDAzIDIzOjUxOjA2IC0w MDAwDQpAQCAtMTg4LDYgKzE4OCw3IEBADQogc3RhdGljIHZvaWQgCQlmeHBf aW5pdCh2b2lkICp4c2MpOw0KIHN0YXRpYyB2b2lkIAkJZnhwX3RpY2sodm9p ZCAqeHNjKTsNCiBzdGF0aWMgdm9pZAkJZnhwX3Bvd2Vyc3RhdGVfZDAoZGV2 aWNlX3QgZGV2KTsNCitzdGF0aWMgdm9pZCAJCWZ4cF9zdGFydF9ib2R5KHN0 cnVjdCBpZm5ldCAqaWZwKTsNCiBzdGF0aWMgdm9pZCAJCWZ4cF9zdGFydChz dHJ1Y3QgaWZuZXQgKmlmcCk7DQogc3RhdGljIHZvaWQJCWZ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