From owner-p4-projects@FreeBSD.ORG Sun Jun 27 12:22:32 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D6B581065670; Sun, 27 Jun 2010 12:22:31 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B421106564A for ; Sun, 27 Jun 2010 12:22:31 +0000 (UTC) (envelope-from lz@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8946D8FC19 for ; Sun, 27 Jun 2010 12:22:31 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5RCMVeH010765 for ; Sun, 27 Jun 2010 12:22:31 GMT (envelope-from lz@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5RCMVWV010763 for perforce@freebsd.org; Sun, 27 Jun 2010 12:22:31 GMT (envelope-from lz@FreeBSD.org) Date: Sun, 27 Jun 2010 12:22:31 GMT Message-Id: <201006271222.o5RCMVWV010763@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to lz@FreeBSD.org using -f From: Zheng Liu To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180266 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2010 12:22:32 -0000 http://p4web.freebsd.org/@@180266?ac=10 Change 180266 by lz@gnehzuil-freebsd on 2010/06/27 12:22:29 Remove a header file from ext2_vfsops.c. Affected files ... .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#4 edit Differences ... ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#4 (text+ko) ==== @@ -61,8 +61,6 @@ #include #include #include -#include - static int ext2_flushfiles(struct mount *mp, int flags, struct thread *td); static int ext2_mountfs(struct vnode *, struct mount *); @@ -920,6 +918,7 @@ *vpp = NULL; return (error); } + /* convert ext2 inode to dinode */ ext2_ei2i((struct ext2fs_dinode *) ((char *)bp->b_data + EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ino)), ip); From owner-p4-projects@FreeBSD.ORG Sun Jun 27 15:27:55 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1538F106566C; Sun, 27 Jun 2010 15:27:55 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD070106564A for ; Sun, 27 Jun 2010 15:27:54 +0000 (UTC) (envelope-from rene@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B84BA8FC08 for ; Sun, 27 Jun 2010 15:27:54 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5RFRsHV038492 for ; Sun, 27 Jun 2010 15:27:54 GMT (envelope-from rene@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5RFRsIR038490 for perforce@freebsd.org; Sun, 27 Jun 2010 15:27:54 GMT (envelope-from rene@FreeBSD.org) Date: Sun, 27 Jun 2010 15:27:54 GMT Message-Id: <201006271527.o5RFRsIR038490@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rene@FreeBSD.org using -f From: Rene Ladan To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180270 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2010 15:27:55 -0000 http://p4web.freebsd.org/@@180270?ac=10 Change 180270 by rene@rene_acer on 2010/06/27 15:27:33 IFC Affected files ... .. //depot/projects/docproj_nl/en_US.ISO8859-1/articles/contributors/contrib.additional.sgml#61 integrate .. //depot/projects/docproj_nl/en_US.ISO8859-1/articles/explaining-bsd/article.sgml#4 integrate .. //depot/projects/docproj_nl/en_US.ISO8859-1/books/handbook/mirrors/chapter.sgml#30 integrate .. //depot/projects/docproj_nl/en_US.ISO8859-1/books/porters-handbook/book.sgml#81 integrate .. //depot/projects/docproj_nl/nl_NL.ISO8859-1/books/handbook/bibliography/chapter.sgml#10 integrate .. //depot/projects/docproj_nl/nl_NL.ISO8859-1/books/handbook/desktop/chapter.sgml#25 integrate .. //depot/projects/docproj_nl/nl_NL.ISO8859-1/books/handbook/virtualization/chapter.sgml#20 integrate .. //depot/projects/docproj_nl/share/sgml/freebsd.ent#16 integrate .. //depot/projects/docproj_nl/www/en/donations/wantlist.sgml#19 integrate .. //depot/projects/docproj_nl/www/en/search/web.atoz#3 integrate Differences ... ==== //depot/projects/docproj_nl/en_US.ISO8859-1/articles/contributors/contrib.additional.sgml#61 (text+ko) ==== @@ -1,4 +1,4 @@ - + + Initial BSD releases consisted mainly of user programs, but that changed dramatically when the CSRG landed a contract with the Defense - Advanced Projects Research Agency (DARPA) to upgrade the communications + Advanced Research Projects Agency (DARPA) to upgrade the communications protocols on their network, ARPANET. The new protocols were known as the Internet Protocols, later TCP/IP after the most important protocols. The ==== //depot/projects/docproj_nl/en_US.ISO8859-1/books/handbook/mirrors/chapter.sgml#30 (text+ko) ==== @@ -1,7 +1,7 @@ @@ -2436,6 +2436,14 @@ + RELENG_8_1 + + + The release branch for &os;-8.1, used only for + security advisories and other critical fixes. + + + RELENG_8_0 ==== //depot/projects/docproj_nl/en_US.ISO8859-1/books/porters-handbook/book.sgml#81 (text+ko) ==== @@ -1,7 +1,7 @@ + 801000 + June 14, 2010 + 8.1-RELEASE + + + 801500 + June 14, 2010 + 8.1-STABLE after 8.1-RELEASE. + + 900000 August 22, 2009 9.0-CURRENT. ==== //depot/projects/docproj_nl/nl_NL.ISO8859-1/books/handbook/bibliography/chapter.sgml#10 (text+ko) ==== @@ -1,7 +1,7 @@ - + @@ -146,7 +146,7 @@ Initiële BSD-uitgaven bestonden grotendeels uit gebruikersprogramma's, maar dat veranderde enorm toen CSRG in een - contract belandde met het Defense Advanced Projects Research + contract belandde met het Defense Advanced Research Projects Agency (DARPA) om de communicatieprotocollen in hun netwerk, ARPANET, te vernieuwen. De nieuwe protocollen stonden bekend als Internet Protocols, later ==== //depot/projects/docproj_nl/nl_NL.ISO8859-1/books/handbook/mirrors/chapter.sgml#50 (text+ko) ==== @@ -5,7 +5,7 @@ Vertaald door: Siebrand Mazeland / Rene Ladan %SOURCE% en_US.ISO8859-1/books/handbook/mirrors/chapter.sgml - %SRCID% 1.483 + %SRCID% 1.486 --> @@ -2548,6 +2548,16 @@ + RELENG_8_1 + + + De uitgavetak voor &os;-8.1, alleen gebruikt voor + beveiligingswaarschuwingen en andere kritische + aanpassingen. + + + + RELENG_8_0 From owner-p4-projects@FreeBSD.ORG Sun Jun 27 18:25:09 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5A7131065673; Sun, 27 Jun 2010 18:25:09 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06662106566B for ; Sun, 27 Jun 2010 18:25:09 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E2F6F8FC08 for ; Sun, 27 Jun 2010 18:25:08 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5RIP8vS065469 for ; Sun, 27 Jun 2010 18:25:08 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5RIP80k065467 for perforce@freebsd.org; Sun, 27 Jun 2010 18:25:08 GMT (envelope-from trasz@freebsd.org) Date: Sun, 27 Jun 2010 18:25:08 GMT Message-Id: <201006271825.o5RIP80k065467@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to trasz@freebsd.org using -f From: Edward Tomasz Napierala To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180274 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2010 18:25:09 -0000 http://p4web.freebsd.org/@@180274?ac=10 Change 180274 by trasz@trasz_victim on 2010/06/27 18:24:29 Divorce containers from hrl some more. Affected files ... .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#3 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_exit.c#18 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_fork.c#14 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#76 edit .. //depot/projects/soc2009/trasz_limits/sys/sys/container.h#3 edit .. //depot/projects/soc2009/trasz_limits/sys/sys/hrl.h#45 edit Differences ... ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#3 (text+ko) ==== @@ -62,12 +62,12 @@ mtx_assert(&hrl_lock, MA_OWNED); for (i = 0; i <= HRL_RESOURCE_MAX; i++) { - KASSERT(dest->hc_resources[i] >= 0, + KASSERT(dest->c_resources[i] >= 0, ("resource usage propagation meltdown: dest < 0")); - KASSERT(src->hc_resources[i] >= 0, + KASSERT(src->c_resources[i] >= 0, ("resource usage propagation meltdown: src < 0")); - dest->hc_resources[i] += src->hc_resources[i]; - KASSERT(dest->hc_resources[i] >= 0, + dest->c_resources[i] += src->c_resources[i]; + KASSERT(dest->c_resources[i] >= 0, ("resource usage propagation meltdown: dest < 0 after addition")); } } @@ -80,14 +80,14 @@ mtx_assert(&hrl_lock, MA_OWNED); for (i = 0; i <= HRL_RESOURCE_MAX; i++) { - KASSERT(dest->hc_resources[i] >= 0, + KASSERT(dest->c_resources[i] >= 0, ("resource usage propagation meltdown: dest < 0")); - KASSERT(src->hc_resources[i] >= 0, + KASSERT(src->c_resources[i] >= 0, ("resource usage propagation meltdown: src < 0")); - KASSERT(src->hc_resources[i] <= dest->hc_resources[i], + KASSERT(src->c_resources[i] <= dest->c_resources[i], ("resource usage propagation meltdown: src > dest")); - dest->hc_resources[i] -= src->hc_resources[i]; - KASSERT(dest->hc_resources[i] >= 0, + dest->c_resources[i] -= src->c_resources[i]; + KASSERT(dest->c_resources[i] >= 0, ("resource usage propagation meltdown: dest < 0 after subtraction")); } } @@ -101,11 +101,11 @@ KASSERT(child != NULL, ("child != NULL")); KASSERT(parent != NULL, ("parent != NULL")); - for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) { - KASSERT(child->hc_parents[i] != parent, + for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) { + KASSERT(child->c_parents[i] != parent, ("container already joined")); - if (child->hc_parents[i] == NULL) { - child->hc_parents[i] = parent; + if (child->c_parents[i] == NULL) { + child->c_parents[i] = parent; container_add(parent, child); return; } @@ -122,10 +122,10 @@ KASSERT(child != NULL, ("child != NULL")); KASSERT(parent != NULL, ("parent != NULL")); - for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) { - if (child->hc_parents[i] == parent) { + for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) { + if (child->c_parents[i] == parent) { container_subtract(parent, child); - child->hc_parents[i] = NULL; + child->c_parents[i] = NULL; return; } } @@ -140,11 +140,11 @@ mtx_assert(&hrl_lock, MA_OWNED); KASSERT(child != NULL, ("child != NULL")); - for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) { - if (child->hc_parents[i] == NULL) + for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) { + if (child->c_parents[i] == NULL) continue; - container_subtract(child->hc_parents[i], child); - child->hc_parents[i] = NULL; + container_subtract(child->c_parents[i], child); + child->c_parents[i] = NULL; } } @@ -154,11 +154,11 @@ int i; for (i = 0; i <= HRL_RESOURCE_MAX; i++) - KASSERT(container->hc_resources[i] == 0, - ("container->hc_resources[%d] != NULL", i)); - for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) - KASSERT(container->hc_parents[i] == NULL, - ("container->hc_parents[%d] != NULL", i)); + KASSERT(container->c_resources[i] == 0, + ("container->c_resources[%d] != NULL", i)); + for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) + KASSERT(container->c_parents[i] == NULL, + ("container->c_parents[%d] != NULL", i)); } void @@ -168,12 +168,12 @@ mtx_lock(&hrl_lock); for (i = 0; i <= HRL_RESOURCE_MAX; i++) { - if (container->hc_resources[i] != 0) + if (container->c_resources[i] != 0) printf("destroying non-empty container: " "%ju allocated for resource %s", - container->hc_resources[i], + container->c_resources[i], hrl_resource_name(i)); - container->hc_resources[i] = 0; + container->c_resources[i] = 0; } container_leave_parents(container); @@ -194,18 +194,18 @@ KASSERT(container != NULL, ("NULL container")); for (resource = 0; resource <= HRL_RESOURCE_MAX; resource++) { - KASSERT(container->hc_resources[resource] >= 0, + KASSERT(container->c_resources[resource] >= 0, ("resource usage propagation meltdown: resource < 0")); } - for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) { - parent = container->hc_parents[i]; + for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) { + parent = container->c_parents[i]; if (parent == NULL); continue; container_assert(parent); for (resource = 0; resource <= HRL_RESOURCE_MAX; resource++) { - KASSERT(parent->hc_resources[resource] >= - container->hc_resources[resource], + KASSERT(parent->c_resources[resource] >= + container->c_resources[resource], ("resource usage propagation meltdown: child > parent")); } } @@ -226,11 +226,11 @@ mtx_assert(&hrl_lock, MA_OWNED); KASSERT(container != NULL, ("NULL container")); - container->hc_resources[resource] += amount; - for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) { - if (container->hc_parents[i] == NULL) + container->c_resources[resource] += amount; + for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) { + if (container->c_parents[i] == NULL) continue; - container_alloc_resource(container->hc_parents[i], resource, amount); + container_alloc_resource(container->c_parents[i], resource, amount); } #ifdef DIAGNOSTIC container_assert(container); @@ -286,7 +286,7 @@ hrl_resource_name(resource), amount)); mtx_lock(&hrl_lock); - diff = amount - p->p_container.hc_resources[resource]; + diff = amount - p->p_container.c_resources[resource]; if (diff > 0) { error = hrl_enforce_proc(p, resource, diff); if (error) { @@ -315,11 +315,76 @@ hrl_resource_name(resource), amount)); mtx_lock(&hrl_lock); - KASSERT(amount <= p->p_container.hc_resources[resource], + KASSERT(amount <= p->p_container.c_resources[resource], ("hrl_free: freeing %ju of %s, which is more than allocated " "%ld for %s (pid %d)", amount, hrl_resource_name(resource), - p->p_container.hc_resources[resource], p->p_comm, p->p_pid)); + p->p_container.c_resources[resource], p->p_comm, p->p_pid)); container_alloc_resource(&p->p_container, resource, -amount); mtx_unlock(&hrl_lock); } + +static int +container_resource_inheritable(int resource) +{ + + switch (resource) { + case HRL_RESOURCE_MAXPROCESSES: + return (0); + default: + return (1); + } +} + +void +container_proc_exit(struct proc *p) +{ + /* + * XXX: Free these three some other way. + */ + hrl_allocated(p, HRL_RESOURCE_FILESIZE, 0); + hrl_allocated(p, HRL_RESOURCE_COREDUMPSIZE, 0); + hrl_allocated(p, HRL_RESOURCE_PTY, 0); + + mtx_lock(&hrl_lock); + container_destroy(&p->p_container); + mtx_unlock(&hrl_lock); +} + +/* + * Inherit resource usage information and copy limits from the parent + * process to the child. + */ +void +container_proc_fork(struct proc *parent, struct proc *child) +{ + int i; + struct container *container; + + PROC_LOCK(parent); + PROC_LOCK(child); + mtx_lock(&hrl_lock); + + /* + * Create container for the child process and inherit containing + * containers from the parent. + */ + container_create(&child->p_container); + for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) { + container = parent->p_container.c_parents[i]; + if (container == NULL) + continue; + container_join(&child->p_container, container); + } + + for (i = 0; i <= HRL_RESOURCE_MAX; i++) { + if (parent->p_container.c_resources[i] != 0 && + container_resource_inheritable(i)) + hrl_allocated(child, i, + parent->p_container.c_resources[i]); + } + + mtx_unlock(&hrl_lock); + PROC_UNLOCK(child); + PROC_UNLOCK(parent); +} ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_exit.c#18 (text+ko) ==== @@ -768,7 +768,11 @@ */ (void)chgproccnt(p->p_ucred->cr_ruidinfo, -1, 0); hrl_free(p->p_pptr, HRL_RESOURCE_MAXPROCESSES, 1); - hrl_proc_exiting(p); + + /* + * Destroy resource container associated with the process. + */ + container_proc_exit(p); /* * Free credentials, arguments, and sigacts. ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_fork.c#14 (text+ko) ==== @@ -739,6 +739,11 @@ } /* + * Initialize resource container for the child process. + */ + container_proc_fork(p1, p2); + + /* * Both processes are set up, now check if any loadable modules want * to adjust anything. * What if they have an error? XXX ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#76 (text+ko) ==== @@ -124,18 +124,6 @@ MALLOC_DEFINE(M_HRL, "hrl", "Hierarchical Resource Limits"); -static int -hrl_resource_inheritable(int resource) -{ - - switch (resource) { - case HRL_RESOURCE_MAXPROCESSES: - return (0); - default: - return (1); - } -} - static const char * hrl_subject_type_name(int subject) { @@ -210,20 +198,20 @@ switch (rule->hr_per) { case HRL_SUBJECT_TYPE_PROCESS: available = rule->hr_amount - - p->p_container.hc_resources[resource]; + p->p_container.c_resources[resource]; break; case HRL_SUBJECT_TYPE_USER: available = rule->hr_amount - - cred->cr_ruidinfo->ui_container.hc_resources[resource]; + cred->cr_ruidinfo->ui_container.c_resources[resource]; break; case HRL_SUBJECT_TYPE_LOGINCLASS: available = rule->hr_amount - - cred->cr_loginclass->lc_container.hc_resources[resource]; + cred->cr_loginclass->lc_container.c_resources[resource]; available = INT64_MAX; /* XXX */ break; case HRL_SUBJECT_TYPE_JAIL: available = rule->hr_amount - - cred->cr_prison->pr_container.hc_resources[resource]; + cred->cr_prison->pr_container.c_resources[resource]; break; default: panic("hrl_compute_available: unknown per %d", @@ -300,9 +288,9 @@ /* * XXX: We should sort the rules somewhat, so that 'log' and 'sig' * rules come before before 'deny', to spare iterations over - * the p_container.hc_rule_links. + * the p_container.c_rule_links. */ - LIST_FOREACH(link, &p->p_container.hc_rule_links, hrl_next) { + LIST_FOREACH(link, &p->p_container.c_rule_links, hrl_next) { rule = link->hrl_rule; if (rule->hr_resource != resource) continue; @@ -380,7 +368,7 @@ for (i = 0; i <= HRL_RESOURCE_MAX; i++) (*availablep)[i] = INT64_MAX; - LIST_FOREACH(link, &p->p_container.hc_rule_links, hrl_next) { + LIST_FOREACH(link, &p->p_container.c_rule_links, hrl_next) { rule = link->hrl_rule; resource = rule->hr_resource; available = hrl_available_resource(p, rule); @@ -522,7 +510,7 @@ link->hrl_rule = rule; mtx_lock(&hrl_lock); - LIST_INSERT_HEAD(&container->hc_rule_links, link, hrl_next); + LIST_INSERT_HEAD(&container->c_rule_links, link, hrl_next); mtx_unlock(&hrl_lock); } @@ -540,7 +528,7 @@ hrl_rule_acquire(rule); link->hrl_rule = rule; - LIST_INSERT_HEAD(&container->hc_rule_links, link, hrl_next); + LIST_INSERT_HEAD(&container->c_rule_links, link, hrl_next); return (0); } @@ -557,7 +545,7 @@ struct hrl_rule_link *link, *linktmp; mtx_lock(&hrl_lock); - LIST_FOREACH_SAFE(link, &container->hc_rule_links, hrl_next, linktmp) { + LIST_FOREACH_SAFE(link, &container->c_rule_links, hrl_next, linktmp) { if (!hrl_rule_matches(link->hrl_rule, filter)) continue; @@ -1129,7 +1117,7 @@ sb = sbuf_new_auto(); for (i = 0; i <= HRL_RESOURCE_MAX; i++) { sbuf_printf(sb, "%s=%jd,", hrl_resource_name(i), - container->hc_resources[i]); + container->c_resources[i]); } sbuf_setpos(sb, sbuf_len(sb) - 1); return (sb); @@ -1224,7 +1212,7 @@ mtx_assert(&hrl_lock, MA_OWNED); - LIST_FOREACH(link, &container->hc_rule_links, hrl_next) { + LIST_FOREACH(link, &container->c_rule_links, hrl_next) { if (!hrl_rule_matches(link->hrl_rule, filter)) continue; hrl_rule_to_sbuf(sb, link->hrl_rule); @@ -1265,7 +1253,7 @@ sx_assert(&allproc_lock, SA_LOCKED); FOREACH_PROC_IN_SYSTEM(p) { mtx_lock(&hrl_lock); - LIST_FOREACH(link, &p->p_container.hc_rule_links, hrl_next) { + LIST_FOREACH(link, &p->p_container.c_rule_links, hrl_next) { /* * Non-process rules will be added to the buffer later. * Adding them here would result in duplicated output. @@ -1350,7 +1338,7 @@ KASSERT(sb != NULL, ("sbuf_new failed")); mtx_lock(&hrl_lock); - LIST_FOREACH(link, &filter->hr_subject.hs_proc->p_container.hc_rule_links, hrl_next) { + LIST_FOREACH(link, &filter->hr_subject.hs_proc->p_container.c_rule_links, hrl_next) { hrl_rule_to_sbuf(sb, link->hrl_rule); sbuf_printf(sb, ","); } @@ -1492,7 +1480,7 @@ /* * Remove rules that are no longer applicable with the new ucred. */ - LIST_FOREACH(link, &p->p_container.hc_rule_links, hrl_next) { + LIST_FOREACH(link, &p->p_container.c_rule_links, hrl_next) { switch (link->hrl_rule->hr_subject_type) { case HRL_SUBJECT_TYPE_PROCESS: continue; @@ -1522,7 +1510,7 @@ * Add rules for the new ucred and move between containers where applicable. */ if (newuip != olduip) { - LIST_FOREACH(link, &newuip->ui_container.hc_rule_links, hrl_next) { + LIST_FOREACH(link, &newuip->ui_container.c_rule_links, hrl_next) { error = hrl_container_add_rule_locked(&p->p_container, link->hrl_rule); KASSERT(error == 0, ("XXX: better error handling needed")); } @@ -1531,7 +1519,7 @@ container_join(&p->p_container, &newuip->ui_container); } if (newlc != oldlc) { - LIST_FOREACH(link, &newlc->lc_container.hc_rule_links, hrl_next) { + LIST_FOREACH(link, &newlc->lc_container.c_rule_links, hrl_next) { error = hrl_container_add_rule_locked(&p->p_container, link->hrl_rule); KASSERT(error == 0, ("XXX: better error handling needed")); } @@ -1540,7 +1528,7 @@ container_join(&p->p_container, &newlc->lc_container); } if (newpr != oldpr) { - LIST_FOREACH(link, &newpr->pr_container.hc_rule_links, hrl_next) { + LIST_FOREACH(link, &newpr->pr_container.c_rule_links, hrl_next) { error = hrl_container_add_rule_locked(&p->p_container, link->hrl_rule); KASSERT(error == 0, ("XXX: better error handling needed")); } @@ -1553,47 +1541,26 @@ } /* - * Inherit resource usage information and copy limits from the parent - * process to the child. + * Assign HRL rules to the newly created process. */ static void hrl_proc_fork(void *arg __unused, struct proc *parent, struct proc *child, int flags __unused) { - int error, i; + int error; struct hrl_rule_link *link; struct hrl_rule *rule; - struct container *container; PROC_LOCK(parent); PROC_LOCK(child); mtx_lock(&hrl_lock); /* - * Create container for the child process and inherit containing - * containers from the parent. - */ - container_create(&child->p_container); - for (i = 0; i <= HRL_HC_PARENTS_MAX; i++) { - container = parent->p_container.hc_parents[i]; - if (container == NULL) - continue; - container_join(&child->p_container, container); - } - - for (i = 0; i <= HRL_RESOURCE_MAX; i++) { - if (parent->p_container.hc_resources[i] != 0 && - hrl_resource_inheritable(i)) - hrl_allocated(child, i, - parent->p_container.hc_resources[i]); - } - - /* * Go through limits applicable to the parent and assign them to the child. * Rules with 'process' subject have to be duplicated in order to make their * hr_subject point to the new process. */ - LIST_FOREACH(link, &parent->p_container.hc_rule_links, hrl_next) { + LIST_FOREACH(link, &parent->p_container.c_rule_links, hrl_next) { if (link->hrl_rule->hr_subject_type == HRL_SUBJECT_TYPE_PROCESS) { rule = hrl_rule_duplicate(link->hrl_rule, M_NOWAIT); KASSERT(rule != NULL, ("XXX: better error handling needed")); @@ -1614,21 +1581,6 @@ PROC_UNLOCK(parent); } -void -hrl_proc_exiting(struct proc *p) -{ - /* - * XXX: Free these three some other way. - */ - hrl_allocated(p, HRL_RESOURCE_FILESIZE, 0); - hrl_allocated(p, HRL_RESOURCE_COREDUMPSIZE, 0); - hrl_allocated(p, HRL_RESOURCE_PTY, 0); - - mtx_lock(&hrl_lock); - container_destroy(&p->p_container); - mtx_unlock(&hrl_lock); -} - /* * Go through the process' limits, freeing them. */ @@ -1638,8 +1590,8 @@ struct hrl_rule_link *link; mtx_lock(&hrl_lock); - while (!LIST_EMPTY(&p->p_container.hc_rule_links)) { - link = LIST_FIRST(&p->p_container.hc_rule_links); + while (!LIST_EMPTY(&p->p_container.c_rule_links)) { + link = LIST_FIRST(&p->p_container.c_rule_links); LIST_REMOVE(link, hrl_next); hrl_rule_release(link->hrl_rule); uma_zfree(hrl_rule_link_zone, link); ==== //depot/projects/soc2009/trasz_limits/sys/sys/container.h#3 (text+ko) ==== @@ -46,7 +46,7 @@ * one parent container, loginclass and uidinfo structures have none. * This may change when - and if - we add per-group resource limits. */ -#define HRL_HC_PARENTS_MAX 3 +#define CONTAINER_PARENTS_MAX 3 #define HRL_RESOURCE_UNDEFINED -1 #define HRL_RESOURCE_CPUTIME 0x0000 @@ -64,7 +64,6 @@ #define HRL_RESOURCE_SWAP 0x000c #define HRL_RESOURCE_MAX HRL_RESOURCE_SWAP - /* * 'container' defines resource consumption for a particular * subject, such as process or jail. Containers form a graph - each @@ -85,13 +84,11 @@ * This structure must be filled with zeroes initially. */ struct container { - int64_t hc_resources[HRL_RESOURCE_MAX + 1]; - struct container *hc_parents[HRL_HC_PARENTS_MAX + 1]; - LIST_HEAD(, hrl_rule_link) hc_rule_links; + int64_t c_resources[HRL_RESOURCE_MAX + 1]; + struct container *c_parents[CONTAINER_PARENTS_MAX + 1]; + LIST_HEAD(, hrl_rule_link) c_rule_links; }; -#ifdef _KERNEL - int hrl_alloc(struct proc *p, int object, uint64_t amount); int hrl_allocated(struct proc *p, int object, uint64_t amount); void hrl_free(struct proc *p, int object, uint64_t amount); @@ -102,6 +99,7 @@ void container_join(struct container *child, struct container *parent); void container_leave(struct container *child, struct container *parent); -#endif /* _KERNEL */ +void container_proc_exit(struct proc *p); +void container_proc_fork(struct proc *parent, struct proc *child); #endif /* !_CONTAINER_H_ */ ==== //depot/projects/soc2009/trasz_limits/sys/sys/hrl.h#45 (text+ko) ==== @@ -110,8 +110,6 @@ #ifdef _KERNEL -void hrl_proc_exiting(struct proc *p); - void hrl_proc_init(struct proc *p); void hrl_proc_ucred_changing(struct proc *p, struct ucred *newcred); From owner-p4-projects@FreeBSD.ORG Sun Jun 27 20:27:24 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 273FC1065673; Sun, 27 Jun 2010 20:27:24 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDF6F1065670 for ; Sun, 27 Jun 2010 20:27:23 +0000 (UTC) (envelope-from iprebeg@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id CAC8F8FC1A for ; Sun, 27 Jun 2010 20:27:23 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5RKRNGB076487 for ; Sun, 27 Jun 2010 20:27:23 GMT (envelope-from iprebeg@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5RKRMKC076485 for perforce@freebsd.org; Sun, 27 Jun 2010 20:27:22 GMT (envelope-from iprebeg@freebsd.org) Date: Sun, 27 Jun 2010 20:27:22 GMT Message-Id: <201006272027.o5RKRMKC076485@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to iprebeg@freebsd.org using -f From: Ivor Prebeg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180275 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2010 20:27:24 -0000 http://p4web.freebsd.org/@@180275?ac=10 Change 180275 by iprebeg@iprebeg_nxlab_login on 2010/06/27 20:27:07 IFC @ 180273 Affected files ... .. //depot/projects/vimage/src/share/man/man1/builtin.1#4 integrate .. //depot/projects/vimage/src/share/man/man4/Makefile#22 integrate .. //depot/projects/vimage/src/share/man/man4/ae.4#4 integrate .. //depot/projects/vimage/src/share/man/man4/aibs.4#1 branch .. //depot/projects/vimage/src/share/man/man4/bpf.4#2 integrate .. //depot/projects/vimage/src/share/man/man4/io.4#4 integrate .. //depot/projects/vimage/src/share/man/man4/ng_patch.4#1 branch .. //depot/projects/vimage/src/share/man/man4/textdump.4#6 integrate .. //depot/projects/vimage/src/share/man/man5/a.out.5#2 integrate .. //depot/projects/vimage/src/share/man/man5/periodic.conf.5#2 integrate .. //depot/projects/vimage/src/share/man/man5/src.conf.5#8 integrate .. //depot/projects/vimage/src/share/man/man5/stab.5#2 integrate .. //depot/projects/vimage/src/share/man/man7/Makefile#3 integrate .. //depot/projects/vimage/src/share/man/man7/c99.7#1 branch .. //depot/projects/vimage/src/share/man/man9/bus_generic_new_pass.9#2 integrate .. //depot/projects/vimage/src/share/man/man9/bus_set_pass.9#2 integrate .. //depot/projects/vimage/src/share/man/man9/insmntque.9#3 integrate .. //depot/projects/vimage/src/share/man/man9/style.9#3 integrate .. //depot/projects/vimage/src/share/man/man9/vfs_busy.9#2 integrate .. //depot/projects/vimage/src/share/man/man9/vfs_mountedfrom.9#2 integrate .. //depot/projects/vimage/src/share/man/man9/vfs_unbusy.9#2 integrate .. //depot/projects/vimage/src/sys/amd64/acpica/acpi_wakeup.c#6 integrate .. //depot/projects/vimage/src/sys/amd64/acpica/madt.c#9 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/apic_vector.S#8 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/cpu_switch.S#16 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/exception.S#17 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/fpu.c#6 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/intr_machdep.c#12 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/io_apic.c#8 delete .. //depot/projects/vimage/src/sys/amd64/amd64/legacy.c#5 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/machdep.c#28 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/mca.c#5 delete .. //depot/projects/vimage/src/sys/amd64/amd64/mp_machdep.c#28 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/msi.c#14 delete .. //depot/projects/vimage/src/sys/amd64/amd64/pmap.c#41 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/trap.c#23 integrate .. //depot/projects/vimage/src/sys/amd64/amd64/vm_machdep.c#14 integrate .. //depot/projects/vimage/src/sys/amd64/conf/NOTES#24 integrate .. //depot/projects/vimage/src/sys/amd64/ia32/ia32_exception.S#5 integrate .. //depot/projects/vimage/src/sys/amd64/ia32/ia32_reg.c#5 integrate .. //depot/projects/vimage/src/sys/amd64/ia32/ia32_signal.c#12 integrate .. //depot/projects/vimage/src/sys/amd64/include/apicvar.h#13 integrate .. //depot/projects/vimage/src/sys/amd64/include/asmacros.h#4 integrate .. //depot/projects/vimage/src/sys/amd64/include/fpu.h#4 integrate .. //depot/projects/vimage/src/sys/amd64/include/mca.h#5 integrate .. //depot/projects/vimage/src/sys/amd64/include/pcb.h#10 integrate .. //depot/projects/vimage/src/sys/amd64/include/smp.h#11 integrate .. //depot/projects/vimage/src/sys/amd64/linux32/linux32_machdep.c#19 integrate .. //depot/projects/vimage/src/sys/arm/arm/nexus.c#5 integrate .. //depot/projects/vimage/src/sys/arm/arm/pmap.c#29 integrate .. //depot/projects/vimage/src/sys/arm/conf/DB-78XXX#9 integrate .. //depot/projects/vimage/src/sys/arm/conf/DB-88F5XXX#9 integrate .. //depot/projects/vimage/src/sys/arm/conf/DB-88F6XXX#9 integrate .. //depot/projects/vimage/src/sys/arm/conf/SHEEVAPLUG#3 integrate .. //depot/projects/vimage/src/sys/arm/include/bootinfo.h#2 integrate .. //depot/projects/vimage/src/sys/arm/include/fdt.h#1 branch .. //depot/projects/vimage/src/sys/arm/include/metadata.h#4 integrate .. //depot/projects/vimage/src/sys/arm/include/ofw_machdep.h#1 branch .. //depot/projects/vimage/src/sys/arm/mv/bus_space.c#2 integrate .. //depot/projects/vimage/src/sys/arm/mv/common.c#8 integrate .. //depot/projects/vimage/src/sys/arm/mv/discovery/db78xxx.c#6 delete .. //depot/projects/vimage/src/sys/arm/mv/discovery/discovery.c#6 integrate .. //depot/projects/vimage/src/sys/arm/mv/discovery/files.db78xxx#2 integrate .. //depot/projects/vimage/src/sys/arm/mv/files.mv#8 integrate .. //depot/projects/vimage/src/sys/arm/mv/gpio.c#4 integrate .. //depot/projects/vimage/src/sys/arm/mv/ic.c#4 integrate .. //depot/projects/vimage/src/sys/arm/mv/kirkwood/db88f6xxx.c#6 delete .. //depot/projects/vimage/src/sys/arm/mv/kirkwood/files.db88f6xxx#3 delete .. //depot/projects/vimage/src/sys/arm/mv/kirkwood/kirkwood.c#7 integrate .. //depot/projects/vimage/src/sys/arm/mv/kirkwood/sheevaplug.c#2 integrate .. //depot/projects/vimage/src/sys/arm/mv/kirkwood/std.db88f6xxx#3 integrate .. //depot/projects/vimage/src/sys/arm/mv/kirkwood/std.sheevaplug#2 integrate .. //depot/projects/vimage/src/sys/arm/mv/mv_machdep.c#9 integrate .. //depot/projects/vimage/src/sys/arm/mv/mv_pci.c#5 integrate .. //depot/projects/vimage/src/sys/arm/mv/mv_sata.c#4 integrate .. //depot/projects/vimage/src/sys/arm/mv/mvreg.h#8 integrate .. //depot/projects/vimage/src/sys/arm/mv/mvvar.h#5 integrate .. //depot/projects/vimage/src/sys/arm/mv/mvwin.h#3 integrate .. //depot/projects/vimage/src/sys/arm/mv/obio.c#4 delete .. //depot/projects/vimage/src/sys/arm/mv/orion/db88f5xxx.c#6 integrate .. //depot/projects/vimage/src/sys/arm/mv/orion/orion.c#6 integrate .. //depot/projects/vimage/src/sys/arm/mv/rtc.c#2 integrate .. //depot/projects/vimage/src/sys/arm/mv/timer.c#2 integrate .. //depot/projects/vimage/src/sys/arm/mv/twsi.c#3 integrate .. //depot/projects/vimage/src/sys/boot/arm/uboot/Makefile#5 integrate .. //depot/projects/vimage/src/sys/boot/ficl/ficl.h#3 integrate .. //depot/projects/vimage/src/sys/boot/forth/loader.conf#27 integrate .. //depot/projects/vimage/src/sys/boot/i386/boot0/Makefile#5 integrate .. //depot/projects/vimage/src/sys/boot/i386/btx/btx/Makefile#3 integrate .. //depot/projects/vimage/src/sys/boot/i386/btx/btxldr/Makefile#2 integrate .. //depot/projects/vimage/src/sys/boot/i386/cdboot/Makefile#2 integrate .. //depot/projects/vimage/src/sys/boot/i386/mbr/Makefile#2 integrate .. //depot/projects/vimage/src/sys/boot/i386/pmbr/Makefile#2 integrate .. //depot/projects/vimage/src/sys/boot/i386/pxeldr/Makefile#2 integrate .. //depot/projects/vimage/src/sys/boot/pc98/boot0.5/Makefile#3 integrate .. //depot/projects/vimage/src/sys/boot/pc98/boot0/Makefile#2 integrate .. //depot/projects/vimage/src/sys/boot/pc98/btx/btx/Makefile#3 integrate .. //depot/projects/vimage/src/sys/boot/pc98/btx/btxldr/Makefile#2 integrate .. //depot/projects/vimage/src/sys/boot/pc98/cdboot/Makefile#2 integrate .. //depot/projects/vimage/src/sys/boot/powerpc/uboot/Makefile#5 integrate .. //depot/projects/vimage/src/sys/boot/sparc64/boot1/Makefile#2 integrate .. //depot/projects/vimage/src/sys/boot/uboot/common/metadata.c#4 integrate .. //depot/projects/vimage/src/sys/cam/ata/ata_pmp.c#3 integrate .. //depot/projects/vimage/src/sys/cam/ata/ata_xpt.c#7 integrate .. //depot/projects/vimage/src/sys/cam/cam_debug.h#2 integrate .. //depot/projects/vimage/src/sys/cam/cam_periph.c#13 integrate .. //depot/projects/vimage/src/sys/cam/cam_xpt.c#27 integrate .. //depot/projects/vimage/src/sys/cam/cam_xpt_internal.h#4 integrate .. //depot/projects/vimage/src/sys/cam/scsi/scsi_all.c#8 integrate .. //depot/projects/vimage/src/sys/cam/scsi/scsi_all.h#7 integrate .. //depot/projects/vimage/src/sys/cam/scsi/scsi_cd.c#12 integrate .. //depot/projects/vimage/src/sys/cam/scsi/scsi_ch.h#2 integrate .. //depot/projects/vimage/src/sys/cam/scsi/scsi_da.c#22 integrate .. //depot/projects/vimage/src/sys/cam/scsi/scsi_xpt.c#4 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c#7 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c#12 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c#8 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c#3 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c#6 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c#3 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c#3 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c#3 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c#7 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c#12 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#22 integrate .. //depot/projects/vimage/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c#7 integrate .. //depot/projects/vimage/src/sys/cddl/dev/cyclic/cyclic.c#3 integrate .. //depot/projects/vimage/src/sys/cddl/dev/dtrace/amd64/dtrace_subr.c#4 integrate .. //depot/projects/vimage/src/sys/cddl/dev/dtrace/dtrace_debug.c#2 integrate .. //depot/projects/vimage/src/sys/cddl/dev/dtrace/dtrace_load.c#3 integrate .. //depot/projects/vimage/src/sys/cddl/dev/dtrace/i386/dtrace_subr.c#4 integrate .. //depot/projects/vimage/src/sys/compat/linprocfs/linprocfs.c#44 integrate .. //depot/projects/vimage/src/sys/compat/ndis/subr_usbd.c#13 integrate .. //depot/projects/vimage/src/sys/compat/x86bios/x86bios.c#4 integrate .. //depot/projects/vimage/src/sys/compat/x86bios/x86bios.h#2 integrate .. //depot/projects/vimage/src/sys/conf/Makefile.arm#11 integrate .. //depot/projects/vimage/src/sys/conf/NOTES#68 integrate .. //depot/projects/vimage/src/sys/conf/files#85 integrate .. //depot/projects/vimage/src/sys/conf/files.amd64#30 integrate .. //depot/projects/vimage/src/sys/conf/files.arm#10 integrate .. //depot/projects/vimage/src/sys/conf/files.i386#38 integrate .. //depot/projects/vimage/src/sys/conf/files.mips#9 integrate .. //depot/projects/vimage/src/sys/conf/files.pc98#25 integrate .. //depot/projects/vimage/src/sys/conf/files.powerpc#28 integrate .. //depot/projects/vimage/src/sys/conf/ldscript.mips.n32#1 branch .. //depot/projects/vimage/src/sys/conf/options#64 integrate .. //depot/projects/vimage/src/sys/conf/options.amd64#11 integrate .. //depot/projects/vimage/src/sys/conf/options.arm#14 integrate .. //depot/projects/vimage/src/sys/contrib/libfdt/libfdt_env.h#2 integrate .. //depot/projects/vimage/src/sys/crypto/via/padlock.c#9 integrate .. //depot/projects/vimage/src/sys/crypto/via/padlock.h#2 integrate .. //depot/projects/vimage/src/sys/crypto/via/padlock_cipher.c#2 integrate .. //depot/projects/vimage/src/sys/crypto/via/padlock_hash.c#4 integrate .. //depot/projects/vimage/src/sys/dev/acpi_support/acpi_asus.c#14 integrate .. //depot/projects/vimage/src/sys/dev/acpi_support/acpi_fujitsu.c#5 integrate .. //depot/projects/vimage/src/sys/dev/acpi_support/acpi_hp.c#3 integrate .. //depot/projects/vimage/src/sys/dev/acpi_support/acpi_ibm.c#10 integrate .. //depot/projects/vimage/src/sys/dev/acpi_support/atk0110.c#1 branch .. //depot/projects/vimage/src/sys/dev/acpica/acpi.c#29 integrate .. //depot/projects/vimage/src/sys/dev/acpica/acpi_cpu.c#17 integrate .. //depot/projects/vimage/src/sys/dev/acpica/acpi_dock.c#8 integrate .. //depot/projects/vimage/src/sys/dev/acpica/acpi_hpet.c#13 integrate .. //depot/projects/vimage/src/sys/dev/acpica/acpi_hpet.h#2 integrate .. //depot/projects/vimage/src/sys/dev/acpica/acpi_thermal.c#10 integrate .. //depot/projects/vimage/src/sys/dev/acpica/acpi_video.c#5 integrate .. //depot/projects/vimage/src/sys/dev/agp/agp_nvidia.c#4 integrate .. //depot/projects/vimage/src/sys/dev/ahci/ahci.c#9 integrate .. //depot/projects/vimage/src/sys/dev/ata/ata-all.h#19 integrate .. //depot/projects/vimage/src/sys/dev/ata/ata-lowlevel.c#7 integrate .. //depot/projects/vimage/src/sys/dev/ata/atapi-cam.c#13 integrate .. //depot/projects/vimage/src/sys/dev/ata/chipsets/ata-acerlabs.c#9 integrate .. //depot/projects/vimage/src/sys/dev/ata/chipsets/ata-intel.c#8 integrate .. //depot/projects/vimage/src/sys/dev/ata/chipsets/ata-serverworks.c#8 integrate .. //depot/projects/vimage/src/sys/dev/ath/ath_hal/ar5416/ar5416reg.h#5 integrate .. //depot/projects/vimage/src/sys/dev/ath/if_ath.c#48 integrate .. //depot/projects/vimage/src/sys/dev/bge/if_bge.c#28 integrate .. //depot/projects/vimage/src/sys/dev/bge/if_bgereg.h#15 integrate .. //depot/projects/vimage/src/sys/dev/cas/if_cas.c#4 integrate .. //depot/projects/vimage/src/sys/dev/cxgb/cxgb_adapter.h#23 integrate .. //depot/projects/vimage/src/sys/dev/cxgb/cxgb_main.c#35 integrate .. //depot/projects/vimage/src/sys/dev/cxgb/cxgb_sge.c#32 integrate .. //depot/projects/vimage/src/sys/dev/cxgb/ulp/tom/cxgb_vm.c#5 integrate .. //depot/projects/vimage/src/sys/dev/e1000/if_em.c#23 integrate .. //depot/projects/vimage/src/sys/dev/e1000/if_igb.c#19 integrate .. //depot/projects/vimage/src/sys/dev/e1000/if_igb.h#7 integrate .. //depot/projects/vimage/src/sys/dev/e1000/if_lem.c#4 integrate .. //depot/projects/vimage/src/sys/dev/fb/fbreg.h#5 integrate .. //depot/projects/vimage/src/sys/dev/fb/vesa.c#5 integrate .. //depot/projects/vimage/src/sys/dev/fdt/fdt_arm.c#1 branch .. //depot/projects/vimage/src/sys/dev/fdt/fdt_common.c#1 branch .. //depot/projects/vimage/src/sys/dev/fdt/fdt_common.h#1 branch .. //depot/projects/vimage/src/sys/dev/fdt/fdt_pci.c#1 branch .. //depot/projects/vimage/src/sys/dev/fdt/fdt_static_dtb.S#1 branch .. //depot/projects/vimage/src/sys/dev/fdt/fdtbus.c#1 branch .. //depot/projects/vimage/src/sys/dev/fdt/simplebus.c#1 branch .. //depot/projects/vimage/src/sys/dev/hptiop/hptiop.c#7 integrate .. //depot/projects/vimage/src/sys/dev/hptmv/entry.c#9 integrate .. //depot/projects/vimage/src/sys/dev/hwpmc/hwpmc_mod.c#18 integrate .. //depot/projects/vimage/src/sys/dev/iicbus/iic.h#3 integrate .. //depot/projects/vimage/src/sys/dev/iicbus/iiconf.c#6 integrate .. //depot/projects/vimage/src/sys/dev/isp/isp.c#15 integrate .. //depot/projects/vimage/src/sys/dev/isp/isp_freebsd.c#20 integrate .. //depot/projects/vimage/src/sys/dev/isp/isp_library.c#7 integrate .. //depot/projects/vimage/src/sys/dev/isp/isp_pci.c#14 integrate .. //depot/projects/vimage/src/sys/dev/iwn/if_iwn.c#17 integrate .. //depot/projects/vimage/src/sys/dev/ixgbe/ixgbe.c#17 integrate .. //depot/projects/vimage/src/sys/dev/ixgbe/ixgbe.h#12 integrate .. //depot/projects/vimage/src/sys/dev/md/md.c#16 integrate .. //depot/projects/vimage/src/sys/dev/mge/if_mge.c#9 integrate .. //depot/projects/vimage/src/sys/dev/mge/if_mgevar.h#3 integrate .. //depot/projects/vimage/src/sys/dev/mvs/mvs.c#4 integrate .. //depot/projects/vimage/src/sys/dev/ofw/ofw_bus_subr.c#5 integrate .. //depot/projects/vimage/src/sys/dev/ofw/ofw_bus_subr.h#5 integrate .. //depot/projects/vimage/src/sys/dev/pci/pci.c#30 integrate .. //depot/projects/vimage/src/sys/dev/pci/pcivar.h#11 integrate .. //depot/projects/vimage/src/sys/dev/random/nehemiah.c#3 integrate .. //depot/projects/vimage/src/sys/dev/sge/if_sge.c#5 integrate .. //depot/projects/vimage/src/sys/dev/siis/siis.c#8 integrate .. //depot/projects/vimage/src/sys/dev/sound/pci/hda/hdac.c#42 integrate .. //depot/projects/vimage/src/sys/dev/sound/pcm/feeder_eq.c#2 integrate .. //depot/projects/vimage/src/sys/dev/sound/pcm/feeder_rate.c#8 integrate .. //depot/projects/vimage/src/sys/dev/sound/pcm/sound.c#7 integrate .. //depot/projects/vimage/src/sys/dev/sound/usb/uaudio.c#22 integrate .. //depot/projects/vimage/src/sys/dev/sound/usb/uaudioreg.h#10 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_cl.h#3 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_cl_fwif.h#3 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_cl_init.c#5 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_cl_intr.c#4 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_cl_io.c#5 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_cl_misc.c#4 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_cl_share.h#5 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_osl.h#6 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_osl_cam.c#7 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_osl_externs.h#3 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_osl_freebsd.c#11 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_osl_inline.h#3 integrate .. //depot/projects/vimage/src/sys/dev/twa/tw_osl_share.h#5 integrate .. //depot/projects/vimage/src/sys/dev/uart/uart_bus_fdt.c#1 branch .. //depot/projects/vimage/src/sys/dev/uart/uart_bus_mbus.c#2 delete .. //depot/projects/vimage/src/sys/dev/uart/uart_cpu_mv.c#4 delete .. //depot/projects/vimage/src/sys/dev/usb/controller/ehci.c#18 integrate .. //depot/projects/vimage/src/sys/dev/usb/controller/ehci_mbus.c#7 delete .. //depot/projects/vimage/src/sys/dev/usb/controller/ehci_mv.c#1 branch .. //depot/projects/vimage/src/sys/dev/usb/controller/ohci.c#15 integrate .. //depot/projects/vimage/src/sys/dev/usb/controller/uhci.c#16 integrate .. //depot/projects/vimage/src/sys/dev/usb/net/if_rue.c#12 integrate .. //depot/projects/vimage/src/sys/dev/usb/quirk/usb_quirk.c#9 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_dev.c#19 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_device.c#22 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_process.c#11 integrate .. //depot/projects/vimage/src/sys/dev/usb/usb_transfer.c#19 integrate .. //depot/projects/vimage/src/sys/dev/usb/usbdevs#60 integrate .. //depot/projects/vimage/src/sys/dev/usb/wlan/if_rum.c#16 integrate .. //depot/projects/vimage/src/sys/dev/usb/wlan/if_run.c#6 integrate .. //depot/projects/vimage/src/sys/dev/usb/wlan/if_runvar.h#4 integrate .. //depot/projects/vimage/src/sys/dev/usb/wlan/if_upgt.c#11 integrate .. //depot/projects/vimage/src/sys/dev/usb/wlan/if_ural.c#16 integrate .. //depot/projects/vimage/src/sys/dev/xen/netfront/netfront.c#17 integrate .. //depot/projects/vimage/src/sys/fs/devfs/devfs.h#3 integrate .. //depot/projects/vimage/src/sys/fs/devfs/devfs_devs.c#12 integrate .. //depot/projects/vimage/src/sys/fs/devfs/devfs_vnops.c#33 integrate .. //depot/projects/vimage/src/sys/fs/nfsclient/nfs_clbio.c#11 integrate .. //depot/projects/vimage/src/sys/fs/nfsclient/nfs_clcomsubs.c#2 integrate .. //depot/projects/vimage/src/sys/fs/nfsclient/nfs_clport.c#7 integrate .. //depot/projects/vimage/src/sys/fs/nfsclient/nfs_clrpcops.c#8 integrate .. //depot/projects/vimage/src/sys/fs/nfsclient/nfs_clsubs.c#5 integrate .. //depot/projects/vimage/src/sys/fs/nfsclient/nfs_clvnops.c#13 integrate .. //depot/projects/vimage/src/sys/fs/nfsserver/nfs_nfsdport.c#9 integrate .. //depot/projects/vimage/src/sys/fs/nfsserver/nfs_nfsdsocket.c#5 integrate .. //depot/projects/vimage/src/sys/fs/nwfs/nwfs_io.c#8 integrate .. //depot/projects/vimage/src/sys/fs/procfs/procfs_type.c#2 integrate .. //depot/projects/vimage/src/sys/fs/smbfs/smbfs_io.c#12 integrate .. //depot/projects/vimage/src/sys/fs/tmpfs/tmpfs_vnops.c#24 integrate .. //depot/projects/vimage/src/sys/fs/udf/udf_vnops.c#16 integrate .. //depot/projects/vimage/src/sys/geom/gate/g_gate.c#4 integrate .. //depot/projects/vimage/src/sys/geom/geom_dev.c#13 integrate .. //depot/projects/vimage/src/sys/geom/geom_event.c#3 integrate .. //depot/projects/vimage/src/sys/geom/geom_io.c#13 integrate .. //depot/projects/vimage/src/sys/geom/mountver/g_mountver.c#2 integrate .. //depot/projects/vimage/src/sys/geom/part/g_part.c#24 integrate .. //depot/projects/vimage/src/sys/geom/part/g_part.h#11 integrate .. //depot/projects/vimage/src/sys/geom/part/g_part_bsd.c#14 integrate .. //depot/projects/vimage/src/sys/geom/part/g_part_gpt.c#15 integrate .. //depot/projects/vimage/src/sys/geom/part/g_part_mbr.c#9 integrate .. //depot/projects/vimage/src/sys/i386/acpica/acpi_wakeup.c#6 integrate .. //depot/projects/vimage/src/sys/i386/acpica/madt.c#10 integrate .. //depot/projects/vimage/src/sys/i386/conf/NOTES#37 integrate .. //depot/projects/vimage/src/sys/i386/i386/apic_vector.s#6 integrate .. //depot/projects/vimage/src/sys/i386/i386/atpic_vector.s#2 integrate .. //depot/projects/vimage/src/sys/i386/i386/exception.s#7 integrate .. //depot/projects/vimage/src/sys/i386/i386/identcpu.c#23 integrate .. //depot/projects/vimage/src/sys/i386/i386/intr_machdep.c#13 integrate .. //depot/projects/vimage/src/sys/i386/i386/io_apic.c#8 delete .. //depot/projects/vimage/src/sys/i386/i386/legacy.c#5 integrate .. //depot/projects/vimage/src/sys/i386/i386/machdep.c#31 integrate .. //depot/projects/vimage/src/sys/i386/i386/mca.c#5 delete .. //depot/projects/vimage/src/sys/i386/i386/mp_machdep.c#27 integrate .. //depot/projects/vimage/src/sys/i386/i386/msi.c#14 delete .. //depot/projects/vimage/src/sys/i386/i386/pmap.c#39 integrate .. //depot/projects/vimage/src/sys/i386/i386/ptrace_machdep.c#2 integrate .. //depot/projects/vimage/src/sys/i386/i386/support.s#7 integrate .. //depot/projects/vimage/src/sys/i386/i386/swtch.s#8 integrate .. //depot/projects/vimage/src/sys/i386/i386/trap.c#22 integrate .. //depot/projects/vimage/src/sys/i386/i386/tsc.c#5 integrate .. //depot/projects/vimage/src/sys/i386/i386/vm_machdep.c#17 integrate .. //depot/projects/vimage/src/sys/i386/include/apicvar.h#16 integrate .. //depot/projects/vimage/src/sys/i386/include/mca.h#5 integrate .. //depot/projects/vimage/src/sys/i386/include/md_var.h#6 integrate .. //depot/projects/vimage/src/sys/i386/include/npx.h#3 integrate .. //depot/projects/vimage/src/sys/i386/include/pcb.h#3 integrate .. //depot/projects/vimage/src/sys/i386/isa/npx.c#10 integrate .. //depot/projects/vimage/src/sys/i386/linux/linux_machdep.c#15 integrate .. //depot/projects/vimage/src/sys/i386/linux/linux_ptrace.c#3 integrate .. //depot/projects/vimage/src/sys/i386/xen/pmap.c#18 integrate .. //depot/projects/vimage/src/sys/ia64/ia64/busdma_machdep.c#9 integrate .. //depot/projects/vimage/src/sys/ia64/ia64/exception.S#9 integrate .. //depot/projects/vimage/src/sys/ia64/ia64/pmap.c#21 integrate .. //depot/projects/vimage/src/sys/ia64/ia64/vm_machdep.c#7 integrate .. //depot/projects/vimage/src/sys/ia64/include/md_var.h#8 integrate .. //depot/projects/vimage/src/sys/isa/rtc.h#4 integrate .. //depot/projects/vimage/src/sys/kern/bus_if.m#7 integrate .. //depot/projects/vimage/src/sys/kern/kern_acct.c#13 integrate .. //depot/projects/vimage/src/sys/kern/kern_clock.c#26 integrate .. //depot/projects/vimage/src/sys/kern/kern_conf.c#25 integrate .. //depot/projects/vimage/src/sys/kern/kern_et.c#1 branch .. //depot/projects/vimage/src/sys/kern/kern_intr.c#19 integrate .. //depot/projects/vimage/src/sys/kern/kern_jail.c#40 integrate .. //depot/projects/vimage/src/sys/kern/kern_malloc.c#14 integrate .. //depot/projects/vimage/src/sys/kern/kern_mbuf.c#17 integrate .. //depot/projects/vimage/src/sys/kern/kern_module.c#8 integrate .. //depot/projects/vimage/src/sys/kern/kern_resource.c#21 integrate .. //depot/projects/vimage/src/sys/kern/kern_sdt.c#2 integrate .. //depot/projects/vimage/src/sys/kern/kern_sig.c#27 integrate .. //depot/projects/vimage/src/sys/kern/kern_switch.c#17 integrate .. //depot/projects/vimage/src/sys/kern/kern_sx.c#21 integrate .. //depot/projects/vimage/src/sys/kern/kern_tc.c#8 integrate .. //depot/projects/vimage/src/sys/kern/kern_timeout.c#21 integrate .. //depot/projects/vimage/src/sys/kern/kern_umtx.c#15 integrate .. //depot/projects/vimage/src/sys/kern/makesyscalls.sh#9 integrate .. //depot/projects/vimage/src/sys/kern/sched_4bsd.c#29 integrate .. //depot/projects/vimage/src/sys/kern/sched_ule.c#35 integrate .. //depot/projects/vimage/src/sys/kern/subr_acl_nfs4.c#3 integrate .. //depot/projects/vimage/src/sys/kern/subr_acl_posix1e.c#6 integrate .. //depot/projects/vimage/src/sys/kern/subr_bus.c#27 integrate .. //depot/projects/vimage/src/sys/kern/subr_devstat.c#4 integrate .. //depot/projects/vimage/src/sys/kern/subr_fattime.c#2 integrate .. //depot/projects/vimage/src/sys/kern/subr_kdb.c#7 integrate .. //depot/projects/vimage/src/sys/kern/subr_lock.c#14 integrate .. //depot/projects/vimage/src/sys/kern/subr_mchain.c#3 integrate .. //depot/projects/vimage/src/sys/kern/subr_module.c#2 integrate .. //depot/projects/vimage/src/sys/kern/subr_param.c#12 integrate .. //depot/projects/vimage/src/sys/kern/subr_pcpu.c#14 integrate .. //depot/projects/vimage/src/sys/kern/subr_smp.c#20 integrate .. //depot/projects/vimage/src/sys/kern/subr_taskqueue.c#13 integrate .. //depot/projects/vimage/src/sys/kern/subr_trap.c#16 integrate .. //depot/projects/vimage/src/sys/kern/subr_unit.c#4 integrate .. //depot/projects/vimage/src/sys/kern/subr_witness.c#31 integrate .. //depot/projects/vimage/src/sys/kern/sys_process.c#18 integrate .. //depot/projects/vimage/src/sys/kern/systrace_args.c#15 integrate .. //depot/projects/vimage/src/sys/kern/sysv_sem.c#12 integrate .. //depot/projects/vimage/src/sys/kern/sysv_shm.c#13 integrate .. //depot/projects/vimage/src/sys/kern/uipc_mbuf.c#15 integrate .. //depot/projects/vimage/src/sys/kern/uipc_mbuf2.c#4 integrate .. //depot/projects/vimage/src/sys/kern/uipc_mqueue.c#17 integrate .. //depot/projects/vimage/src/sys/kern/uipc_syscalls.c#37 integrate .. //depot/projects/vimage/src/sys/kern/vfs_acl.c#10 integrate .. //depot/projects/vimage/src/sys/kern/vfs_bio.c#32 integrate .. //depot/projects/vimage/src/sys/kern/vfs_cache.c#32 integrate .. //depot/projects/vimage/src/sys/kern/vfs_subr.c#39 integrate .. //depot/projects/vimage/src/sys/kern/vfs_vnops.c#33 integrate .. //depot/projects/vimage/src/sys/libkern/memchr.c#1 branch .. //depot/projects/vimage/src/sys/mips/atheros/ar71xx_wdog.c#2 integrate .. //depot/projects/vimage/src/sys/mips/atheros/ar71xxreg.h#2 integrate .. //depot/projects/vimage/src/sys/mips/conf/XLRN32#1 branch .. //depot/projects/vimage/src/sys/mips/include/asm.h#5 integrate .. //depot/projects/vimage/src/sys/mips/include/cpu.h#5 integrate .. //depot/projects/vimage/src/sys/mips/include/pmap.h#11 integrate .. //depot/projects/vimage/src/sys/mips/include/pte.h#5 integrate .. //depot/projects/vimage/src/sys/mips/include/setjmp.h#2 integrate .. //depot/projects/vimage/src/sys/mips/include/tlb.h#1 branch .. //depot/projects/vimage/src/sys/mips/include/vm.h#3 integrate .. //depot/projects/vimage/src/sys/mips/include/vmparam.h#4 integrate .. //depot/projects/vimage/src/sys/mips/mips/cpu.c#5 integrate .. //depot/projects/vimage/src/sys/mips/mips/exception.S#6 integrate .. //depot/projects/vimage/src/sys/mips/mips/machdep.c#10 integrate .. //depot/projects/vimage/src/sys/mips/mips/mp_machdep.c#10 integrate .. //depot/projects/vimage/src/sys/mips/mips/pm_machdep.c#5 integrate .. //depot/projects/vimage/src/sys/mips/mips/pmap.c#22 integrate .. //depot/projects/vimage/src/sys/mips/mips/stack_machdep.c#2 integrate .. //depot/projects/vimage/src/sys/mips/mips/tlb.c#1 branch .. //depot/projects/vimage/src/sys/mips/mips/trap.c#8 integrate .. //depot/projects/vimage/src/sys/mips/mips/vm_machdep.c#5 integrate .. //depot/projects/vimage/src/sys/mips/rmi/board.c#2 integrate .. //depot/projects/vimage/src/sys/mips/rmi/board.h#2 integrate .. //depot/projects/vimage/src/sys/mips/rmi/dev/xlr/rge.c#3 integrate .. //depot/projects/vimage/src/sys/modules/acpi/Makefile#5 integrate .. //depot/projects/vimage/src/sys/modules/acpi/aibs/Makefile#1 branch .. //depot/projects/vimage/src/sys/modules/mqueue/Makefile#2 integrate .. //depot/projects/vimage/src/sys/modules/netgraph/Makefile#12 integrate .. //depot/projects/vimage/src/sys/modules/netgraph/patch/Makefile#1 branch .. //depot/projects/vimage/src/sys/modules/zfs/Makefile#15 integrate .. //depot/projects/vimage/src/sys/net/bpf.c#48 integrate .. //depot/projects/vimage/src/sys/net/bpf.h#10 integrate .. //depot/projects/vimage/src/sys/net/bpfdesc.h#8 integrate .. //depot/projects/vimage/src/sys/net/flowtable.c#15 integrate .. //depot/projects/vimage/src/sys/net/if_epair.c#12 integrate .. //depot/projects/vimage/src/sys/net/netisr.c#25 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_hwmp.c#5 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_rssadapt.c#4 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_sta.c#20 integrate .. //depot/projects/vimage/src/sys/netgraph/ng_patch.c#1 branch .. //depot/projects/vimage/src/sys/netgraph/ng_patch.h#1 branch .. //depot/projects/vimage/src/sys/netgraph/ng_pppoe.c#8 integrate .. //depot/projects/vimage/src/sys/netinet/sctp.h#18 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_asconf.c#25 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_auth.c#18 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_bsd_addr.c#22 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_constants.h#33 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_indata.c#43 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_input.c#40 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_lock_bsd.h#13 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_output.c#47 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_pcb.c#45 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_pcb.h#27 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_sysctl.c#22 integrate .. //depot/projects/vimage/src/sys/netinet/sctp_usrreq.c#41 integrate .. //depot/projects/vimage/src/sys/netinet/sctputil.c#46 integrate .. //depot/projects/vimage/src/sys/netinet6/ip6_mroute.c#34 edit .. //depot/projects/vimage/src/sys/nfsclient/nfs_bio.c#20 integrate .. //depot/projects/vimage/src/sys/nfsclient/nfs_subs.c#15 integrate .. //depot/projects/vimage/src/sys/nfsclient/nfs_vnops.c#44 integrate .. //depot/projects/vimage/src/sys/opencrypto/crypto.c#5 integrate .. //depot/projects/vimage/src/sys/pc98/cbus/clock.c#14 integrate .. //depot/projects/vimage/src/sys/pc98/include/npx.h#2 integrate .. //depot/projects/vimage/src/sys/pc98/pc98/machdep.c#19 integrate .. //depot/projects/vimage/src/sys/powerpc/aim/interrupt.c#4 integrate .. //depot/projects/vimage/src/sys/powerpc/aim/mmu_oea.c#15 integrate .. //depot/projects/vimage/src/sys/powerpc/aim/mmu_oea64.c#10 integrate .. //depot/projects/vimage/src/sys/powerpc/aim/mp_cpudep.c#6 integrate .. //depot/projects/vimage/src/sys/powerpc/aim/nexus.c#5 integrate .. //depot/projects/vimage/src/sys/powerpc/aim/platform_chrp.c#4 integrate .. //depot/projects/vimage/src/sys/powerpc/booke/interrupt.c#4 integrate .. //depot/projects/vimage/src/sys/powerpc/booke/pmap.c#20 integrate .. //depot/projects/vimage/src/sys/powerpc/include/intr_machdep.h#9 integrate .. //depot/projects/vimage/src/sys/powerpc/include/ocpbus.h#3 integrate .. //depot/projects/vimage/src/sys/powerpc/include/openpicvar.h#6 integrate .. //depot/projects/vimage/src/sys/powerpc/mpc85xx/atpic.c#3 integrate .. //depot/projects/vimage/src/sys/powerpc/mpc85xx/isa.c#2 integrate .. //depot/projects/vimage/src/sys/powerpc/mpc85xx/ocpbus.c#9 integrate .. //depot/projects/vimage/src/sys/powerpc/mpc85xx/ocpbus.h#5 integrate .. //depot/projects/vimage/src/sys/powerpc/mpc85xx/opic.c#2 integrate .. //depot/projects/vimage/src/sys/powerpc/mpc85xx/pci_ocp.c#5 integrate .. //depot/projects/vimage/src/sys/powerpc/ofw/ofw_pcib_pci.c#4 integrate .. //depot/projects/vimage/src/sys/powerpc/ofw/ofw_pcibus.c#4 integrate .. //depot/projects/vimage/src/sys/powerpc/ofw/ofw_syscons.c#9 integrate .. //depot/projects/vimage/src/sys/powerpc/powermac/cpcht.c#3 integrate .. //depot/projects/vimage/src/sys/powerpc/powermac/grackle.c#7 integrate .. //depot/projects/vimage/src/sys/powerpc/powermac/hrowpic.c#7 integrate .. //depot/projects/vimage/src/sys/powerpc/powermac/kiic.c#2 integrate .. //depot/projects/vimage/src/sys/powerpc/powermac/macgpio.c#4 integrate .. //depot/projects/vimage/src/sys/powerpc/powermac/macio.c#8 integrate .. //depot/projects/vimage/src/sys/powerpc/powermac/openpic_macio.c#6 integrate .. //depot/projects/vimage/src/sys/powerpc/powermac/smu.c#5 integrate .. //depot/projects/vimage/src/sys/powerpc/powermac/smusat.c#1 branch .. //depot/projects/vimage/src/sys/powerpc/powermac/uninorth.c#10 integrate .. //depot/projects/vimage/src/sys/powerpc/powermac/uninorthpci.c#2 integrate .. //depot/projects/vimage/src/sys/powerpc/powerpc/intr_machdep.c#14 integrate .. //depot/projects/vimage/src/sys/powerpc/powerpc/mp_machdep.c#9 integrate .. //depot/projects/vimage/src/sys/powerpc/powerpc/openpic.c#10 integrate .. //depot/projects/vimage/src/sys/powerpc/powerpc/pic_if.m#6 integrate .. //depot/projects/vimage/src/sys/sparc64/ebus/ebus.c#6 integrate .. //depot/projects/vimage/src/sys/sparc64/isa/ofw_isa.c#5 integrate .. //depot/projects/vimage/src/sys/sparc64/pci/fire.c#2 integrate .. //depot/projects/vimage/src/sys/sparc64/pci/ofw_pcib_subr.c#5 integrate .. //depot/projects/vimage/src/sys/sparc64/pci/psycho.c#19 integrate .. //depot/projects/vimage/src/sys/sparc64/pci/schizo.c#10 integrate .. //depot/projects/vimage/src/sys/sparc64/sparc64/mp_locore.S#8 integrate .. //depot/projects/vimage/src/sys/sparc64/sparc64/pmap.c#21 integrate .. //depot/projects/vimage/src/sys/sun4v/sun4v/hv_pci.c#5 integrate .. //depot/projects/vimage/src/sys/sun4v/sun4v/pmap.c#17 integrate .. //depot/projects/vimage/src/sys/sys/buf.h#10 integrate .. //depot/projects/vimage/src/sys/sys/bus.h#12 integrate .. //depot/projects/vimage/src/sys/sys/conf.h#22 integrate .. //depot/projects/vimage/src/sys/sys/diskmbr.h#2 integrate .. //depot/projects/vimage/src/sys/sys/file.h#10 integrate .. //depot/projects/vimage/src/sys/sys/libkern.h#7 integrate .. //depot/projects/vimage/src/sys/sys/nlist_aout.h#2 integrate .. //depot/projects/vimage/src/sys/sys/param.h#68 integrate .. //depot/projects/vimage/src/sys/sys/pcpu.h#18 integrate .. //depot/projects/vimage/src/sys/sys/pmc.h#13 integrate .. //depot/projects/vimage/src/sys/sys/proc.h#43 integrate .. //depot/projects/vimage/src/sys/sys/smp.h#9 integrate .. //depot/projects/vimage/src/sys/sys/systm.h#25 integrate .. //depot/projects/vimage/src/sys/sys/time.h#8 integrate .. //depot/projects/vimage/src/sys/sys/timeet.h#1 branch .. //depot/projects/vimage/src/sys/sys/vnode.h#31 integrate .. //depot/projects/vimage/src/sys/sys/vtoc.h#4 integrate .. //depot/projects/vimage/src/sys/tools/fdt/embed_dtb.sh#1 branch .. //depot/projects/vimage/src/sys/tools/fdt/make_dtbh.sh#1 branch .. //depot/projects/vimage/src/sys/ufs/ffs/ffs_softdep.c#21 integrate .. //depot/projects/vimage/src/sys/ufs/ufs/ufs_lookup.c#18 integrate .. //depot/projects/vimage/src/sys/ufs/ufs/ufs_quota.c#9 integrate .. //depot/projects/vimage/src/sys/vm/uma.h#7 integrate .. //depot/projects/vimage/src/sys/vm/uma_core.c#15 integrate .. //depot/projects/vimage/src/sys/vm/uma_int.h#6 integrate .. //depot/projects/vimage/src/sys/vm/vm_contig.c#17 integrate .. //depot/projects/vimage/src/sys/vm/vm_page.c#31 integrate .. //depot/projects/vimage/src/sys/vm/vm_page.h#17 integrate .. //depot/projects/vimage/src/sys/vm/vm_pageout.c#26 integrate .. //depot/projects/vimage/src/sys/vm/vm_pageout.h#5 integrate .. //depot/projects/vimage/src/sys/x86/cpufreq/est.c#2 integrate .. //depot/projects/vimage/src/sys/x86/isa/atrtc.c#2 integrate .. //depot/projects/vimage/src/sys/x86/isa/clock.c#5 integrate .. //depot/projects/vimage/src/sys/x86/x86/io_apic.c#1 branch .. //depot/projects/vimage/src/sys/x86/x86/local_apic.c#2 integrate .. //depot/projects/vimage/src/sys/x86/x86/mca.c#1 branch .. //depot/projects/vimage/src/sys/x86/x86/msi.c#1 branch .. //depot/projects/vimage/src/sys/x86/x86/timeevents.c#1 branch Differences ... ==== //depot/projects/vimage/src/share/man/man1/builtin.1#4 (text+ko) ==== @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man1/builtin.1,v 1.32 2010/05/09 15:00:30 jilles Exp $ +.\" $FreeBSD: src/share/man/man1/builtin.1,v 1.33 2010/06/11 06:04:00 uqs Exp $ .\" .Dd May 9, 2010 .Dt BUILTIN 1 @@ -193,9 +193,7 @@ do exist externally, but are implemented as scripts using a builtin command of the same name. .Bl -column ".Ic uncomplete" ".Em External" ".Xr csh 1" ".Xr sh 1" -offset indent -.It Xo -.Em "Command External" Ta Xr csh 1 Ta Xr sh 1 -.Xc +.It Em Command Ta Em External Ta Xr csh 1 Ta Xr sh 1 .It Ic \&! Ta \&No Ta \&No Ta Yes .It Ic % Ta \&No Ta Yes Ta \&No .It Ic \&. Ta \&No Ta \&No Ta Yes ==== //depot/projects/vimage/src/share/man/man4/Makefile#22 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 6/18/93 -# $FreeBSD: src/share/man/man4/Makefile,v 1.479 2010/05/25 21:20:56 glebius Exp $ +# $FreeBSD: src/share/man/man4/Makefile,v 1.481 2010/06/25 15:32:46 rpaulo Exp $ MAN= aac.4 \ acpi.4 \ @@ -26,6 +26,7 @@ ahc.4 \ ahci.4 \ ahd.4 \ + ${_aibs.4} \ aio.4 \ alc.4 \ ale.4 \ @@ -274,6 +275,7 @@ ng_nat.4 \ ng_netflow.4 \ ng_one2many.4 \ + ng_patch.4 \ ng_ppp.4 \ ng_pppoe.4 \ ng_pptpgre.4 \ @@ -632,6 +634,7 @@ _acpi_sony.4= acpi_sony.4 _acpi_toshiba.4=acpi_toshiba.4 _acpi_wmi.4= acpi_wmi.4 +_aibs.4= aibs.4 _amdsbwd.4= amdsbwd.4 _amdsmb.4= amdsmb.4 _amdtemp.4= amdtemp.4 ==== //depot/projects/vimage/src/share/man/man4/ae.4#4 (text+ko) ==== @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/ae.4,v 1.4 2010/05/13 12:07:55 uqs Exp $ +.\" $FreeBSD: src/share/man/man4/ae.4,v 1.5 2010/06/11 06:04:07 uqs Exp $ .\" .Dd October 4, 2008 .Dt AE 4 @@ -41,7 +41,7 @@ Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : -.Bd -literal -offset -indent +.Bd -literal -offset indent if_ae_load="YES" .Ed .Sh DESCRIPTION ==== //depot/projects/vimage/src/share/man/man4/bpf.4#2 (text+ko) ==== @@ -47,9 +47,9 @@ .\" This document is derived in part from the enet man page (enet.4) .\" distributed with 4.3BSD Unix. .\" -.\" $FreeBSD: src/share/man/man4/bpf.4,v 1.52 2008/08/13 17:45:06 ed Exp $ +.\" $FreeBSD: src/share/man/man4/bpf.4,v 1.53 2010/06/15 19:28:44 jkim Exp $ .\" -.Dd February 26, 2007 +.Dd June 15, 2010 .Dt BPF 4 .Os .Sh NAME @@ -513,6 +513,64 @@ This setting is initialized to .Dv BPF_D_INOUT by default. +.It Dv BIOCSTSTAMP +.It Dv BIOCGTSTAMP +.Pq Li u_int +Set or get format and resolution of the time stamps returned by BPF. +Set to +.Dv BPF_T_MICROTIME , +.Dv BPF_T_MICROTIME_FAST , +.Dv BPF_T_MICROTIME_MONOTONIC , +or +.Dv BPF_T_MICROTIME_MONOTONIC_FAST +to get time stamps in 64-bit +.Vt struct timeval +format. +Set to +.Dv BPF_T_NANOTIME , +.Dv BPF_T_NANOTIME_FAST , +.Dv BPF_T_NANOTIME_MONOTONIC , +or +.Dv BPF_T_NANOTIME_MONOTONIC_FAST +to get time stamps in 64-bit +.Vt struct timespec +format. +Set to +.Dv BPF_T_BINTIME , +.Dv BPF_T_BINTIME_FAST , +.Dv BPF_T_NANOTIME_MONOTONIC , +or +.Dv BPF_T_BINTIME_MONOTONIC_FAST +to get time stamps in 64-bit +.Vt struct bintime +format. +Set to +.Dv BPF_T_NONE +to ignore time stamp. +All 64-bit time stamp formats are wrapped in +.Vt struct bpf_ts . +The +.Dv BPF_T_MICROTIME_FAST , +.Dv BPF_T_NANOTIME_FAST , +.Dv BPF_T_BINTIME_FAST , +.Dv BPF_T_MICROTIME_MONOTONIC_FAST , +.Dv BPF_T_NANOTIME_MONOTONIC_FAST , +and +.Dv BPF_T_BINTIME_MONOTONIC_FAST +are analogs of corresponding formats without _FAST suffix but do not perform +a full time counter query, so their accuracy is one timer tick. +The +.Dv BPF_T_MICROTIME_MONOTONIC , +.Dv BPF_T_NANOTIME_MONOTONIC , +.Dv BPF_T_BINTIME_MONOTONIC , +.Dv BPF_T_MICROTIME_MONOTONIC_FAST , +.Dv BPF_T_NANOTIME_MONOTONIC_FAST , +and +.Dv BPF_T_BINTIME_MONOTONIC_FAST +store the time elapsed since kernel boot. +This setting is initialized to +.Dv BPF_T_MICROTIME +by default. .It Dv BIOCFEEDBACK .Pq Li u_int Set packet feedback mode. @@ -575,16 +633,24 @@ .Vt bzh_user_gen . .El .Sh BPF HEADER -The following structure is prepended to each packet returned by +One of the following structures is prepended to each packet returned by .Xr read 2 or via a zero-copy buffer: .Bd -literal +struct bpf_xhdr { + struct bpf_ts bh_tstamp; /* time stamp */ + uint32_t bh_caplen; /* length of captured portion */ + uint32_t bh_datalen; /* original length of packet */ + u_short bh_hdrlen; /* length of bpf header (this struct + plus alignment padding */ +}; + struct bpf_hdr { - struct timeval bh_tstamp; /* time stamp */ - u_long bh_caplen; /* length of captured portion */ - u_long bh_datalen; /* original length of packet */ - u_short bh_hdrlen; /* length of bpf header (this struct - plus alignment padding */ + struct timeval bh_tstamp; /* time stamp */ + uint32_t bh_caplen; /* length of captured portion */ + uint32_t bh_datalen; /* original length of packet */ + u_short bh_hdrlen; /* length of bpf header (this struct + plus alignment padding */ }; .Ed .Pp @@ -605,6 +671,8 @@ .Nm header, which may not be equal to .\" XXX - not really a function call +.Fn sizeof "struct bpf_xhdr" +or .Fn sizeof "struct bpf_hdr" . .El .Pp @@ -616,9 +684,24 @@ data structures, which is required on alignment sensitive architectures and improves performance on many other architectures. The packet filter insures that the -.Li bpf_hdr +.Vt bpf_xhdr , +.Vt bpf_hdr and the network layer header will be word aligned. +Currently, +.Vt bpf_hdr +is used when the time stamp is set to +.Dv BPF_T_MICROTIME , +.Dv BPF_T_MICROTIME_FAST , +.Dv BPF_T_MICROTIME_MONOTONIC , +.Dv BPF_T_MICROTIME_MONOTONIC_FAST , +or +.Dv BPF_T_NONE +for backward compatibility reasons. Otherwise, +.Vt bpf_xhdr +is used. However, +.Vt bpf_hdr +may be deprecated in the near future. Suitable precautions must be taken when accessing the link layer protocol fields on alignment restricted machines. ==== //depot/projects/vimage/src/share/man/man4/io.4#4 (text+ko) ==== @@ -25,7 +25,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/io.4,v 1.3 2010/06/01 18:27:48 attilio Exp $ +.\" $FreeBSD: src/share/man/man4/io.4,v 1.5 2010/06/11 06:04:07 uqs Exp $ .\" .Dd June 01, 2010 .Dt IO 4 @@ -40,7 +40,6 @@ .In sys/ioctl.h .In dev/io/iodev.h .In machine/iodev.h -.Pp .Bd -literal struct iodev_pio_req { u_int access; @@ -48,6 +47,7 @@ u_int width; u_int val; }; +.Ed .Sh DESCRIPTION The special file .Pa /dev/io @@ -72,22 +72,25 @@ The .Dv IODEV_PIO is used by all the architectures in order to request that an I/O operation -be performed. It takes a 'struct iodev_pio_req' argument -that must be previously setup. +be performed. +It takes a 'struct iodev_pio_req' argument that must be previously setup. .Pp The .Fa access -member specifies the type of operation requested. It may be: +member specifies the type of operation requested. +It may be: .Bl -tag -width IODEV_PIO_WRITE .It Dv IODEV_PIO_READ -The operation is an "in" type. A value will be read from the specified port +The operation is an "in" type. +A value will be read from the specified port (retrieved from the .Fa port member) and the result will be stored in the .Fa val member. .It Dv IODEV_PIO_WRITE -The operation is a "out" type. The value will be fetched from the +The operation is a "out" type. +The value will be fetched from the .Fa val member and will be written out to the specified port (defined as the .Fa port @@ -105,13 +108,14 @@ .Sh LEGACY The .Pa /dev/io -interface used to be very i386 specific and worked differently. The initial -implementation, in fact, simply raised the +interface used to be very i386 specific and worked differently. +The initial implementation simply raised the .Em IOPL of the current thread when .Xr open 2 -was called on the file. This behaviour is retained in the current -implementation as legacy support for both i386 and amd64 architectures. +was called on the device. +This behaviour is retained in the current implementation as legacy +support for both i386 and amd64 architectures. .Sh SEE ALSO .Xr close 2 , .Xr i386_get_ioperm 2 , ==== //depot/projects/vimage/src/share/man/man4/textdump.4#6 (text+ko) ==== @@ -25,10 +25,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH .\" DAMAGE. .\" -.\" $FreeBSD: src/share/man/man4/textdump.4,v 1.9 2010/03/12 10:01:06 uqs Exp $ +.\" $FreeBSD: src/share/man/man4/textdump.4,v 1.10 2010/06/11 06:03:47 uqs Exp $ .\" .Dd December 24, 2008 -.Dt textdump 4 +.Dt TEXTDUMP 4 .Os .Sh NAME .Nm textdump ==== //depot/projects/vimage/src/share/man/man5/a.out.5#2 (text+ko) ==== @@ -33,9 +33,9 @@ .\" SUCH DAMAGE. .\" .\" @(#)a.out.5 8.1 (Berkeley) 6/5/93 -.\" $FreeBSD: src/share/man/man5/a.out.5,v 1.19 2005/06/30 13:10:37 hmp Exp $ +.\" $FreeBSD: src/share/man/man5/a.out.5,v 1.20 2010/06/10 14:19:51 bz Exp $ .\" -.Dd June 5, 1993 +.Dd June 10, 2010 .Dt A.OUT 5 .Os .Sh NAME @@ -307,13 +307,13 @@ .Bd -literal -offset indent struct nlist { union { - char *n_name; - long n_strx; + const char *n_name; + long n_strx; } n_un; - unsigned char n_type; - char n_other; - short n_desc; - unsigned long n_value; + unsigned char n_type; + char n_other; + short n_desc; + unsigned long n_value; }; .Ed .Pp ==== //depot/projects/vimage/src/share/man/man5/periodic.conf.5#2 (text+ko) ==== @@ -23,9 +23,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/share/man/man5/periodic.conf.5,v 1.65 2007/05/13 09:33:35 maxim Exp $ +.\" $FreeBSD: src/share/man/man5/periodic.conf.5,v 1.66 2010/06/15 08:58:16 netchild Exp $ .\" -.Dd May 12, 2007 +.Dd June 15, 2010 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -611,6 +611,25 @@ .Va daily_queuerun_enable is set to .Dq Li YES . +.It Va daily_scrub_zfs_enable +.Pq Vt bool +Set to +.Dq Li YES +if you want to run a zfs scrub periodically. +.It Va daily_scrub_zfs_pools +.Pq Vt str +A space separated list of names of zfs pools to scrub. +If the list is empty or not set, all zfs pools are scrubbed. +.It Va daily_scrub_zfs_default_threshold +.Pq Vt int +Number of days between a scrub if no pool-specific threshold is set. +The default value if no value is set is 30. +.It Va daily_scrub_zfs_ Ns Ao Ar poolname Ac Ns Va _threshold +.Pq Vt int +The same as +.Va daily_scrub_zfs_default_threshold +but specific to the pool +.Va Ns Ao Ar poolname Ac Ns . .It Va daily_local .Pq Vt str Set to a list of extra scripts that should be run after all other ==== //depot/projects/vimage/src/share/man/man5/src.conf.5#8 (text) ==== @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 188848 2009-02-20 11:09:55Z mtm -.\" $FreeBSD: src/share/man/man5/src.conf.5,v 1.37 2010/05/20 00:10:11 jkim Exp $ -.Dd May 19, 2010 +.\" $FreeBSD: src/share/man/man5/src.conf.5,v 1.40 2010/06/10 06:22:10 ed Exp $ +.Dd June 10, 2010 .Dt SRC.CONF 5 .Os .Sh NAME @@ -247,6 +247,9 @@ .It .Va WITHOUT_ZFS .El +.It Va WITHOUT_CLANG +.\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG 208971 2010-06-10 06:20:26Z ed +Set to not build the Clang C/C++ compiler. .It Va WITHOUT_CPP .\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 07:50:50Z ru Set to not build @@ -297,6 +300,10 @@ .\" from FreeBSD: head/tools/build/options/WITHOUT_EXAMPLES 156938 2006-03-21 09:06:24Z ru Set to avoid installing examples to .Pa /usr/share/examples/ . +.It Va WITH_FDT +.\" from FreeBSD: head/tools/build/options/WITH_FDT 208537 2010-05-25 15:12:21Z raj +Set to build Flattened Device Tree support as part of the base system. This +includes the device tree compiler (dtc) and libfdt support library. .It Va WITHOUT_FLOPPY .\" from FreeBSD: head/tools/build/options/WITHOUT_FLOPPY 183306 2008-09-23 16:15:42Z sam Set to not build or install programs @@ -799,6 +806,8 @@ .Pp .Bl -item -compact .It +.Va WITHOUT_CLANG +.It .Va WITHOUT_GDB .El .It Va WITHOUT_USB ==== //depot/projects/vimage/src/share/man/man5/stab.5#2 (text+ko) ==== @@ -30,9 +30,9 @@ .\" SUCH DAMAGE. .\" .\" @(#)stab.5 8.1 (Berkeley) 6/5/93 -.\" $FreeBSD: src/share/man/man5/stab.5,v 1.12 2005/01/21 08:36:39 ru Exp $ +.\" $FreeBSD: src/share/man/man5/stab.5,v 1.13 2010/06/10 14:19:51 bz Exp $ .\" -.Dd June 5, 1993 +.Dd June 10, 2010 .Dt STAB 5 .Os .Sh NAME @@ -79,7 +79,7 @@ struct nlist { union { - char *n_name; /* for use when in-core */ + const char *n_name; /* for use when in-core */ long n_strx; /* index into file string table */ } n_un; unsigned char n_type; /* type flag */ ==== //depot/projects/vimage/src/share/man/man7/Makefile#3 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 6/5/93 -# $FreeBSD: src/share/man/man7/Makefile,v 1.34 2009/01/30 15:14:58 gabor Exp $ +# $FreeBSD: src/share/man/man7/Makefile,v 1.36 2010/06/17 13:59:41 gabor Exp $ #MISSING: eqnchar.7 ms.7 term.7 MAN= adding_user.7 \ @@ -7,6 +7,7 @@ bsd.snmpmod.mk.7 \ build.7 \ >>> TRUNCATED FOR MAIL (1000 lines) <<< From owner-p4-projects@FreeBSD.ORG Sun Jun 27 21:36:40 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 329E61065677; Sun, 27 Jun 2010 21:36:40 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAFBE106566C for ; Sun, 27 Jun 2010 21:36:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C09A68FC1F for ; Sun, 27 Jun 2010 21:36:39 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5RLadqT093450 for ; Sun, 27 Jun 2010 21:36:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5RLadsQ093448 for perforce@freebsd.org; Sun, 27 Jun 2010 21:36:39 GMT (envelope-from hselasky@FreeBSD.org) Date: Sun, 27 Jun 2010 21:36:39 GMT Message-Id: <201006272136.o5RLadsQ093448@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180276 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2010 21:36:40 -0000 http://p4web.freebsd.org/@@180276?ac=10 Change 180276 by hselasky@hselasky_laptop001 on 2010/06/27 21:36:17 - Add new USB device ID. PR: usb/148189 Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usbdevs#127 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usbdevs#127 (text+ko) ==== @@ -2158,6 +2158,7 @@ product NATIONAL BEARPAW2400 0x1001 BearPaw 2400 /* NEC products */ +product NEC NUB_005A 0x005a USB 2.0 4-Port Hub product NEC HUB 0x55aa hub product NEC HUB_B 0x55ab hub From owner-p4-projects@FreeBSD.ORG Mon Jun 28 00:12:30 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A19421065672; Mon, 28 Jun 2010 00:12:30 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66027106566C for ; Mon, 28 Jun 2010 00:12:30 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 52DBC8FC17 for ; Mon, 28 Jun 2010 00:12:30 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5S0CUY4008124 for ; Mon, 28 Jun 2010 00:12:30 GMT (envelope-from ivoras@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5S0CTXu008122 for perforce@freebsd.org; Mon, 28 Jun 2010 00:12:29 GMT (envelope-from ivoras@FreeBSD.org) Date: Mon, 28 Jun 2010 00:12:29 GMT Message-Id: <201006280012.o5S0CTXu008122@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ivoras@FreeBSD.org using -f From: Ivan Voras To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180278 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 00:12:30 -0000 http://p4web.freebsd.org/@@180278?ac=10 Change 180278 by ivoras@betelgeuse on 2010/06/28 00:12:23 Finish file patching, start work on finishing steps of the operation. Affected files ... .. //depot/projects/soc2010/pkg_patch/src/patch/Makefile#17 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#7 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#7 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#16 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#16 edit .. //depot/projects/soc2010/pkg_patch/src/patch/main.c#17 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#15 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#15 edit .. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#15 edit .. //depot/projects/soc2010/pkg_patch/src/patch/support.c#14 edit Differences ... ==== //depot/projects/soc2010/pkg_patch/src/patch/Makefile#17 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#7 (text+ko) ==== @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "pkg_patch.h" @@ -100,15 +101,148 @@ } +/* + * Convert a package-relative filename to the absolute (live) filename, using + * the "cwd" information from the Package plist information. + */ +static int +pkg_to_live_filename(char *afilename, char *pfilename, Package *pkg, + const char *msg) +{ + char *last_cwd = NULL; + PackingList pli; + Boolean found = FALSE; + + pli = pkg->head; + while (pli != NULL) { + if (pli->type == PLIST_CWD) + last_cwd = pli->name; + if (pli->type == PLIST_FILE && + strncmp(pfilename, pli->name, PATH_MAX) == 0) { + found = TRUE; + break; + } + pli = pli->next; + } + if (!found) { + warnx("File not found in package metadata: %s [%s]", + pfilename, msg); + return (-1); + } + if (last_cwd == NULL) { + warnx("Failure to detect package cwd info [%s]", msg); + return (-1); + } + snprintf(afilename, PATH_MAX, "%s/%s", last_cwd, pli->name); + return (0); +} + + +/* + * Convert a package-relative directory name to the absolute (live) directory + * name. This is actually somewhat evil and heuristic because the package + * metadata doesn't reference directories and we try to find any file whose + * path begins with the given directory. This should work for all official + * packages but as the metadata format is badly designed, there can be lots of + * edge cases. Solving those is left as an excercise for the reader. + */ +static int +pkg_to_live_dirname(char *adirname, char *pdirname, Package *pkg, + const char *msg) +{ + PackingList pli; + char *last_cwd = NULL; + int pdirlen; + Boolean found = FALSE; + + pdirlen = strlen(pdirname); + pli = pkg->head; + while (pli != NULL) { + if (pli->type == PLIST_CWD) + last_cwd = pli->name; + if (pli->type == PLIST_FILE && + strncmp(pdirname, pli->name, pdirlen) == 0) { + /* Just find anything which begins with the pdirname */ + found = TRUE; + break; + } + pli = pli->next; + } + if (!found) { + warnx("Directory cannot be divined from package metadata: " + "%s [%s]", pdirname, msg); + return (-1); + } + if (last_cwd == NULL) { + warnx("Failure to detect package cwd info [%s]", msg); + return (-1); + } + snprintf(adirname, PATH_MAX, "%s/%s", last_cwd, pli->name); + return (0); +} + + +/* + * Finds a MD5 comment for the given file within the given package metadata. + * As the package metadata is informally specified, nothing guarantees this + * will succeed :) + * The MD5 comment is expected to be after the file node and before any + * following file node. + */ +static int +pkg_find_md5(char *filename, Package *pkg, char *md5) +{ + PackingList pli; + Boolean found = FALSE; + char *p; + + pli = pkg->head; + *md5 = '\0'; + while (pli != NULL) { + if (pli->type == PLIST_FILE) { + if (strncmp(filename, pli->name, PATH_MAX) == 0) { + found = TRUE; + break; + } + } + pli = pli->next; + } + if (!found) + return (-1); + found = FALSE; + while (pli != NULL) { + if (pli->type == PLIST_COMMENT) { + p = strchr(pli->name, ':'); + if (p != NULL && strncmp(pli->name, "MD5:", 4) == 0) { + strlcpy(md5, p+1, 33); + found = TRUE; + break; + } + } + pli = pli->next; + if (pli != NULL) + if (pli->type == PLIST_FILE) + return (-1); + } + if (!found) + return (-1); + return (0); +} + + +/* + * Apply patch command + */ void perform_applypatch() { - char fpatch[PATH_MAX], dpatch[PATH_MAX], tmp[PATH_MAX]; + unsigned int err_count, n_patched_files, i; + char fpatch[PATH_MAX], dpatch[PATH_MAX], tmp[PATH_MAX], pext[10]; struct pkgxjob xpatch; struct pkg_patch pp; Package pkg_live, pkg_new; struct pplist *pl; - unsigned int err_count = 0; + FILE **fpvect; if (argc < 1) errx(1, "Expecting argument: patch filename"); @@ -129,6 +263,7 @@ dpatch); snprintf(tmp, PATH_MAX, "%s/%s", dpatch, PKGPATCH_FNAME); + err_count = 0; /* Step 1 - read the patch metadata */ read_pkgpatch_file(tmp, &pp); @@ -166,16 +301,162 @@ printf("Verifying live system and patch data consistency...\n"); /* Check that files to be added don't exist already. */ STAILQ_FOREACH(pl, &pp.pp_add, linkage) { - snprintf(tmp, PATH_MAX, "%s/%s", PREFIX, pl->filename); + if (pkg_to_live_filename(tmp, pl->filename, &pkg_new, "pp_add") + != 0) { + err_count++; + continue; + } if (access(tmp, F_OK) == 0) { warnx("File exists but shouldn't: %s", tmp); err_count++; } } + /* Check that files to be removed actually exist. */ + STAILQ_FOREACH(pl, &pp.pp_remove, linkage) { + if (pkg_to_live_filename(tmp, pl->filename, &pkg_live, + "pp_remove") != 0) { + err_count++; + continue; + } + if (access(tmp, F_OK) != 0) { + warnx("File should exist but doesn't: %s", tmp); + err_count++; + } + } + /* Check that directories to be removed actually exist. */ + STAILQ_FOREACH(pl, &pp.pp_rmdir, linkage) { + if (pkg_to_live_dirname(tmp, pl->filename, &pkg_live, + "pp_rmdir") != 0) { + err_count++; + continue; + } + if (access(tmp, F_OK) != 0) { + warnx("Directory should exist but doesn't: %s", tmp); + err_count++; + } + } + /* Check that files to be patched actually exist. */ + STAILQ_FOREACH(pl, &pp.pp_patch, linkage) { + if (pkg_to_live_filename(tmp, pl->filename, &pkg_live, + "pp_patch") != 0) { + err_count++; + continue; + } + if (access(tmp, F_OK) != 0) { + warnx("File should exist but doesn't: %s", tmp); + err_count++; + } + } if (err_count != 0) errx(1, "Found %u errors. Cannot continue.", err_count); /* Step 4 - backup the existing package */ if (pkg_backup(pp.source) != 0) err(1, "Cannot backup package: %s", pp.source); + + /* + * Step 5 - apply patches. This is done by generating new files from + * existing files and patches, then verifying all of them match expected + * checksum, then rename()-ing them to the expected files. + */ + snprintf(pext, sizeof(pext), ".p%u", getpid()); + fpvect = calloc(pplist_count(&pp.pp_patch), sizeof(*fpvect)); + n_patched_files = 0; + STAILQ_FOREACH(pl, &pp.pp_patch, linkage) { + char newfile[PATH_MAX], patchfile[PATH_MAX]; + + if (pl->filename[0] == '+') + continue; + if (pkg_to_live_filename(tmp, pl->filename, &pkg_live, + "pp_patch2") != 0) { + err_count++; + warnx("Cannot resolve %s on a live pkg", pl->filename); + } + snprintf(newfile, PATH_MAX, "%s%s", tmp, pext); + if (pl->method == PPMETHOD_CP) + snprintf(patchfile, PATH_MAX, "%s/%s", dpatch, + pl->filename); + else if (pl->method == PPMETHOD_BSDIFF) + snprintf(patchfile, PATH_MAX, "%s/%s.bsdiff", dpatch, + pl->filename); + else + errx(1, "Unknown patch method: %d", (int)(pl->method)); + if (Verbose > 2) + printf("Raw patching %s to %s using %s\n", tmp, newfile, + patchfile); + if (pl->method == PPMETHOD_BSDIFF) { + char cmd[3*PATH_MAX]; + + snprintf(cmd, sizeof(cmd), "%s \"%s\" \"%s\" \"%s\"", + _PATH_BSPATCH, tmp, newfile, patchfile); + fpvect[n_patched_files] = popen(cmd, "r+"); + if (fpvect[n_patched_files] == NULL) + err(1, "Cannot popen: %s", cmd); + n_patched_files++; + } else + if (cp(tmp, newfile) != 0) + err(1, "Cannot copy %s to %s", tmp, newfile); + } + for (i = 0; i < n_patched_files; i++) + if (pclose(fpvect[i]) != 0) + err(1, "pclose() failed"); + /* Verify patched files are correct */ + STAILQ_FOREACH(pl, &pp.pp_patch, linkage) { + char live_md5[33], target_md5[33], newfile[PATH_MAX]; + + if (pl->filename[0] == '+') + continue; + if (pkg_find_md5(pl->filename, &pkg_new, target_md5) != 0) { + warnx("Cannot find MD5 of %s in target metadata", + pl->filename); + continue; + } + if (pkg_to_live_filename(newfile, pl->filename, &pkg_live, + "pp_patch3") != 0) { + err_count++; + warnx("Cannot resolve %s on live pkg for verifying", + pl->filename); + break; + } + strncat(newfile, pext, PATH_MAX); + if (MD5File(newfile, live_md5) == NULL) + err(1, "Cannot MD5 file: %s", newfile); + if (strncmp(live_md5, target_md5, sizeof(live_md5)) != 0) + errx(1, "MD5 mismatch for %s: expected %s, got %s", + pl->filename, target_md5, live_md5); + snprintf(tmp, PATH_MAX, "%s/%s", dpatch, pl->filename); + if (copy_file_attrs(tmp, NULL, newfile) != 0) { + warn("Cannot copy file attributes from %s to %s", + tmp, newfile); + goto error_cleanup; + } + } + /* All is well, we can rename() the new files to the live ones. */ + STAILQ_FOREACH(pl, &pp.pp_patch, linkage) { + char newfile[PATH_MAX], livefile[PATH_MAX]; + + if (pl->filename[0] == '+') + continue; + if (pkg_to_live_filename(livefile, pl->filename, &pkg_live, + "pp_patch4") != 0) + errx(1, "Cannot resolve %s on live pkg", pl->filename); + snprintf(newfile, PATH_MAX, "%s%s", livefile, pext); + assert(access(newfile, F_OK) == 0); + if (rename(newfile, livefile) != 0) { + warn("rename(%s,%s) failed", newfile, livefile); + goto error_cleanup; + } + } + /* Step 6 - apply other classes - files to add, remove, dirs to rmdir */ + STAILQ_FOREACH(pl, &pp.pp_add, linkage) { + } + STAILQ_FOREACH(pl, &pp.pp_remove, linkage) { + } + STAILQ_FOREACH(pl, &pp.pp_rmdir, linkage) { + } + /* Step 7 - fixup metadata */ + return; +error_cleanup: + /* Remove temp patch files, restore backed-up package */ + warnx("Error detected! Rolling back package."); } ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#7 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#16 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#16 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/main.c#17 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#15 (text+ko) ==== @@ -243,10 +243,10 @@ * I've observed linear or better processing time improvments * with this simple trick. */ - FILE **fplist = calloc(n_changed_files, sizeof(*fplist)); + FILE **fpvect = calloc(n_changed_files, sizeof(*fpvect)); int n = 0; - if (fplist == NULL) + if (fpvect == NULL) err(1, "calloc() failed"); /* Start jobs */ SLIST_FOREACH(fl, &flchanged, linkage) { @@ -254,13 +254,14 @@ continue; if (Verbose > 1) printf("bsdiff for %s\n", fl->filename); - snprintf(tmp, PATH_MAX, "%s %s/%s %s/%s %s/%s.bsdiff", + snprintf(tmp, PATH_MAX, + "%s \"%s/%s\" \"%s/%s\" \"%s/%s.bsdiff\"", _PATH_BSDIFF, dold, fl->filename, dnew, fl->filename, dpatch, fl->filename); - fplist[n] = popen(tmp, "r+"); - if (fplist[n] == NULL) + fpvect[n] = popen(tmp, "r+"); + if (fpvect[n] == NULL) err(1, "Cannot popen bsdiff for %s", fl->filename); n++; @@ -270,7 +271,7 @@ SLIST_FOREACH(fl, &flchanged, linkage) { if (fl->filename[0] == '+') continue; - if (pclose(fplist[n]) < 0) + if (pclose(fpvect[n]) < 0) err(1, "pclose() failed for bsdiff of %s", fl->filename); n++; @@ -281,7 +282,7 @@ err(1, "copy_file_attrs(%s,%s) failed", tmp, tmp2); } - free(fplist); + free(fpvect); } /* Finally, create the patch archive and call it a day. */ ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#15 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#15 (text+ko) ==== @@ -26,6 +26,9 @@ #ifndef _PATH_BSDIFF #define _PATH_BSDIFF "/usr/bin/bsdiff" #endif +#ifndef _PATH_BSPATCH +#define _PATH_BSPATCH "/usr/bin/bspatch" +#endif #ifndef _PATH_PKG_CREATE #define _PATH_PKG_CREATE "/usr/sbin/pkg_create" #endif @@ -100,6 +103,7 @@ int rm_rf(char *dir); +int cp(char *from, char *to); int pkgxjob_start(struct pkgxjob *job, char *dir, char *filename); int pkgxjob_finish(struct pkgxjob *job); int filelist_gather(char *dir, struct filelist_head *head); ==== //depot/projects/soc2010/pkg_patch/src/patch/support.c#14 (text+ko) ==== @@ -37,6 +37,9 @@ #include "pkg_patch.h" +/* + * Removes a directory hierarchy. + */ int rm_rf(char *dir) { @@ -48,6 +51,56 @@ } +/* + * Simple file copy. + */ +int +cp(char *from, char *to) +{ + int fd1, fd2, rval = 0; + size_t bs = 1*1024*1024; + char *buf; + + fd1 = open(from, O_RDONLY); + if (fd1 < 0) + return (-1); + fd2 = open(to, O_WRONLY | O_CREAT | O_TRUNC, 0600); + if (fd2 < 0) { + close(fd1); + return (-1); + } + buf = malloc(bs); + if (buf == NULL) { + rval = -1; + goto end; + } + while (bs > 0) { + bs = read(fd1, buf, bs); + if (bs > 0) { + ssize_t written = 0, wr; + + while (bs - written > 0) { + wr = write(fd2, buf + written, bs - written); + if (wr < 0) { + rval = -1; + goto end; + } + written += wr; + } + } + } +end: + if (buf != NULL) + free(buf); + close(fd2); + close(fd1); + return (rval); +} + + +/* + * Starts a package extract (tar) job as a separate process. + */ int pkgxjob_start(struct pkgxjob *job, char *dir, char *filename) { @@ -65,6 +118,9 @@ } +/* + * Finish (cleanup) a tar job. + */ int pkgxjob_finish(struct pkgxjob *job) { @@ -72,6 +128,9 @@ } +/* + * Gather files in a file hierarchy into the given filelist_head. + */ int filelist_gather(char *dir, struct filelist_head *head) { @@ -108,6 +167,9 @@ } +/* + * Returns a list of differences between filelists. + */ int filelist_diff(struct filelist_head *flist1, struct filelist_head *flist2, struct filelist_head *fldiff) @@ -133,6 +195,9 @@ } +/* + * Return a list consisting of the intersection of two given filelists. + */ int filelist_intersect(struct filelist_head *flist1, struct filelist_head *flist2, struct filelist_head *flintersect) @@ -158,6 +223,9 @@ } +/* + * Returns the number of elements in the given filelist. + */ unsigned int filelist_count(struct filelist_head *flist) { From owner-p4-projects@FreeBSD.ORG Mon Jun 28 01:17:42 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 11F431065673; Mon, 28 Jun 2010 01:17:42 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA545106564A for ; Mon, 28 Jun 2010 01:17:41 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B77798FC13 for ; Mon, 28 Jun 2010 01:17:41 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5S1HfrH024833 for ; Mon, 28 Jun 2010 01:17:41 GMT (envelope-from ivoras@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5S1Hfxd024831 for perforce@freebsd.org; Mon, 28 Jun 2010 01:17:41 GMT (envelope-from ivoras@FreeBSD.org) Date: Mon, 28 Jun 2010 01:17:41 GMT Message-Id: <201006280117.o5S1Hfxd024831@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ivoras@FreeBSD.org using -f From: Ivan Voras To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180279 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 01:17:42 -0000 http://p4web.freebsd.org/@@180279?ac=10 Change 180279 by ivoras@betelgeuse on 2010/06/28 01:17:39 Finish the patch package "apply" function. Basically, this completes Milestone 2. Affected files ... .. //depot/projects/soc2010/pkg_patch/src/patch/Makefile#18 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#8 edit .. //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#8 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#17 edit .. //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#17 edit .. //depot/projects/soc2010/pkg_patch/src/patch/main.c#18 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#16 edit .. //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#16 edit .. //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#16 edit .. //depot/projects/soc2010/pkg_patch/src/patch/support.c#15 edit Differences ... ==== //depot/projects/soc2010/pkg_patch/src/patch/Makefile#18 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.c#8 (text+ko) ==== @@ -42,10 +42,8 @@ * by its full name, e.g. "apache-2.2.13"). */ static int -pkg_backup(char *name) +pkg_backup(char *name, char *pkg_file) { - char pkg_file[PATH_MAX]; - if (!isinstalledpkg(name)) { warnx("Package not installed: %s", name); return (-1); @@ -231,18 +229,51 @@ /* + * Rudely overwrites metadata files in the package given by target_pkg_name + * with the ones in sourcedir referenced by package metadata pkg. + */ +static int +pkg_install_metadata(char *sourcedir, Package *pkg, char *target_pkg_name) +{ + PackingList pli; + char sourcef[PATH_MAX], destf[PATH_MAX]; + + pli = pkg->head; + while (pli != NULL) { + if (pli->type == PLIST_FILE && pli->name[0] == '+') { + snprintf(sourcef, PATH_MAX, "%s/%s", sourcedir, + pli->name); + if (access(sourcef, R_OK) != 0) { + warn("Cannot access file: %s", sourcef); + return (-1); + } + snprintf(destf, PATH_MAX, "%s/%s/%s", LOG_DIR, + target_pkg_name, pli->name); + if (copy_file_absolute(sourcef, destf) != 0) { + warn("Cannot copy %s to %s", sourcef, destf); + return (-1); + } + } + pli = pli->next; + } + return (0); +} + + +/* * Apply patch command */ void perform_applypatch() { - unsigned int err_count, n_patched_files, i; char fpatch[PATH_MAX], dpatch[PATH_MAX], tmp[PATH_MAX], pext[10]; + char backup_pkg[PATH_MAX]; struct pkgxjob xpatch; struct pkg_patch pp; Package pkg_live, pkg_new; struct pplist *pl; FILE **fpvect; + unsigned int err_count, n_patched_files, i; if (argc < 1) errx(1, "Expecting argument: patch filename"); @@ -351,7 +382,7 @@ errx(1, "Found %u errors. Cannot continue.", err_count); /* Step 4 - backup the existing package */ - if (pkg_backup(pp.source) != 0) + if (pkg_backup(pp.source, backup_pkg) != 0) err(1, "Cannot backup package: %s", pp.source); /* @@ -449,14 +480,78 @@ } /* Step 6 - apply other classes - files to add, remove, dirs to rmdir */ STAILQ_FOREACH(pl, &pp.pp_add, linkage) { + char livefile[PATH_MAX]; + + snprintf(tmp, PATH_MAX, "%s/%s", dpatch, pl->filename); + if (pkg_to_live_filename(livefile, pl->filename, &pkg_new, + "pp_add2") != 0) { + warnx("Cannot resolve %s in new pkg", pl->filename); + goto error_cleanup; + } + if (copy_file_absolute(tmp, livefile) != 0) { + warn("Cannot copy %s to %s", tmp, livefile); + goto error_cleanup; + } } STAILQ_FOREACH(pl, &pp.pp_remove, linkage) { + if (pkg_to_live_filename(tmp, pl->filename, &pkg_live, + "pp_remove2") != 0) { + warnx("Cannot resolve %s on live system", pl->filename); + goto error_cleanup; + } + if (unlink(tmp) != 0) { + warn("Cannot unlink: %s -- continuing", tmp); + /* goto error_cleanup; */ + } } STAILQ_FOREACH(pl, &pp.pp_rmdir, linkage) { + if (pkg_to_live_dirname(tmp, pl->filename, &pkg_live, + "pp_rmdir2") != 0) { + warnx("Cannot resolve directory %s on live system", + pl->filename); + } + if (rmdir(tmp) != 0) { + warn("Cannot rmdir: %s -- continuing", tmp); + /* goto error_cleanup; */ + } + } + /* + * Step 7 - fixup metadata: copy new metadata over the old, then rename + * the pkgdb directory. + */ + if (pkg_install_metadata(dpatch, &pkg_new, pp.source) != 0) { + warn("Cannot install new metadata for %s", pp.target); + goto error_cleanup; + } else { + char newpkgdir[PATH_MAX]; + + snprintf(tmp, PATH_MAX, "%s/%s", LOG_DIR, pp.source); + snprintf(newpkgdir, PATH_MAX, "%s/%s", LOG_DIR, pp.target); + if (rename(tmp, newpkgdir) != 0) { + warn("Cannot rename %s to %s", tmp, newpkgdir); + goto error_cleanup; + } } - /* Step 7 - fixup metadata */ + /* Plaudite, amici, comoedia finita est. */ return; error_cleanup: - /* Remove temp patch files, restore backed-up package */ + /* Remove temp patch files, restore backed-up package. */ warnx("Error detected! Rolling back package."); + /* Remove any temp patch files */ + STAILQ_FOREACH(pl, &pp.pp_patch, linkage) { + if (pkg_to_live_filename(tmp, pl->filename, &pkg_new, + "pp_patch rollback") == 0) { + strncat(tmp, pext, PATH_MAX); + if (access(tmp, F_OK) == 0) + if (unlink(tmp) != 0) + warn("Cannot unlink %s", tmp); + } + } + /* Obliterate old package */ + if (vsystem("%s -f %s", _PATH_PKG_DELETE, pp.source) != 0) + printf("pkg_delete on %s failed.\n", pp.source); + if (vsystem("%s -F %s", _PATH_PKG_ADD, backup_pkg) != 0) { + printf("pkg_add on %s failed!\n", backup_pkg); + err(1, "Critical! Package rollback probably failed!"); + } } ==== //depot/projects/soc2010/pkg_patch/src/patch/applypatch.h#8 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.c#17 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/hashjob.h#17 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/main.c#18 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.c#16 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/mkpatch.h#16 (text+ko) ==== ==== //depot/projects/soc2010/pkg_patch/src/patch/pkg_patch.h#16 (text+ko) ==== @@ -32,6 +32,12 @@ #ifndef _PATH_PKG_CREATE #define _PATH_PKG_CREATE "/usr/sbin/pkg_create" #endif +#ifndef _PATH_PKG_DELETE +#define _PATH_PKG_DELETE "/usr/sbin/pkg_delete" +#endif +#ifndef _PATH_PKG_ADD +#define _PATH_PKG_ADD "/usr/sbin/pkg_add" +#endif #ifndef PKG_FORMAT_EXT #define PKG_FORMAT_EXT "tbz" ==== //depot/projects/soc2010/pkg_patch/src/patch/support.c#15 (text+ko) ==== @@ -314,10 +314,6 @@ int copy_file_absolute(char *from, char *to) { - char *buf; - const ssize_t bufsize = 256*1024; - ssize_t bs; - int fdfrom, fdto; struct stat st; if (lstat(from, &st) != 0) @@ -327,37 +323,17 @@ char tmp[PATH_MAX]; if (readlink(from, tmp, PATH_MAX) < 0) - return (errno); + return (-errno); if (symlink(tmp, to) < 0) - return (errno); + return (-errno); return (0); } - fdfrom = open(from, O_RDONLY); - if (fdfrom < 0) - return (errno); - fdto = open(to, O_CREAT | O_WRONLY | O_TRUNC); - if (fdto < 0) - return (errno); - buf = malloc(bufsize); - if (buf == NULL) - return (ENOMEM); - while (1) { - bs = read(fdfrom, buf, bufsize); - if (bs < 0) - err(1, "read() failure"); - else if (bs > 0) - if (write(fdto, buf, bs) != bs) - err(1, "write() failure"); - if (bs == 0) - break; - } - free(buf); - close(fdto); - close(fdfrom); + if (cp(from, to) != 0) + return (-errno); if (copy_file_attrs(from, &st, to) != 0) - return (errno); + return (-errno); return (0); } From owner-p4-projects@FreeBSD.ORG Mon Jun 28 13:26:00 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C32351065670; Mon, 28 Jun 2010 13:26:00 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8746F106564A for ; Mon, 28 Jun 2010 13:26:00 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 74A4F8FC12 for ; Mon, 28 Jun 2010 13:26:00 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5SDQ0Kn024033 for ; Mon, 28 Jun 2010 13:26:00 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5SDQ0xj024031 for perforce@freebsd.org; Mon, 28 Jun 2010 13:26:00 GMT (envelope-from afiveg@FreeBSD.org) Date: Mon, 28 Jun 2010 13:26:00 GMT Message-Id: <201006281326.o5SDQ0xj024031@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180293 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 13:26:01 -0000 http://p4web.freebsd.org/@@180293?ac=10 Change 180293 by afiveg@cottonmouth on 2010/06/28 13:25:08 - Time stamping in delayed interrupt function added - new scripts for installing and loading thw whole ringmap Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#13 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#11 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#12 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#10 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#16 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#16 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#1 add .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#1 add .. //depot/projects/soc2010/ringmap/tests/libpcap/Makefile#2 edit .. //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#3 edit .. //depot/projects/soc2010/ringmap/tests/libpcap/test_pcap.c#3 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#5 (text+ko) ==== @@ -32,12 +32,6 @@ #include "../../sys/net/ringmap.h" -/* Driver Kernel object file id */ -// int if_em_ko_fileid = -1; - -/* to_ms parameter of pcap */ -// int fiveg_to_ms = 0; - /* File descriptor of fiveg_cdev */ int ringmap_cdev_fd = -1; @@ -46,9 +40,6 @@ int init_mmapped_capturing(const char *device, pcap_t *); void uninit_mmapped_capturing(pcap_t *); int pcap_read_ringmap(pcap_t *, int , pcap_handler , u_char *); -//int ringmap_stats(pcap_t *p, struct pcap_stat *ps); -//void ringmap_enable_capturing(); -// void ringmap_disable_capturing(); /* @@ -358,11 +349,11 @@ curr_slot = R_MODULO(SW_TAIL(ring) + 1); - mb = (struct mbuf *)ring->slot[curr_slot].mbuf.user; + mb = (struct mbuf *)U_MBUF(ring, curr_slot); pkthdr.ts = ring->slot[curr_slot].ts; pkthdr.caplen = pkthdr.len = mb->m_len; - datap = (caddr_t)ring->slot[curr_slot].packet.user; + datap = (caddr_t)U_PACKET(ring, curr_slot); (*callback)(user, &pkthdr, datap); @@ -415,7 +406,7 @@ printf("Number of interrupts: %llu\n", p->ring->interrupts_counter); printf("Packets per Interrupt: %llu\n", - (((unsigned long long )p->ring->pkt_counter) / p->ring->interrupts_counter)); + (((unsigned long long )p->ring->pkt_counter) / (p->ring->interrupts_counter))); return (err); } ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#13 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#11 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#12 (text+ko) ==== @@ -90,7 +90,7 @@ #ifdef RINGMAP_TIMESTAMP - + getmicrotime(&adapter->rm->ring->last_ts); #endif RINGMAP_INTR(end); ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#10 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#16 (text+ko) ==== @@ -61,27 +61,29 @@ * Character Device for access on if_em driver structures */ static struct cdevsw ringmap_devsw = { - /* version */ .d_version = D_VERSION, - /* open */ .d_open = ringmap_open, - /* close */ .d_close = ringmap_close, - /* ioctl */ .d_ioctl = ringmap_ioctl, - /* mmap */ .d_mmap = ringmap_mmap, - /* name */ .d_name = "ringmap_cdev" + .d_version = D_VERSION, + .d_open = ringmap_open, + .d_close = ringmap_close, + .d_ioctl = ringmap_ioctl, + .d_mmap = ringmap_mmap, + .d_name = "ringmap_cdev" }; struct device_type supported_devices[] = { - { 0x1079, 8254 }, /* 8254GB, COPPER, Dual Port */ - { 0x105E, 8257 }, /* 82571EB, COPPER, PCIe Dual Port */ + /* PCI ID, Controller */ + + { 0x1079 , 8254 }, /* 8254GB, COPPER, Dual Port */ + { 0x105E , 8257 }, /* 82571EB, COPPER, PCIe Dual Port */ { 0, 0} /* last entry */ }; /* * If pci_dev_id is supported by ringmap, then controller_type related to this * pci_dev_id will be returned. Look for device_type structure in ringmap.h! - * Now only 8254* and 8257* controllers are supported. The list of supported - * controllers doesn't include all of them, but only the controllers that I've - * tested. + * Im -curent branch only 8254* controllers are supported. The list of + * supported controllers doesn't include all of them, but only the controllers + * that I've tested. */ int is_supported (unsigned int pci_dev_id) @@ -109,9 +111,8 @@ case 8254: RINGMAP_FUNC_DEBUG(Controller Type: 8254); - /* Set ringmap pointer in the drivrs structure of adapter */ rm->funcs->set_ringmap_to_adapter = - rm_8254_set_ringmap_to_adapter; + rm_8254_set_ringmap_to_adapter; rm->funcs->enable_intr = rm_8254_enable_intr; rm->funcs->disable_intr = rm_8254_disable_intr; rm->funcs->init_slots = rm_8254_init_slots; ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#16 (text+ko) ==== @@ -37,6 +37,9 @@ /* Enable/Disable Transiv. If 0, then the adapter will only receive pkts */ #define RINGMAP_TX_ENABLE 0 +/* 1 - enable time stamping in the driver */ +#define RINGMAP_TIMESTAMP 1 + struct address { bus_addr_t phys; @@ -90,7 +93,7 @@ * kernrp - ring HEAD. Should be changed ONLY in driver. And should be * synchronized with the adapter-ring-HEAD register. Adapter increments * the value in its HEAD-register after storing the incomming packets - * in the RAM. The driver shoud in the ISR check the value in the + * in the RAM. The driver should in the ISR check the value in the * adapter-HEAD-register and set this value in kernrp. */ unsigned int volatile kernrp; @@ -141,6 +144,8 @@ */ unsigned long long pkt_counter; + struct timeval last_ts; + /* Array of slots */ struct ring_slot slot[SLOTS_NUMBER]; }; @@ -325,6 +330,18 @@ #define TAIL_PACKET(ringp) \ TAIL_SLOT(ringp).packet +#define U_MBUF(ringp, i) \ + RING_SLOT((ringp), (i)).mbuf.user + +#define K_MBUF(ringp, i) \ + RING_SLOT((ringp), (i)).mbuf.kern + +#define U_PACKET(ringp, i) \ + RING_SLOT((ringp), (i)).packet.user + +#define K_PACKET(ringp, i) \ + RING_SLOT((ringp), (i)).packet.kern + /* * DEBUG OUTPUT */ @@ -401,3 +418,5 @@ + + ==== //depot/projects/soc2010/ringmap/tests/libpcap/Makefile#2 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#3 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/libpcap/test_pcap.c#3 (text+ko) ==== From owner-p4-projects@FreeBSD.ORG Mon Jun 28 18:14:16 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 597A61065673; Mon, 28 Jun 2010 18:14:16 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DB99106566C for ; Mon, 28 Jun 2010 18:14:16 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 0BC3B8FC16 for ; Mon, 28 Jun 2010 18:14:16 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5SIEFVN061454 for ; Mon, 28 Jun 2010 18:14:15 GMT (envelope-from gpf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5SIEFO1061452 for perforce@freebsd.org; Mon, 28 Jun 2010 18:14:15 GMT (envelope-from gpf@FreeBSD.org) Date: Mon, 28 Jun 2010 18:14:15 GMT Message-Id: <201006281814.o5SIEFO1061452@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gpf@FreeBSD.org using -f From: Efstratios Karatzas To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180298 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 18:14:16 -0000 http://p4web.freebsd.org/@@180298?ac=10 Change 180298 by gpf@gpf_desktop on 2010/06/28 18:13:20 - added new audit events for nfsv4 specific operations. - while I'm here, changed the classes that some nfs specific events are mapped to. Still not 100% sure about the mapping of events to classes but this is something that can wait. - altered the audit_nfs_enter() interface() so that we can support nfsv4. Now, it may also be possible to keep track of the nfs protocol of the rpc that we are auditing. Not sure if this can be done for the current nfs server but certainly for the new experimental server. - a few trivial changes such as renaming events Affected files ... .. //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/etc/audit_event#3 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/bsm/audit_kevents.h#4 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdkrpc.c#3 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdsocket.c#8 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/nfsserver/nfs_srvkrpc.c#6 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit.c#7 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit.h#6 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit_bsm.c#10 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit_private.h#3 edit Differences ... ==== //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/etc/audit_event#3 (text) ==== @@ -362,30 +362,57 @@ # # NFS-specific kernel events # -2000:AUE_NFS_NULL:nfsrv_null():no +2000:AUE_NFS_NULL:nfsrv_null():ot 2001:AUE_NFS_GETATTR:nfsrv_getattr():fa 2002:AUE_NFS_SETATTR:nfsrv_setattr():fm -2003:AUE_NFS_LOOKUP:nfsrv_lookup():ot -2004:AUE_NFS_ACCESS:nfsrv3_access():fa +2003:AUE_NFS_LOOKUP:nfsrv_lookup():fa,ad +2004:AUE_NFS_ACCESS:nfsrv_access():fa 2005:AUE_NFS_READLINK:nfsrv_readlink():fr 2006:AUE_NFS_READ:nfsrv_read():fr 2007:AUE_NFS_WRITE:nfsrv_write():fw -2008:AUE_NFS_CREATE:nfsrv_create():fc -2009:AUE_NFS_MKDIR:nfsrv_mkdir():fc -2010:AUE_NFS_SYMLINK:nfsrv_symlink():fc -2011:AUE_NFS_MKNODE:nfsrv_mknod():fc +2008:AUE_NFS_CREATE:nfsrv_create():fc,ad +2009:AUE_NFS_MKDIR:nfsrv_mkdir():fc,ad +2010:AUE_NFS_SYMLINK:nfsrv_symlink():fc,ad +2011:AUE_NFS_MKNOD:nfsrv_mknod():fc,ad 2012:AUE_NFS_REMOVE:nfsrv_remove():fd 2013:AUE_NFS_RMDIR:nfsrv_rmdir():fd 2014:AUE_NFS_RENAME:nfsrv_rename():fc,fd 2015:AUE_NFS_LINK:nfsrv_link():fc 2016:AUE_NFS_READDIR:nfsrv_readdir():fr -2017:AUE_NFS_READDIR_PLUS:nfsrv_readdirplus():fr +2017:AUE_NFS_READDIR_PLUS:nfsrv_readdirplus():fr,ad 2018:AUE_NFS_STATFS:nfsrv_statfs():fa 2019:AUE_NFS_FSINFO:nfsrv_fsinfo():ot -2020:AUE_NFS_PATHCONF:nfsrv_pathconf():ot -2021:AUE_NFS_COMMIT:nfsrv_commit():ot +2020:AUE_NFS_PATHCONF:nfsrv_pathconf():fa +2021:AUE_NFS_COMMIT:nfsrv_commit():fw 2022:AUE_NFS_NOOP:nfsrv_noop():no # +# NFSv4 specific RPC events +# +2023:AUE_NFS_CLOSE:nfsrv_close():cl +2024:AUE_NFS_DELEGPURGE:nfsrv_delegpurge():ad +2025:AUE_NFS_DELEGRETURN:nfsrv_delegreturn():ad +2026:AUE_NFSv4_GETFH:nfsrv_getfh():ad +2027:AUE_NFS_LOCK:nfsrv_lock():fm +2028:AUE_NFS_LOCKT:nfsrv_lockt():fm +2029:AUE_NFS_LOCKU:nfsrv_locku():fm +2030:AUE_NFS_LOOKUPP:nfsrv_lockupp():fa,ad +2031:AUE_NFS_NVERIFY:nfsrv_nverify():fa +2032:AUE_NFS_OPEN:nfsrv_open():fa +2033:AUE_NFS_OPENATTR:nfsrv_openattr():fa +2034:AUE_NFS_OPENCONFIRM:nfsrv_openconfirm():fa +2035:AUE_NFS_OPENDOWNGRADE:nfsrv_opendowngrade():fm +2036:AUE_NFS_PUTFH:nfsrv_putfh():ad +2037:AUE_NFS_PUTPUBFH:nfsrv_putpubfh():ad +2038:AUE_NFS_PUTROOTFH:nfsrv_rootfh():ad +2039:AUE_NFS_RENEW:nfsrv_renew():ad +2040:AUE_NFS_RESTOREFH:nfsrv_restorefh():ad +2041:AUE_NFS_SAVEFH:nfsrv_savefh():ad +2042:AUE_NFS_SECINFO:nfsrv_secinfo():ot +2043:AUE_NFS_SETCLIENTID:nfsrv_setclientid():aa +2044:AUE_NFS_SETCLIENTIDCFRM:nfsrv_setclientidcfrm():aa +2045:AUE_NFS_VERIFY:nfsrv_verify():fa +2046:AUE_NFS_RELEASELCKOWN:nfsrv_releaselckown():ad +# # OpenBSM-specific kernel events. # 43001:AUE_GETFSSTAT:getfsstat(2):fa ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/bsm/audit_kevents.h#4 (text) ==== @@ -398,7 +398,7 @@ #define AUE_NFS_CREATE 2008 #define AUE_NFS_MKDIR 2009 #define AUE_NFS_SYMLINK 2010 -#define AUE_NFS_MKNODE 2011 +#define AUE_NFS_MKNOD 2011 #define AUE_NFS_REMOVE 2012 #define AUE_NFS_RMDIR 2013 #define AUE_NFS_RENAME 2014 @@ -410,6 +410,31 @@ #define AUE_NFS_PATHCONF 2020 #define AUE_NFS_COMMIT 2021 #define AUE_NFS_NOOP 2022 +/* NFSv4 specific RPC events */ +#define AUE_NFS_CLOSE 2023 +#define AUE_NFS_DELEGPURGE 2024 +#define AUE_NFS_DELEGRETURN 2025 +#define AUE_NFSv4_GETFH 2026 +#define AUE_NFS_LOCK 2027 +#define AUE_NFS_LOCKT 2028 +#define AUE_NFS_LOCKU 2029 +#define AUE_NFS_LOOKUPP 2030 +#define AUE_NFS_NVERIFY 2031 +#define AUE_NFS_OPEN 2032 +#define AUE_NFS_OPENATTR 2033 +#define AUE_NFS_OPENCONFIRM 2034 +#define AUE_NFS_OPENDOWNGRADE 2035 +#define AUE_NFS_PUTFH 2036 +#define AUE_NFS_PUTPUBFH 2037 +#define AUE_NFS_PUTROOTFH 2038 +#define AUE_NFS_RENEW 2039 +#define AUE_NFS_RESTOREFH 2040 +#define AUE_NFS_SAVEFH 2041 +#define AUE_NFS_SECINFO 2042 +#define AUE_NFS_SETCLIENTID 2043 +#define AUE_NFS_SETCLIENTIDCFRM 2044 +#define AUE_NFS_VERIFY 2045 +#define AUE_NFS_RELEASELCKOWN 2046 /* * Audit event identifiers added as part of OpenBSM, generally corresponding ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdkrpc.c#3 (text+ko) ==== @@ -234,7 +234,7 @@ cacherep = nfs_proc(&nd, rqst->rq_xid, xprt->xp_socket, xprt->xp_sockref, &rp); } else { - AUDIT_NFS_ENTER(NFSPROC_NULL, nd.nd_cred, curthread); + AUDIT_NFS_ENTER(NFSPROC_NULL, nd.nd_cred, curthread, ND_NFSV3); AUDIT_NFS_EXIT(0, curthread); NFSMGET(nd.nd_mreq); nd.nd_mreq->m_len = 0; ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdsocket.c#8 (text+ko) ==== @@ -362,6 +362,7 @@ mount_t mp = NULL; struct nfsrvfh fh; struct nfsexstuff nes; + int nfsprot; /* * Get a locked vnode for the first file handle @@ -435,8 +436,11 @@ nfsrvd_compound(nd, isdgram, p); printf("compound rpc exit\n"); } else { - printf("non compound rpc %d\n", nd->nd_procnum); - AUDIT_NFS_ENTER(nd->nd_procnum, nd->nd_cred, curthread); + if (nd->nd_flag & ND_NFSV2) + nfsprot = ND_NFSV2; + else + nfsprot = ND_NFSV3; + AUDIT_NFS_ENTER(nd->nd_procnum, nd->nd_cred, curthread, nfsprot); if (nd->nd_nam != NULL) AUDIT_ARG_SOCKADDR_IN((struct sockaddr_in *)nd->nd_nam); if (nfs_retfh[nd->nd_procnum] == 1) { ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/nfsserver/nfs_srvkrpc.c#6 (text+ko) ==== @@ -352,7 +352,7 @@ } nfsrvstats.srvrpccnt[nd.nd_procnum]++; - AUDIT_NFS_ENTER(procnum, nd.nd_cr, td); + AUDIT_NFS_ENTER(procnum, nd.nd_cr, td, ND_NFSV3); AUDIT_ARG_SOCKADDR_IN((struct sockaddr_in *)nd.nd_nam); error = proc(&nd, NULL, &mrep); AUDIT_NFS_EXIT(nd.nd_repstat, td); ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit.c#7 (text) ==== @@ -596,7 +596,7 @@ * Convert an NFS RPC procedure number to an audit event */ int -audit_nfs_proc_to_event(unsigned int proc, au_event_t *event) +audit_nfs_proc_to_event(unsigned int proc, au_event_t *event, int nfsprot) { au_event_t nfsv3toevent[] = { AUE_NFS_NULL, @@ -610,7 +610,7 @@ AUE_NFS_CREATE, AUE_NFS_MKDIR, AUE_NFS_SYMLINK, - AUE_NFS_MKNODE, + AUE_NFS_MKNOD, AUE_NFS_REMOVE, AUE_NFS_RMDIR, AUE_NFS_RENAME, @@ -621,17 +621,73 @@ AUE_NFS_FSINFO, AUE_NFS_PATHCONF, AUE_NFS_COMMIT, - AUE_NFS_NOOP, + AUE_NFS_NOOP, + }; + au_event_t nfsv4toevent[] = { + AUE_NFS_NULL, + AUE_NFS_NOOP, + AUE_NFS_NOOP, + AUE_NFS_ACCESS, + AUE_NFS_CLOSE, + AUE_NFS_COMMIT, + AUE_NFS_CREATE, + AUE_NFS_DELEGPURGE, + AUE_NFS_DELEGRETURN, + AUE_NFS_GETATTR, + AUE_NFSv4_GETFH, + AUE_NFS_LINK, + AUE_NFS_LOCK, + AUE_NFS_LOCKT, + AUE_NFS_LOCKU, + AUE_NFS_LOOKUP, + AUE_NFS_LOOKUPP, + AUE_NFS_NVERIFY, + AUE_NFS_OPEN, + AUE_NFS_OPENATTR, + AUE_NFS_OPENCONFIRM, + AUE_NFS_OPENDOWNGRADE, + AUE_NFS_PUTFH, + AUE_NFS_PUTPUBFH, + AUE_NFS_PUTROOTFH, + AUE_NFS_READ, + AUE_NFS_READDIR, + AUE_NFS_READLINK, + AUE_NFS_REMOVE, + AUE_NFS_RENAME, + AUE_NFS_RENEW, + AUE_NFS_RESTOREFH, + AUE_NFS_SAVEFH, + AUE_NFS_SECINFO, + AUE_NFS_SETATTR, + AUE_NFS_SETCLIENTID, + AUE_NFS_SETCLIENTIDCFRM, + AUE_NFS_VERIFY, + AUE_NFS_WRITE, + AUE_NFS_RELEASELCKOWN, }; static int nfs_v3nprocs = sizeof(nfsv3toevent) / sizeof(au_event_t); - - if (proc < nfs_v3nprocs) { - *event = nfsv3toevent[proc]; - return 0; + static int nfs_v4nprocs = sizeof(nfsv4toevent) / sizeof(au_event_t); + int error = 0; + + switch (nfsprot) { + case ND_NFSV4: + if (proc < nfs_v4nprocs) + *event = nfsv4toevent[proc]; + else + error = EINVAL; + break; + /* FALLTHROUGH */ + default: + case ND_NFSV2: + case ND_NFSV3: + if (proc < nfs_v3nprocs) + *event = nfsv3toevent[proc]; + else + error = EINVAL; + break; } - else { - return EINVAL; - } + + return error; } /* @@ -642,7 +698,7 @@ * audit_new() will fill in basic thread/credential properties. */ void -audit_nfs_enter(unsigned int proc, struct ucred *user_cr, struct thread *td) +audit_nfs_enter(unsigned int proc, struct ucred *user_cr, struct thread *td, int nfsprot) { struct au_mask *aumask; au_class_t class; @@ -654,7 +710,7 @@ KASSERT((td->td_pflags & TDP_AUDITREC) == 0, ("audit_nfs_enter: TDP_AUDITREC set")); - error = audit_nfs_proc_to_event(proc, &event); + error = audit_nfs_proc_to_event(proc, &event, nfsprot); if (error) { td->td_ar = NULL; return; ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit.h#6 (text) ==== @@ -59,7 +59,7 @@ void audit_syscall_enter(unsigned short code, struct thread *td); void audit_syscall_exit(int error, struct thread *td); -void audit_nfs_enter(unsigned int proc, struct ucred *user_cr, struct thread *td); +void audit_nfs_enter(unsigned int proc, struct ucred *user_cr, struct thread *td, int nfsprot); void audit_nfs_exit(int error, struct thread *td); /* @@ -321,9 +321,9 @@ audit_syscall_exit(error, td); \ } while (0) -#define AUDIT_NFS_ENTER(proc, user_cr, td) do { \ +#define AUDIT_NFS_ENTER(proc, user_cr, td, nfsprot) do { \ if (audit_enabled) { \ - audit_nfs_enter(proc, user_cr, td); \ + audit_nfs_enter(proc, user_cr, td, nfsprot); \ } \ } while (0) @@ -381,7 +381,7 @@ #define AUDIT_SYSCLOSE(p, fd) -#define AUDIT_NFS_ENTER(proc, user_cr, td) +#define AUDIT_NFS_ENTER(proc, user_cr, td, prot) #define AUDIT_NFS_EXIT(error, td) #endif /* AUDIT */ ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit_bsm.c#10 (text) ==== @@ -1583,7 +1583,7 @@ case AUE_NFS_CREATE: case AUE_NFS_MKDIR: - case AUE_NFS_MKNODE: + case AUE_NFS_MKNOD: if (ARG_IS_VALID(kar, ARG_MODE)) { tok = au_to_arg32(3, "mode", ar->ar_arg_mode); kau_write(rec, tok); ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit_private.h#3 (text) ==== @@ -324,9 +324,13 @@ struct kaudit_record *audit_new(int event, struct thread *td); /* - * NFS specific functions + * NFS specific stuff */ -int audit_nfs_proc_to_event(unsigned int proc, au_event_t *event); +int audit_nfs_proc_to_event(unsigned int proc, au_event_t *event, int nfsprot); + +#define ND_NFSV2 0x00000004 +#define ND_NFSV3 0x00000008 +#define ND_NFSV4 0x00000010 /* * Functions relating to the conversion of internal kernel audit records to From owner-p4-projects@FreeBSD.ORG Mon Jun 28 18:33:38 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D8ADF1065672; Mon, 28 Jun 2010 18:33:37 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B38E106564A for ; Mon, 28 Jun 2010 18:33:37 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 88B558FC12 for ; Mon, 28 Jun 2010 18:33:37 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5SIXblD063036 for ; Mon, 28 Jun 2010 18:33:37 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5SIXbHw063034 for perforce@freebsd.org; Mon, 28 Jun 2010 18:33:37 GMT (envelope-from afiveg@FreeBSD.org) Date: Mon, 28 Jun 2010 18:33:37 GMT Message-Id: <201006281833.o5SIXbHw063034@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180301 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 18:33:38 -0000 http://p4web.freebsd.org/@@180301?ac=10 Change 180301 by afiveg@cottonmouth on 2010/06/28 18:33:18 bugfix: ringmap_open(): after contigmalloc the pointer to the freed memory region should be set to NULL Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#4 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_hw.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#14 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#12 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#13 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#11 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#17 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#17 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#2 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#2 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#6 (text+ko) ==== @@ -117,7 +117,14 @@ bus_addr_t nic_statspp, rspp; RINGMAP_FUNC_DEBUG(start); + + if ( p == NULL ){ + RINGMAP_ERROR(NULL pointer to the pcap structure); + return (-1); + } + p->ring = NULL; + /* Open mem device for mmaping of kernel memory regions in space of our process */ if ((devmem_fd = open("/dev/mem", O_RDWR)) == -1){ perror("/dev/mem"); @@ -262,6 +269,11 @@ RINGMAP_FUNC_DEBUG(start); + if ( (p == NULL) || (p->ring == NULL) ){ + RINGMAP_FUNC_DEBUG(NULL pointer. Debugging is needed!); + goto out; + } + for (i = 0; i < SLOTS_NUMBER; i++){ tmp_res = munmap((void *)p->ring->slot[i].mbuf.user, sizeof(struct mbuf)); @@ -293,6 +305,7 @@ perror("close()"); } +out: RINGMAP_FUNC_DEBUG(end); } @@ -348,6 +361,13 @@ } curr_slot = R_MODULO(SW_TAIL(ring) + 1); + if (!(ring->slot[curr_slot].is_ok)) { +#ifdef __RINGMAP_DEB + printf("Slot %d was not accepted by driver!\n"); +#endif + goto out; + } + ring->cur_slot_user = curr_slot; mb = (struct mbuf *)U_MBUF(ring, curr_slot); @@ -357,6 +377,10 @@ (*callback)(user, &pkthdr, datap); +out: + ring->slot[curr_slot].is_ok = 0; + ring->slot[curr_slot].filtered = 0; + INC_TAIL(ring); ring->pkt_counter++; ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_hw.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#14 (text+ko) ==== @@ -1384,7 +1384,7 @@ if (ifp->if_drv_flags & IFF_DRV_RUNNING) { #ifdef RINGMAP if ((adapter->rm != NULL) && (adapter->rm->ring != NULL)) - adapter->rm->funcs->delayed_interrupt(context); + adapter->rm->funcs->delayed_isr(context); #endif if (lem_rxeof(adapter, adapter->rx_process_limit) != 0) taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); @@ -1448,7 +1448,7 @@ (adapter->rm->ring != NULL) && (adapter->rm->ring->td != NULL)) { - adapter->rm->funcs->interrupt(arg); + adapter->rm->funcs->isr(arg); } #endif @@ -3577,6 +3577,12 @@ if (accept_frame) { +#ifdef RINGMAP + if ((adapter->rm != NULL) && (adapter->rm->ring != NULL)) + adapter->rm->funcs->delayed_isr_per_packet(adapter->rm->ring, + i); +#endif + #ifndef RINGMAP /* Do not allocate memory for new mbufs and packets. Work in ring */ if (lem_get_buf(adapter, i) != 0) { ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#12 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#13 (text+ko) ==== @@ -29,12 +29,29 @@ void rm_8254_delayed_interrupt(void *); int rm_8254_print_ring_pointers(struct adapter *); void rm_8254_sync_head_tail(device_t, struct ring *); +void rm_8254_delayed_interrupt_per_packet(struct ring *, int); extern devclass_t em_devclass; extern void lem_enable_intr(struct adapter *); extern void lem_disable_intr(struct adapter *); +void +rm_8254_delayed_interrupt_per_packet(struct ring *ring, int slot_num) +{ + RINGMAP_INTR(start); + ring->cur_slot_kern = slot_num; + ring->slot[slot_num].is_ok = 1; + ring->slot[slot_num].intr_num = ring->interrupts_counter; + +#ifdef RINGMAP_TIMESTAMP + ring->slot[slot_num].ts.tv_sec = ring->last_ts.tv_sec; + ring->slot[slot_num].ts.tv_usec = ring->last_ts.tv_usec; +#endif + + RINGMAP_INTR(end); +} + /* * This function synchronize the tail and head hardware registers * with head and tail software varibles, that are visible from ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#11 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#17 (text+ko) ==== @@ -51,6 +51,8 @@ extern void rm_8254_interrupt(void *); extern void rm_8254_delayed_interrupt(void *); extern void rm_8254_sync_head_tail(device_t, struct ring *); +extern void rm_8254_delayed_interrupt_per_packet(struct ring *, int); + d_open_t ringmap_open; d_close_t ringmap_close; @@ -112,13 +114,15 @@ RINGMAP_FUNC_DEBUG(Controller Type: 8254); rm->funcs->set_ringmap_to_adapter = - rm_8254_set_ringmap_to_adapter; + rm_8254_set_ringmap_to_adapter; rm->funcs->enable_intr = rm_8254_enable_intr; rm->funcs->disable_intr = rm_8254_disable_intr; rm->funcs->init_slots = rm_8254_init_slots; - rm->funcs->interrupt = rm_8254_interrupt; + rm->funcs->isr = rm_8254_interrupt; + rm->funcs->delayed_isr = rm_8254_delayed_interrupt; + rm->funcs->delayed_isr_per_packet = + rm_8254_delayed_interrupt_per_packet; rm->funcs->sync_head_tail = rm_8254_sync_head_tail; - rm->funcs->delayed_interrupt = rm_8254_delayed_interrupt; get_ringmap_p = rm_8254_get_ringmap_p; get_device_p = rm_8254_get_device_p; @@ -256,7 +260,7 @@ rm = get_ringmap_p(get_device_p(cdev)); if (rm == NULL) { RINGMAP_ERROR(Null pointer to ringmap structure); - return (ENODEV); + return (EIO); } /** @@ -264,14 +268,14 @@ **/ if (!atomic_cmpset_int(&rm->open_cnt, 0, 1)){ RINGMAP_ERROR(Sorry! Can not open device more then one time!); - err = ENODEV; - goto end; + atomic_readandclear_int(&rm->open_cnt); + return (EIO); } if (rm->dev == NULL){ RINGMAP_ERROR(Null pointer to device structure of adapter); - err = ENODEV; - goto end; + atomic_readandclear_int(&rm->open_cnt); + return (EIO); } /* @@ -283,8 +287,9 @@ M_DEVBUF, M_ZERO, 0, -1L, PAGE_SIZE, 0); if (ring == NULL) { RINGMAP_ERROR(Can not allocate space for ring structure); - err = ENODEV; - goto end; + + atomic_readandclear_int(&rm->open_cnt); + return (EIO); } rm->ring = ring; @@ -304,19 +309,17 @@ if (rm->funcs->init_slots(rm->ring, rm->dev) == -1){ RINGMAP_ERROR(The ring is not initialized. Device will not be opened!); contigfree(rm->ring, sizeof(struct ring), M_DEVBUF); - err = ENODEV; + rm->ring = NULL; + + atomic_readandclear_int(&rm->open_cnt); + err = EIO; } rm->funcs->enable_intr(rm->dev); -end: - - atomic_readandclear_int(&rm->open_cnt); - RINGMAP_FUNC_DEBUG(end); return (err); - } ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#17 (text+ko) ==== @@ -66,6 +66,9 @@ /* 1 - if accepted by (bpf) filter */ int filtered; + /* 1 if accepted by driver and contains no errors */ + int is_ok; + /* * Next fields are for statistics: */ @@ -137,6 +140,9 @@ /* Counts number of hardware interrupts */ unsigned long long interrupts_counter; + unsigned int volatile cur_slot_kern; + unsigned int volatile cur_slot_user; + /* * Number of received packets. This variable should be changed only in * user-space. We want to count the packets, that was seen by user-space @@ -184,40 +190,47 @@ struct ringmap_functions { -/* - * Set pointer to the ringmap structure into the adapters - * driver structure. - */ + /* + * Set pointer to the ringmap structure into the adapters + * driver structure. + */ int (*set_ringmap_to_adapter)(device_t, struct ringmap*); -/* - * In some situations it is safe to disable - * interrupts on adapter. - */ + /* + * In some situations it is safe to disable + * interrupts on adapter. + */ void (*enable_intr)(device_t); void (*disable_intr)(device_t); -/* - * Initialize the ring slots with pointers to the - * mbufs, packets buffers and descriptors. - */ + /* + * Initialize the ring slots with pointers to the + * mbufs, packets buffers and descriptors. + */ int (*init_slots)(struct ring *, device_t); -/* - * This function should be calld from ISR. It should contain - * the very fast executable operations (don't sleep!). - */ - void (*interrupt)(void *); + /* + * This function should be calld from ISR. It should contain + * the very fast executable operations (don't sleep!). + */ + void (*isr)(void *); -/* - * This function should be calld from delayed interrupt - * function. It can contain operations that must not be - * very fast. - */ - void (*delayed_interrupt)(void *); + /* + * This function should be calld from delayed interrupt + * function. It can contain operations that must not be + * very fast. + */ + void (*delayed_isr)(void *); + /* + * The native driver should have cycle for checking + * the the packets that was transfered in the RAM from + * network adapter. The function delayed_isr_per_packet() + * should be called from this cycle, so it will be called + * per packet. + */ + void (*delayed_isr_per_packet)(struct ring *, int); - /* * This function synchronize the tail and head hardware registers * with head and tail software varibles, that are visible from @@ -365,7 +378,7 @@ #define ERR_PREFIX "--> RINGMAP ERROR: " #define WARN_PREFIX "--> RINGMAP WARN: " #define IOCTL_PREFIX "--> RINGMAP IOCTL: " -#define INTR_PREFIX "--> RINGMAP IOCTL: " +#define INTR_PREFIX "--> RINGMAP INTR: " #define RINGMAP_ERROR(x) \ printf(ERR_PREFIX "[%s]: " #x "\n", __func__); ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#2 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#2 (text+ko) ==== @@ -38,12 +38,12 @@ echo sleep 1 -sync echo -echo "===> Install ringmap-libpcap:" +echo "===> Install ringmap-libpcap:" && sleep 1 echo install_libpcap || { echo "Error by installing libpcap" ; exit 1 ; } echo +sync exit 0 From owner-p4-projects@FreeBSD.ORG Mon Jun 28 19:11:19 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 336A1106567A; Mon, 28 Jun 2010 19:11:19 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB6201065677 for ; Mon, 28 Jun 2010 19:11:18 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id D81448FC0C for ; Mon, 28 Jun 2010 19:11:18 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5SJBIO3066763 for ; Mon, 28 Jun 2010 19:11:18 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5SJBISA066761 for perforce@freebsd.org; Mon, 28 Jun 2010 19:11:18 GMT (envelope-from trasz@freebsd.org) Date: Mon, 28 Jun 2010 19:11:18 GMT Message-Id: <201006281911.o5SJBISA066761@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to trasz@freebsd.org using -f From: Edward Tomasz Napierala To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180302 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 19:11:19 -0000 http://p4web.freebsd.org/@@180302?ac=10 Change 180302 by trasz@trasz_victim on 2010/06/28 19:10:24 Make containers independent from HRL. Add "options HRL". Affected files ... .. //depot/projects/soc2009/trasz_limits/sys/compat/linux/linux_misc.c#11 edit .. //depot/projects/soc2009/trasz_limits/sys/compat/svr4/imgact_svr4.c#5 edit .. //depot/projects/soc2009/trasz_limits/sys/compat/svr4/svr4_filio.c#5 edit .. //depot/projects/soc2009/trasz_limits/sys/conf/NOTES#22 edit .. //depot/projects/soc2009/trasz_limits/sys/conf/options#20 edit .. //depot/projects/soc2009/trasz_limits/sys/fs/unionfs/union_subr.c#6 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/init_main.c#22 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#4 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_exit.c#19 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_fork.c#15 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#77 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_loginclass.c#18 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_prot.c#26 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#33 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/tty_pts.c#15 edit .. //depot/projects/soc2009/trasz_limits/sys/sys/loginclass.h#9 edit .. //depot/projects/soc2009/trasz_limits/sys/sys/resourcevar.h#19 edit .. //depot/projects/soc2009/trasz_limits/sys/vm/vm_map.c#14 edit .. //depot/projects/soc2009/trasz_limits/sys/vm/vm_unix.c#5 edit Differences ... ==== //depot/projects/soc2009/trasz_limits/sys/compat/linux/linux_misc.c#11 (text+ko) ==== @@ -35,7 +35,7 @@ #include #include #include -#include +#include #if defined(__i386__) #include #endif ==== //depot/projects/soc2009/trasz_limits/sys/compat/svr4/imgact_svr4.c#5 (text+ko) ==== @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include ==== //depot/projects/soc2009/trasz_limits/sys/compat/svr4/svr4_filio.c#5 (text+ko) ==== @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include ==== //depot/projects/soc2009/trasz_limits/sys/conf/NOTES#22 (text+ko) ==== @@ -1144,6 +1144,9 @@ options MAC_STUB options MAC_TEST +# Hierarchical Resource Limits +options HRL + ##################################################################### # CLOCK OPTIONS ==== //depot/projects/soc2009/trasz_limits/sys/conf/options#20 (text+ko) ==== @@ -853,3 +853,6 @@ # Flattened device tree options FDT opt_platform.h FDT_DTB_STATIC opt_platform.h + +# Hierarchical Resource Limits +HRL opt_hrl.h ==== //depot/projects/soc2009/trasz_limits/sys/fs/unionfs/union_subr.c#6 (text+ko) ==== @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include ==== //depot/projects/soc2009/trasz_limits/sys/kern/init_main.c#22 (text+ko) ==== @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD: src/sys/kern/init_main.c,v 1.310 2010/05/23 18:32:02 kib Exp $"); #include "opt_ddb.h" +#include "opt_hrl.h" #include "opt_init_path.h" #include @@ -498,8 +499,10 @@ #endif td->td_ucred = crhold(p->p_ucred); +#ifdef HRL /* Let the HRL know about the new process. */ hrl_proc_init(p); +#endif /* Create sigacts. */ p->p_sigacts = sigacts_alloc(); ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#4 (text+ko) ==== @@ -27,20 +27,18 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_hrl.h" + #include -#include #include #include #include #include -#include #include #include -#include #include #include #include -#include #include #include #include @@ -52,14 +50,19 @@ #include #include -extern struct mtx hrl_lock; +#ifdef HRL +#include +#endif + +struct mtx container_lock; +MTX_SYSINIT(container_lock, &container_lock, "container lock", MTX_RECURSE); /* XXX: Make it non-recurseable later. */ static void container_add(struct container *dest, const struct container *src) { int i; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); for (i = 0; i <= HRL_RESOURCE_MAX; i++) { KASSERT(dest->c_resources[i] >= 0, @@ -77,7 +80,7 @@ { int i; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); for (i = 0; i <= HRL_RESOURCE_MAX; i++) { KASSERT(dest->c_resources[i] >= 0, @@ -97,7 +100,7 @@ { int i; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); KASSERT(child != NULL, ("child != NULL")); KASSERT(parent != NULL, ("parent != NULL")); @@ -118,7 +121,7 @@ { int i; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); KASSERT(child != NULL, ("child != NULL")); KASSERT(parent != NULL, ("parent != NULL")); @@ -137,7 +140,7 @@ { int i; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); KASSERT(child != NULL, ("child != NULL")); for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) { @@ -166,18 +169,17 @@ { int i; - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); for (i = 0; i <= HRL_RESOURCE_MAX; i++) { if (container->c_resources[i] != 0) printf("destroying non-empty container: " - "%ju allocated for resource %s", - container->c_resources[i], - hrl_resource_name(i)); + "%ju allocated for resource %d", + container->c_resources[i], i); container->c_resources[i] = 0; } container_leave_parents(container); - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); } #ifdef DIAGNOSTIC @@ -190,7 +192,7 @@ int i, resource; struct container *parent; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); KASSERT(container != NULL, ("NULL container")); for (resource = 0; resource <= HRL_RESOURCE_MAX; resource++) { @@ -223,7 +225,7 @@ { int i; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); KASSERT(container != NULL, ("NULL container")); container->c_resources[resource] += amount; @@ -244,23 +246,24 @@ int hrl_alloc(struct proc *p, int resource, uint64_t amount) { - int error; #if 0 printf("hrl_alloc: allocating %ju of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); #endif - KASSERT(amount > 0, ("hrl_alloc: invalid amount for %s: %ju", - hrl_resource_name(resource), amount)); + KASSERT(amount > 0, ("hrl_alloc: invalid amount for resource %d: %ju", + resource, amount)); - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); +#ifdef HRL error = hrl_enforce_proc(p, resource, amount); if (error) { - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); return (error); } +#endif container_alloc_resource(&p->p_container, resource, amount); - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); return (0); } @@ -275,27 +278,28 @@ int hrl_allocated(struct proc *p, int resource, uint64_t amount) { - int error; int64_t diff; #if 0 printf("hrl_allocated: allocated %lld of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); #endif - KASSERT(amount >= 0, ("hrl_allocated: invalid amount for %s: %ju", - hrl_resource_name(resource), amount)); + KASSERT(amount >= 0, ("hrl_allocated: invalid amount for resource %d: %ju", + resource, amount)); - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); diff = amount - p->p_container.c_resources[resource]; +#ifdef HRL if (diff > 0) { error = hrl_enforce_proc(p, resource, diff); if (error) { - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); return (error); } } +#endif container_alloc_resource(&p->p_container, resource, diff); - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); return (0); } @@ -311,17 +315,17 @@ printf("hrl_free: freeing %lld of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); #endif - KASSERT(amount > 0, ("hrl_free: invalid amount for %s: %ju", - hrl_resource_name(resource), amount)); + KASSERT(amount > 0, ("hrl_free: invalid amount for resource %d: %ju", + resource, amount)); - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); KASSERT(amount <= p->p_container.c_resources[resource], - ("hrl_free: freeing %ju of %s, which is more than allocated " - "%ld for %s (pid %d)", amount, hrl_resource_name(resource), + ("hrl_free: freeing %ju of resource %d, which is more than allocated " + "%ld for %s (pid %d)", amount, resource, p->p_container.c_resources[resource], p->p_comm, p->p_pid)); container_alloc_resource(&p->p_container, resource, -amount); - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); } static int @@ -346,9 +350,9 @@ hrl_allocated(p, HRL_RESOURCE_COREDUMPSIZE, 0); hrl_allocated(p, HRL_RESOURCE_PTY, 0); - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); container_destroy(&p->p_container); - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); } /* @@ -363,7 +367,7 @@ PROC_LOCK(parent); PROC_LOCK(child); - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); /* * Create container for the child process and inherit containing @@ -384,7 +388,7 @@ parent->p_container.c_resources[i]); } - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); PROC_UNLOCK(child); PROC_UNLOCK(parent); } ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_exit.c#19 (text+ko) ==== @@ -66,7 +66,7 @@ #include #include /* for acct_process() function prototype */ #include -#include +#include #include #include #include ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_fork.c#15 (text+ko) ==== @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include #include ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#77 (text+ko) ==== @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_hrl.h" + #include #include #include @@ -52,6 +54,8 @@ #include #include +#ifdef HRL + #define HRF_DEFAULT 0 #define HRF_DONT_INHERIT 1 #define HRF_DONT_ACCUMULATE 2 @@ -116,7 +120,7 @@ static uma_zone_t hrl_rule_link_zone; static uma_zone_t hrl_rule_zone; -struct mtx hrl_lock; +extern struct mtx container_lock; static void hrl_compute_available(struct proc *p, int64_t (*availablep)[]); static int hrl_rule_fully_specified(const struct hrl_rule *rule); @@ -192,7 +196,7 @@ int64_t available = INT64_MAX; struct ucred *cred = p->p_ucred; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); resource = rule->hr_resource; switch (rule->hr_per) { @@ -231,7 +235,7 @@ { int64_t available; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); available = hrl_available_resource(p, rule); if (available >= amount) @@ -266,7 +270,7 @@ int should_deny = 0; char *buf; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); /* * XXX: Do this just before we start running on a CPU, not all the time. @@ -363,7 +367,7 @@ struct hrl_rule_link *link; struct hrl_rule *rule; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); for (i = 0; i <= HRL_RESOURCE_MAX; i++) (*availablep)[i] = INT64_MAX; @@ -509,9 +513,9 @@ link = uma_zalloc(hrl_rule_link_zone, M_WAITOK); link->hrl_rule = rule; - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); LIST_INSERT_HEAD(&container->c_rule_links, link, hrl_next); - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); } static int @@ -520,7 +524,7 @@ struct hrl_rule_link *link; KASSERT(hrl_rule_fully_specified(rule), ("rule not fully specified")); - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); link = uma_zalloc(hrl_rule_link_zone, M_NOWAIT); if (link == NULL) @@ -544,7 +548,7 @@ int removed = 0; struct hrl_rule_link *link, *linktmp; - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); LIST_FOREACH_SAFE(link, &container->c_rule_links, hrl_next, linktmp) { if (!hrl_rule_matches(link->hrl_rule, filter)) continue; @@ -554,7 +558,7 @@ uma_zfree(hrl_rule_link_zone, link); removed++; } - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); return (removed); } @@ -1210,7 +1214,7 @@ struct hrl_rule_link *link; struct sbuf *sb = (struct sbuf *)arg3; - mtx_assert(&hrl_lock, MA_OWNED); + mtx_assert(&container_lock, MA_OWNED); LIST_FOREACH(link, &container->c_rule_links, hrl_next) { if (!hrl_rule_matches(link->hrl_rule, filter)) @@ -1252,7 +1256,7 @@ sx_assert(&allproc_lock, SA_LOCKED); FOREACH_PROC_IN_SYSTEM(p) { - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); LIST_FOREACH(link, &p->p_container.c_rule_links, hrl_next) { /* * Non-process rules will be added to the buffer later. @@ -1265,14 +1269,14 @@ hrl_rule_to_sbuf(sb, link->hrl_rule); sbuf_printf(sb, ","); } - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); } - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); loginclass_container_foreach(hrl_get_rules_callback, filter, sb); ui_container_foreach(hrl_get_rules_callback, filter, sb); gi_container_foreach(hrl_get_rules_callback, filter, sb); - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); if (sbuf_overflowed(sb)) { sbuf_delete(sb); free(buf, M_HRL); @@ -1337,12 +1341,12 @@ sb = sbuf_new(NULL, buf, bufsize, SBUF_FIXEDLEN); KASSERT(sb != NULL, ("sbuf_new failed")); - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); LIST_FOREACH(link, &filter->hr_subject.hs_proc->p_container.c_rule_links, hrl_next) { hrl_rule_to_sbuf(sb, link->hrl_rule); sbuf_printf(sb, ","); } - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); if (sbuf_overflowed(sb)) { sbuf_delete(sb); free(buf, M_HRL); @@ -1443,14 +1447,14 @@ { struct ucred *cred = p->p_ucred; - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); container_create(&p->p_container); container_join(&p->p_container, &cred->cr_ruidinfo->ui_container); container_join(&p->p_container, &cred->cr_loginclass->lc_container); container_join(&p->p_container, &cred->cr_prison->pr_container); - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); } /* @@ -1475,7 +1479,7 @@ newpr = newcred->cr_prison; oldpr = p->p_ucred->cr_prison; - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); /* * Remove rules that are no longer applicable with the new ucred. @@ -1537,7 +1541,7 @@ container_join(&p->p_container, &newpr->pr_container); } - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); } /* @@ -1553,7 +1557,7 @@ PROC_LOCK(parent); PROC_LOCK(child); - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); /* * Go through limits applicable to the parent and assign them to the child. @@ -1576,7 +1580,7 @@ } } - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); PROC_UNLOCK(child); PROC_UNLOCK(parent); } @@ -1589,14 +1593,14 @@ { struct hrl_rule_link *link; - mtx_lock(&hrl_lock); + mtx_lock(&container_lock); while (!LIST_EMPTY(&p->p_container.c_rule_links)) { link = LIST_FIRST(&p->p_container.c_rule_links); LIST_REMOVE(link, hrl_next); hrl_rule_release(link->hrl_rule); uma_zfree(hrl_rule_link_zone, link); } - mtx_unlock(&hrl_lock); + mtx_unlock(&container_lock); } static void @@ -1607,9 +1611,47 @@ NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); hrl_rule_zone = uma_zcreate("hrl_rule", sizeof(struct hrl_rule), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - mtx_init(&hrl_lock, "hrl lock", NULL, MTX_RECURSE); /* XXX: Make it non-recurseable later. */ EVENTHANDLER_REGISTER(process_fork, hrl_proc_fork, NULL, EVENTHANDLER_PRI_ANY); EVENTHANDLER_REGISTER(process_exit, hrl_proc_exit, NULL, EVENTHANDLER_PRI_ANY); } + +#else /* !HRL */ + +int +hrl_get_usage(struct thread *td, struct hrl_get_usage_args *uap) +{ + + return (EOPNOTSUPP); +} + +int +hrl_get_rules(struct thread *td, struct hrl_get_rules_args *uap) +{ + + return (EOPNOTSUPP); +} + +int +hrl_get_limits(struct thread *td, struct hrl_get_limits_args *uap) +{ + + return (EOPNOTSUPP); +} + +int +hrl_add_rule(struct thread *td, struct hrl_add_rule_args *uap) +{ + + return (EOPNOTSUPP); +} + +int +hrl_remove_rule(struct thread *td, struct hrl_remove_rule_args *uap) +{ + + return (EOPNOTSUPP); +} + +#endif /* !HRL */ ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_loginclass.c#18 (text+ko) ==== @@ -42,7 +42,6 @@ #include #include -#include #include #include #include ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_prot.c#26 (text+ko) ==== @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD: src/sys/kern/kern_prot.c,v 1.228 2010/01/15 07:18:46 brooks Exp $"); #include "opt_compat.h" +#include "opt_hrl.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -2125,7 +2126,9 @@ { PROC_LOCK_ASSERT(p, MA_OWNED); +#ifdef HRL hrl_proc_ucred_changing(p, newcred); +#endif p->p_ucred = newcred; } ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#33 (text+ko) ==== @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: src/sys/kern/kern_resource.c,v 1.198 2010/05/24 10:23:49 kib Exp $"); #include "opt_compat.h" +#include "opt_hrl.h" #include #include @@ -654,6 +655,7 @@ callout_reset(&p->p_limco, hz, lim_cb, p); } +#ifdef HRL static void hrl_handle_setrlimit(u_int which, struct rlimit *lim, struct thread *td) { @@ -748,6 +750,7 @@ } hrl_rule_release(rule); } +#endif /* HRL */ int kern_setrlimit(td, which, limp) @@ -870,7 +873,9 @@ } } +#ifdef HRL hrl_handle_setrlimit(which, alimp, td); +#endif return (0); } ==== //depot/projects/soc2009/trasz_limits/sys/kern/tty_pts.c#15 (text+ko) ==== @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include ==== //depot/projects/soc2009/trasz_limits/sys/sys/loginclass.h#9 (text+ko) ==== @@ -39,6 +39,8 @@ struct container lc_container; }; +struct hrl_rule; + void loginclass_acquire(struct loginclass *lc); void loginclass_release(struct loginclass *lc); struct loginclass *loginclass_find(const char *name); ==== //depot/projects/soc2009/trasz_limits/sys/sys/resourcevar.h#19 (text+ko) ==== @@ -39,7 +39,6 @@ #include #include #include -#include #endif /* @@ -123,6 +122,7 @@ struct proc; struct rusage_ext; struct thread; +struct hrl_rule; void addupc_intr(struct thread *td, uintfptr_t pc, u_int ticks); void addupc_task(struct thread *td, uintfptr_t pc, u_int ticks); ==== //depot/projects/soc2009/trasz_limits/sys/vm/vm_map.c#14 (text+ko) ==== @@ -67,7 +67,7 @@ #include #include -#include +#include #include #include #include ==== //depot/projects/soc2009/trasz_limits/sys/vm/vm_unix.c#5 (text+ko) ==== @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD: src/sys/vm/vm_unix.c,v 1.49 2009/04/11 22:34:08 alc Exp $"); #include -#include +#include #include #include #include From owner-p4-projects@FreeBSD.ORG Mon Jun 28 20:09:22 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A397F1065670; Mon, 28 Jun 2010 20:09:22 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6734D1065674 for ; Mon, 28 Jun 2010 20:09:22 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 54E748FC1B for ; Mon, 28 Jun 2010 20:09:22 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5SK9MJw071925 for ; Mon, 28 Jun 2010 20:09:22 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5SK9M3q071923 for perforce@freebsd.org; Mon, 28 Jun 2010 20:09:22 GMT (envelope-from afiveg@FreeBSD.org) Date: Mon, 28 Jun 2010 20:09:22 GMT Message-Id: <201006282009.o5SK9M3q071923@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180303 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 20:09:22 -0000 http://p4web.freebsd.org/@@180303?ac=10 Change 180303 by afiveg@cottonmouth on 2010/06/28 20:09:14 Cosmetic bug fixes in libpcap Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap/pcap.h#2 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#7 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#15 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#13 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#14 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#12 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#18 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#18 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#3 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#3 edit .. //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#4 edit .. //depot/projects/soc2010/ringmap/tests/libpcap/test_pcap.c#4 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap/pcap.h#2 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#7 (text+ko) ==== @@ -363,7 +363,7 @@ curr_slot = R_MODULO(SW_TAIL(ring) + 1); if (!(ring->slot[curr_slot].is_ok)) { #ifdef __RINGMAP_DEB - printf("Slot %d was not accepted by driver!\n"); + printf("Slot %d was not accepted by driver!\n", curr_slot); #endif goto out; } @@ -375,16 +375,16 @@ pkthdr.caplen = pkthdr.len = mb->m_len; datap = (caddr_t)U_PACKET(ring, curr_slot); + ring->pkt_counter++; + --ws; + (*callback)(user, &pkthdr, datap); out: + INC_TAIL(ring); + ring->slot[curr_slot].is_ok = 0; ring->slot[curr_slot].filtered = 0; - - INC_TAIL(ring); - ring->pkt_counter++; - - --ws; } RINGMAP_FUNC_DEBUG(end); ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#15 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#13 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#14 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#12 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#18 (text+ko) ==== @@ -229,6 +229,8 @@ contigfree(rm->funcs, sizeof(struct ringmap_functions), M_DEVBUF); contigfree(rm, sizeof(struct ringmap), M_DEVBUF); + + rm = NULL; RINGMAP_FUNC_DEBUG(end); ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#18 (text+ko) ==== @@ -231,26 +231,27 @@ */ void (*delayed_isr_per_packet)(struct ring *, int); -/* - * This function synchronize the tail and head hardware registers - * with head and tail software varibles, that are visible from - * software process. - * - * Synchronisation rules: - * 1. SYNC_HEAD: HARDWARE_HEAD => SOFTWARE_HEAD - * set value from hardware HEAD register into the software visible - * HEAD-variable: ring->kernrp. The User-space process shouldn't touch - * the ring->kernrp variable. Only hardware increment the value in the - * HEAD register onto adapters chip while receiving new packets, and only - * driver (kernel) synchronize then hardware HEAD with ring->kernrp. - * - * 2. SYNC_TAIL: SOFTWARE_TAIL => HARDWARE_TAIL - * set value from software TAIL-variable: ring->userrp into the hardware - * TAIL-register. Hardware shouldn't change the content of TAIL-register. - * Software after reading one packet in RAM increment the value of - * ring->userrp. Kernel will check this value and set it into the - * hardware TAIL-register. - */ + /* + * This function synchronize the tail and head hardware registers + * with head and tail software varibles, that are visible from + * software process. + * + * Synchronisation rules: + * 1. SYNC_HEAD: HARDWARE_HEAD => SOFTWARE_HEAD + * set value from hardware HEAD register into the software visible + * HEAD-variable: ring->kernrp. The User-space process shouldn't + * touch the ring->kernrp variable. Only hardware increment the value + * in the HEAD register onto adapters chip while receiving new + * packets, and only driver (kernel) synchronize then hardware HEAD + * with ring->kernrp. + * + * 2. SYNC_TAIL: SOFTWARE_TAIL => HARDWARE_TAIL + * set value from software TAIL-variable: ring->userrp into the + * hardware TAIL-register. Hardware shouldn't change the content of + * TAIL-register. Software after reading one packet in RAM increment + * the value of ring->userrp. Kernel will check this value and set it + * into the hardware TAIL-register. + */ void (*sync_head_tail)(device_t, struct ring *); }; @@ -267,6 +268,7 @@ /* RDT = (userrp - RING_SAFETY_MARGIN) mod SLOTS_NUMBER */ #define IOCTL_SYNC_HEAD_TAIL _IO(RINGMAP_IOC_MAGIC, 2) + /* * Disable interrupts on NIC. In some cases it is safe * to disable interrupts in order to avoid kernel panics @@ -397,7 +399,6 @@ if (__RINGMAP_DEB) printf(WARN_PREFIX"[%s]: " #x "\n", __func__); - #ifdef _KERNEL #define RINGMAP_PRINT_DESC(i) \ printf("[%s] - DESC INFO: desc_num=%d, status=0x%X, pktlen=%d\n[%s] - ADDRESSES: pkt_virt=0x%X (kern), pkt_phys=0x%X\n", \ @@ -427,9 +428,3 @@ pktp[32], \ pktp[59]); #endif - - - - - - ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#3 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#3 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#4 (text+ko) ==== @@ -21,11 +21,10 @@ pcap_t *handle; - +unsigned int pcnt = 0; #define HOWMANY 20 - int main(int argc, char **argv) { @@ -68,5 +67,12 @@ void got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet) { - printf("got :) \n"); + pcnt++; + + printf("===> Packet %d \n", pcnt); + printf("Packet Length: %d \n", header->len); + printf("Time Stamp: %llu \n", + (header->ts.tv_sec*1000000 + header->ts.tv_usec)); + + printf("\n\n"); } ==== //depot/projects/soc2010/ringmap/tests/libpcap/test_pcap.c#4 (text+ko) ==== From owner-p4-projects@FreeBSD.ORG Mon Jun 28 20:14:28 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5246D1065676; Mon, 28 Jun 2010 20:14:28 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15D29106566C for ; Mon, 28 Jun 2010 20:14:28 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 040C68FC12 for ; Mon, 28 Jun 2010 20:14:28 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5SKERXT072315 for ; Mon, 28 Jun 2010 20:14:27 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5SKER7R072313 for perforce@freebsd.org; Mon, 28 Jun 2010 20:14:27 GMT (envelope-from trasz@freebsd.org) Date: Mon, 28 Jun 2010 20:14:27 GMT Message-Id: <201006282014.o5SKER7R072313@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to trasz@freebsd.org using -f From: Edward Tomasz Napierala To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180304 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 20:14:28 -0000 http://p4web.freebsd.org/@@180304?ac=10 Change 180304 by trasz@trasz_victim on 2010/06/28 20:13:30 Fix build with HRL enabled. Affected files ... .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#5 edit Differences ... ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#5 (text+ko) ==== @@ -246,6 +246,9 @@ int hrl_alloc(struct proc *p, int resource, uint64_t amount) { +#ifdef HRL + int error; +#endif #if 0 printf("hrl_alloc: allocating %ju of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); @@ -279,6 +282,9 @@ hrl_allocated(struct proc *p, int resource, uint64_t amount) { int64_t diff; +#ifdef HRL + int error; +#endif #if 0 printf("hrl_allocated: allocated %lld of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); From owner-p4-projects@FreeBSD.ORG Mon Jun 28 21:40:02 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C1FFB1065670; Mon, 28 Jun 2010 21:40:01 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 876C8106566B for ; Mon, 28 Jun 2010 21:40:01 +0000 (UTC) (envelope-from gk@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 702FF8FC08 for ; Mon, 28 Jun 2010 21:40:01 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5SLe1GL090391 for ; Mon, 28 Jun 2010 21:40:01 GMT (envelope-from gk@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5SLe1ZT090389 for perforce@freebsd.org; Mon, 28 Jun 2010 21:40:01 GMT (envelope-from gk@FreeBSD.org) Date: Mon, 28 Jun 2010 21:40:01 GMT Message-Id: <201006282140.o5SLe1ZT090389@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gk@FreeBSD.org using -f From: Gleb Kurtsou To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180305 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 21:40:02 -0000 http://p4web.freebsd.org/@@180305?ac=10 Change 180305 by gk@gk_h1 on 2010/06/28 21:39:07 Refactor reference count into hold and use counts Make parent to child reference weak (child is in parent->dc_tree) Add unused and invalid queues for elements Clear unused/invalid inodes on fs unmount Remove children entries in dc_marknegative and dc_removeentry Use per-cpu statistics Affected files ... .. //depot/projects/soc2010/gk_namecache/sys/kern/vfs_dircache.c#4 edit .. //depot/projects/soc2010/gk_namecache/sys/sys/dircache.h#4 edit Differences ... ==== //depot/projects/soc2010/gk_namecache/sys/kern/vfs_dircache.c#4 (text+ko) ==== @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -49,7 +51,7 @@ #include -#define DC_NAMEROUND 16 /* power of 2 */ +#define DC_NAMEROUND 32 /* power of 2 */ #define DC_OP_VLOCK 0x00000001 @@ -59,24 +61,68 @@ printf(format ,## args); \ } while (0) +#define DC_STAT_DEFINE(name, descr) \ +static void __CONCAT(name, _add_proc) (void *dummy __unused) \ +{ \ + SYSCTL_ADD_PROC(NULL, \ + SYSCTL_STATIC_CHILDREN(_vfs_dircache_stats), OID_AUTO, \ + #name, CTLTYPE_LONG | CTLFLAG_RD | CTLFLAG_MPSAFE, \ + &DPCPU_NAME(dc_stats[__CONCAT(ds_, name)]), 0, \ + sysctl_dpcpu_long, "LU", descr); \ +} \ +SYSINIT(name, SI_SUB_VFS, SI_ORDER_SECOND, __CONCAT(name, _add_proc), NULL); + +#define DC_STAT_INC(ind) \ + do { \ + sched_pin(); \ + DPCPU_GET(dc_stats[(ind)])++; \ + sched_unpin(); \ + } while (0) + enum { - dps_interlock_same, - dps_interlock_direct, - dps_interlock_reverse, - dps_interlock_reverse_fast, - dps_max + ds_hit, + ds_hit_negative, + ds_miss, + ds_add, + ds_add_error, + ds_remove, + ds_remove_error, + ds_rename, + ds_rename_realloc, + ds_rename_error, + ds_setnegative, + ds_setnegative_error, + ds_setvnode, + ds_setvnode_hit, + ds_setvnode_error, + ds_allocvnode, + ds_reclaimvnode, + ds_alloc, + ds_free, + ds_vinterlock_restart, + ds_lookup_restart, + ds_insert_restart, + ds_count }; -struct dircache_poolstat { - u_long dps_stats[dps_max]; -}; - struct dircache_root { struct mount *dr_mnt; struct dircache *dr_entry; }; -SYSCTL_NODE(_vfs, OID_AUTO, dircache, CTLFLAG_RW, 0, "Dircache"); +struct dircache_pool { + struct mtx dp_mtx; + TAILQ_HEAD(, dircache) dp_unused; + TAILQ_HEAD(, dircache) dp_invalid; + u_long dp_unusedcnt; + u_long dp_invalidcnt; +}; + +static struct dircache_pool pool; + +static SYSCTL_NODE(_vfs, OID_AUTO, dircache, CTLFLAG_RW, 0, "Dircache"); +static SYSCTL_NODE(_vfs_dircache, OID_AUTO, stats, CTLFLAG_RD, 0, + "Dircache stats"); static MALLOC_DEFINE(M_DIRCACHE, "dircache buf", "dircache buffers"); static uma_zone_t dircache_zone; @@ -84,9 +130,44 @@ SYSCTL_UINT(_vfs_dircache, OID_AUTO, debug, CTLFLAG_RW, &dircache_debug, 0, "Enable debug"); +static DPCPU_DEFINE(long, dc_stats[ds_count]); +DC_STAT_DEFINE(hit, ""); +DC_STAT_DEFINE(hit_negative, ""); +DC_STAT_DEFINE(miss, ""); +DC_STAT_DEFINE(add, ""); +DC_STAT_DEFINE(add_error, ""); +DC_STAT_DEFINE(remove, ""); +DC_STAT_DEFINE(remove_error, ""); +DC_STAT_DEFINE(rename, ""); +DC_STAT_DEFINE(rename_realloc, ""); +DC_STAT_DEFINE(rename_error, ""); +DC_STAT_DEFINE(setnegative, ""); +DC_STAT_DEFINE(setnegative_error, ""); +DC_STAT_DEFINE(setvnode, ""); +DC_STAT_DEFINE(setvnode_hit, ""); +DC_STAT_DEFINE(setvnode_error, ""); +DC_STAT_DEFINE(allocvnode, ""); +DC_STAT_DEFINE(reclaimvnode, ""); +DC_STAT_DEFINE(alloc, ""); +DC_STAT_DEFINE(free, ""); +DC_STAT_DEFINE(vinterlock_restart, "vnode interlock restarts"); +DC_STAT_DEFINE(lookup_restart, "lookup restarts"); +DC_STAT_DEFINE(insert_restart, "insert restarts"); + +SYSCTL_UINT(_vfs_dircache_stats, OID_AUTO, invalid, CTLFLAG_RD, + &pool.dp_invalidcnt, 0, "Invalid entries"); +SYSCTL_UINT(_vfs_dircache_stats, OID_AUTO, unused, CTLFLAG_RD, + &pool.dp_unusedcnt, 0, "Unused entries"); + +static void dp_insertunused(struct dircache *dc); +static void dp_removeunused(struct dircache *dc); + static void dircache_sysinit(void *arg __unused) { + mtx_init(&pool.dp_mtx, "dircache pool", NULL, MTX_DEF | MTX_DUPOK); + TAILQ_INIT(&pool.dp_unused); + TAILQ_INIT(&pool.dp_invalid); dircache_zone = uma_zcreate("dircache", sizeof(struct dircache), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); @@ -96,12 +177,15 @@ static void dircache_sysuninit(void *arg __unused) { + MPASS(TAILQ_EMPTY(&pool.dp_unused)); + MPASS(TAILQ_EMPTY(&pool.dp_invalid)); + mtx_destroy(&pool.dp_mtx); uma_zdestroy(dircache_zone); } SYSUNINIT(dircache, SI_SUB_VFS, SI_ORDER_SECOND, dircache_sysuninit, NULL); static __inline int -dc_cmpname(struct dircache *dc, char *name, size_t namelen) +dc_cmpname(struct dircache *dc, char *name, u_int namelen) { int r; @@ -140,15 +224,15 @@ #define dc_assertlock(dc, w) mtx_assert(&(dc)->dc_mtx, (w)) static __inline void -dc_initname(struct dircache *dc, char *name, size_t namelen) +dc_initname(struct dircache *dc, char *name, u_int namelen) { dc->dc_name = name; dc->dc_namelen = namelen; dc->dc_namehash = hash32_buf(name, namelen, HASHINIT * namelen); } -static __inline size_t -dc_namebuflen(size_t namelen) +static __inline u_int +dc_namebuflen(u_int namelen) { return (roundup2(namelen + 1, DC_NAMEROUND)); } @@ -156,11 +240,11 @@ static __inline int dc_namebuffits(u_int dcnamelen, u_int nnamelen) { - return (dc_namebuflen(dcnamelen) < nnamelen + 1); + return (dc_namebuflen(dcnamelen) >= nnamelen + 1); } static __inline char * -dc_allocnamebuf(size_t namelen) +dc_allocnamebuf(u_int namelen) { char * buf; @@ -169,7 +253,7 @@ } static __inline void -dc_setname(struct dircache *dc, char *name, size_t namelen, char *namebuf) +dc_setname(struct dircache *dc, char *name, u_int namelen, char *namebuf) { MPASS(name != dc->dc_name); @@ -200,7 +284,7 @@ } static struct dircache * -dc_alloc(enum dircache_type type, char *name, size_t namelen) +dc_alloc(enum dircache_type type, char *name, u_int namelen) { struct dircache *dc; @@ -208,12 +292,13 @@ DCDEBUG("alloc: %p %s\n", dc, name); dc->dc_type = type; - refcount_init(&dc->dc_refcnt, 1); - mtx_init(&dc->dc_mtx, "dircache mtx", NULL, MTX_DEF | MTX_DUPOK); + refcount_init(&dc->dc_holdcnt, 1); + mtx_init(&dc->dc_mtx, "dircache entry", NULL, MTX_DEF | MTX_DUPOK); if (name != NULL && namelen != 0) dc_setname(dc, name, namelen, NULL); + DC_STAT_INC(ds_alloc); return (dc); } @@ -222,42 +307,135 @@ { MPASS(RB_EMPTY(&dc->dc_children)); MPASS(dc->dc_parent == NULL); + MPASS(dc->dc_vnode == NULL); DCDEBUG("free: %p %s\n", dc, dc->dc_name); + if (dc->dc_name != NULL) + free(dc->dc_name, M_DIRCACHE); mtx_destroy(&dc->dc_mtx); uma_zfree(dircache_zone, dc); + DC_STAT_INC(ds_free); } static __inline struct dircache * -dc_ref(struct dircache *dc) +dc_hold(struct dircache *dc) { - refcount_acquire(&dc->dc_refcnt); + refcount_acquire(&dc->dc_holdcnt); return (dc); } static __inline int -dc_relel(struct dircache *dc) +dc_drop_int(struct dircache *dc, int islocked, int unlock) { - dc_assertlock(dc, MA_OWNED); - - if (refcount_release(&dc->dc_refcnt) != 0) { - dc_unlock(dc); + DCDEBUG("drop: %p usecnt=%d holdcnt=%d-1\n", dc, dc->dc_usecnt, + dc->dc_holdcnt); + if (refcount_release(&dc->dc_holdcnt) != 0) { + MPASS(dc->dc_usecnt == 0); + if (islocked != 0) { + dc_assertlock(dc, MA_OWNED); + dc_unlock(dc); + } else { + dc_assertlock(dc, MA_NOTOWNED); + } dc_free(dc); return (1); } + if (unlock != 0) + dc_unlock(dc); return (0); } +static int +dc_drop(struct dircache *dc) +{ + return (dc_drop_int(dc, 0, 0)); +} + +static int +dc_droplocked(struct dircache *dc) +{ + return (dc_drop_int(dc, 1, 1)); +} + +static int +dc_dropsafe(struct dircache *dc) +{ + return (dc_drop_int(dc, 1, 0)); +} + +static struct dircache * +dc_ref(struct dircache *dc) +{ + MPASS(dc->dc_type != DT_INVALID); + dc_assertlock(dc, MA_OWNED); + + dc_hold(dc); + if (dc->dc_usecnt == 0) { + MPASS(dc->dc_vnode == NULL); + dp_removeunused(dc); + } + dc->dc_usecnt++; + DCDEBUG("ref: %p usecnt=%d holdcnt=%d\n", dc, dc->dc_usecnt, + dc->dc_holdcnt); + MPASS(dc->dc_usecnt <= dc->dc_holdcnt); + return (dc); +} + static __inline int +dc_rele_int(struct dircache *dc, int unlock) +{ + int dropped; + + dc_assertlock(dc, MA_OWNED); + + MPASS(dc->dc_usecnt > 0); + dc->dc_usecnt--; + DCDEBUG("rele: %p usecnt=%d holdcnt=%d-1 unlock=%d\n", + dc, dc->dc_usecnt, dc->dc_holdcnt, unlock); + + if (dc->dc_usecnt > 0) { + dropped = dc_drop_int(dc, 1, unlock); + MPASS(dropped == 0); + return (dropped); + } + + MPASS(dc->dc_vnode == NULL); + dp_insertunused(dc); + dc_droplocked(dc); + + return (1); +} + +static int dc_rele(struct dircache *dc) { - dc_assertlock(dc, MA_NOTOWNED); + return (dc_rele_int(dc, 1)); +} + +static int +dc_relesafe(struct dircache *dc) +{ + return (dc_rele_int(dc, 0)); +} + +static __inline void +dc_invalidate(struct dircache *dc) +{ + dc_assertlock(dc, MA_OWNED); + + if (dc->dc_type == DT_INVALID) + return; - if (refcount_release(&dc->dc_refcnt) != 0) { - dc_free(dc); - return (1); + dc->dc_type = DT_INVALID; + if (dc->dc_usecnt == 0) { + DCDEBUG("invalidate unused: %p %s\n", dc, dc->dc_name); + mtx_lock(&pool.dp_mtx); + TAILQ_REMOVE(&pool.dp_unused, dc, dc_list); + TAILQ_INSERT_HEAD(&pool.dp_invalid, dc, dc_list); + pool.dp_unusedcnt--; + pool.dp_invalidcnt++; + mtx_unlock(&pool.dp_mtx); } - return (0); } static void @@ -265,8 +443,8 @@ { if (dc->dc_type != DT_ROOT) dc_assertlock(dc, MA_OWNED); - DCDEBUG("refvnode: %p %s; vp=%p; refcnt=%d\n", dc, dc->dc_name, - vp, dc->dc_refcnt); + DCDEBUG("refvnode: %p %s; vp=%p; usecnt=%d\n", dc, dc->dc_name, + vp, dc->dc_usecnt); MPASS(vp->v_type != VNON && vp->v_type != VBAD); MPASS(dc->dc_vnode == NULL); @@ -275,7 +453,7 @@ VI_LOCK(vp); if (vp->v_type == VDIR && !TAILQ_EMPTY(&vp->v_dircache)) panic("dircache: multiple directory vnode references %p", vp); - TAILQ_INSERT_HEAD(&vp->v_dircache, dc, dc_vnodelist); + TAILQ_INSERT_HEAD(&vp->v_dircache, dc, dc_list); VI_UNLOCK(vp); } @@ -284,15 +462,14 @@ { MPASS(dc->dc_vnode != NULL); dc_assertlock(dc, MA_OWNED); - DCDEBUG("relevnode: %p %s; vp=%p; refcnt=%d\n", dc, dc->dc_name, - dc->dc_vnode, dc->dc_refcnt); + DCDEBUG("relevnode: %p %s; vp=%p; usecnt=%d\n", dc, dc->dc_name, + dc->dc_vnode, dc->dc_usecnt); VI_LOCK(dc->dc_vnode); - TAILQ_REMOVE(&dc->dc_vnode->v_dircache, dc, dc_vnodelist); + TAILQ_REMOVE(&dc->dc_vnode->v_dircache, dc, dc_list); if ((flags & DC_OP_VLOCK) == 0) VI_UNLOCK(dc->dc_vnode); dc->dc_vnode = NULL; - dc_unlock(dc); dc_rele(dc); } @@ -308,23 +485,27 @@ return (0); } - dc_ref(dc); + dc_hold(dc); VI_UNLOCK(vp); dc_lock(dc); if (dc->dc_vnode != vp) { VI_LOCK(vp); - dc_unlock(dc); - return (1); + dc_droplocked(dc); + goto restart; } - if (dc_relel(dc) != 0) { + if (dc_dropsafe(dc) != 0) { VI_LOCK(vp); - return (1); + goto restart; } MPASS(dc->dc_vnode == vp); return (0); + +restart: + DC_STAT_INC(ds_vinterlock_restart); + return (1); } static struct dircache * @@ -353,14 +534,14 @@ return (NULL); } } else { - if (TAILQ_NEXT(dc, dc_vnodelist) != NULL) { + if (TAILQ_NEXT(dc, dc_list) != NULL) { MPASS(cnp != NULL && dvp != NULL); MPASS(vp->v_type != VDIR); MPASS(!(cnp->cn_nameptr[0] == '.' && (cnp->cn_namelen == 1 || (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.')))); - for(; dc != NULL; dc = TAILQ_NEXT(dc, dc_vnodelist)) { + for(; dc != NULL; dc = TAILQ_NEXT(dc, dc_list)) { if (dc_vinterlock(vp, dc) != 0) { DCDEBUG("getenrty: restart; multiple entries; vp=%p\n", vp); @@ -382,12 +563,14 @@ #if 0 return (NULL); #else - panic("dircache: entry not found for vnode %p (multiple)\n", vp); + panic("dircache: entry not found for vnode %p (multiple)\n", + vp); #endif } } else { if (dc_vinterlock(vp, dc) != 0) { - DCDEBUG("getenrty: restart; node removed; vp=%p\n", vp); + DCDEBUG("getenrty: restart; node removed; vp=%p\n", + vp); goto restart; } } @@ -398,19 +581,48 @@ return (dc); } +static int +dc_parentinterlock(struct dircache *pdc, struct dircache *dc, int *pdcholdp) +{ + dc_assertlock(pdc, MA_OWNED); + + if (dc_trylock(dc) != 0) + return (0); + + if (pdcholdp != NULL && *pdcholdp == 0) { + dc_hold(pdc); + *pdcholdp += 1; + } + + dc_hold(dc); + dc_unlock(pdc); + dc_lock(dc); + if (dc->dc_parent != pdc) { + dc_droplocked(dc); + dc_lock(pdc); + return (1); + } + if (dc_dropsafe(dc) != 0) { + dc_lock(pdc); + return (1); + } + dc_lock(pdc); + return (0); +} + static struct dircache * dc_find(struct vnode *dvp, struct componentname *cnp) { struct dircache key; struct dircache *pdc, *dc; - int pdcref; + int pdchold; pdc = dc_getentry(dvp, NULL, NULL); if (pdc == NULL) return (NULL); dc_assertlock(pdc, MA_OWNED); - pdcref = 0; + pdchold = 0; dc_initname(&key, cnp->cn_nameptr, cnp->cn_namelen); restart: @@ -420,34 +632,16 @@ goto out; } - if (dc_trylock(dc) != 0) - dc_unlock(pdc); - else { - if (pdcref == 0) { - dc_ref(pdc); - pdcref++; - } - dc_ref(dc); - dc_unlock(pdc); - dc_lock(dc); - if (dc->dc_parent != pdc) { - dc_unlock(dc); - dc_rele(dc); - dc_lock(pdc); - goto restart; - } - if (dc_relel(dc) != 0) { - dc_lock(pdc); - goto restart; - } + if (dc_parentinterlock(pdc, dc, &pdchold) != 0) { + DC_STAT_INC(ds_lookup_restart); + goto restart; } - dc_assertlock(pdc, MA_NOTOWNED); dc_assertlock(dc, MA_OWNED); - MPASS(dc->dc_parent == pdc); + dc_unlock(pdc); out: - if (pdcref != 0) - dc_rele(pdc); + if (pdchold != 0) + dc_drop(pdc); return (dc); } @@ -457,7 +651,7 @@ { struct dircache *col; - DCDEBUG("update: parent=%p name=%s\n", pdc, pdc->dc_name); + DCDEBUG("insert: parent=%p name=%s\n", pdc, pdc->dc_name); restart: dc_assertlock(dc, MA_OWNED); @@ -466,14 +660,15 @@ col = RB_INSERT(dircache_tree, &pdc->dc_children, dc); if (col != NULL) { if (dc->dc_type == col->dc_type) { - DCDEBUG("update: warn: same entry added: %s\n", dc->dc_name); + DCDEBUG("insert: warn: same entry added: %s\n", + dc->dc_name); MPASS(col->dc_inode == inode); dc_unlock(pdc); - dc_unlock(dc); - dc_rele(dc); + dc_drop(dc); return (NULL); } else if (col->dc_type == DT_NEGATIVE) { - DCDEBUG("update: replace negative entry: %p %s\n", dc, dc->dc_name); + DCDEBUG("insert: replace negative entry: %p %s\n", + dc, dc->dc_name); dc_unlock(dc); if (dc_trylock(col) == 0) { dc_unlock(pdc); @@ -482,6 +677,7 @@ dc_unlock(col); dc_lock(dc); dc_lock(pdc); + DC_STAT_INC(ds_insert_restart); goto restart; } dc_lock(pdc); @@ -489,14 +685,16 @@ col->dc_type = dc->dc_type; col->dc_inode = inode; dc_unlock(pdc); - dc_rele(dc); + dc_drop(dc); dc = col; } else - panic("dircache: update: ivalid entry: %d %s\n", + panic("dircache: insert: ivalid entry: %d %s\n", dc->dc_type, dc->dc_name); } else { + dp_insertunused(dc); dc->dc_parent = pdc; dc_ref(pdc); + dc_hold(dc); dc_unlock(pdc); } if (vp != NULL) @@ -514,46 +712,142 @@ } } +static void dc_removechildren(struct dircache *dc); + static void dc_removeentry(struct dircache *dc) { struct dircache *parent; + int haschildren; MPASS(dc->dc_parent != NULL); dc_assertlock(dc, MA_OWNED); dc_assertlock(dc->dc_parent, MA_OWNED); dc_assertempty(dc); + DCDEBUG("remove entry: %p %s\n", dc, dc->dc_name); parent = dc->dc_parent; - if (parent->dc_type != DT_NEGATIVE) - dc_updategen(parent); - dc->dc_type = DT_INVAL; dc->dc_parent = NULL; RB_REMOVE(dircache_tree, &parent->dc_children, dc); - dc_unlock(parent); - if (dc->dc_vnode != NULL) + dc_invalidate(dc); + haschildren = !RB_EMPTY(&dc->dc_children); + dc_rele(parent); + if (dc->dc_vnode != NULL) { dc_relevnode(dc, 0); - else + if (haschildren != 0) + dc_lock(dc); + } else if (haschildren == 0) dc_unlock(dc); - dc_rele(parent); - dc_rele(dc); + if (haschildren != 0) + dc_removechildren(dc); + dc_drop(dc); } static void dc_marknegative(struct dircache *dc) { + int haschildren; + + MPASS(dc->dc_parent != NULL); + dc_assertlock(dc, MA_OWNED); + dc_assertlock(dc->dc_parent, MA_OWNED); + dc_assertempty(dc); + DCDEBUG("mark negative: %p %s; vp=%p\n", dc, dc->dc_name, dc->dc_vnode); - dc_lock(dc->dc_parent); - dc_assertempty(dc); dc_updategen(dc->dc_parent); dc->dc_type = DT_NEGATIVE; dc_unlock(dc->dc_parent); dc->dc_inode = 0; - if (dc->dc_vnode != NULL) + haschildren = !RB_EMPTY(&dc->dc_children); + if (haschildren != 0) + dc_hold(dc); + if (dc->dc_vnode != NULL) { dc_relevnode(dc, 0); - else + if (haschildren != 0) + dc_lock(dc); + } else if (haschildren == 0) dc_unlock(dc); - dc_assertlock(dc, MA_NOTOWNED); + if (haschildren != 0) { + dc_removechildren(dc); + dc_drop(dc); + } +} + +static void +dc_removechildren(struct dircache *dc) +{ + struct dircache *child; + + dc_assertlock(dc, MA_OWNED); + + DCDEBUG("remove children: %p %s\n", dc, dc->dc_name); + while(!RB_EMPTY(&dc->dc_children)) { + child = RB_MIN(dircache_tree, &dc->dc_children); + if (dc_parentinterlock(dc, child, NULL) != 0) + continue; + MPASS(RB_EMPTY(&child->dc_children)); + dc_removeentry(child); + dc_lock(dc); + } + dc_unlock(dc); +} + +static void +dp_insertunused(struct dircache *dc) +{ + dc_assertlock(dc, MA_OWNED); + + mtx_lock(&pool.dp_mtx); + if (dc->dc_type == DT_INVALID) { + TAILQ_INSERT_HEAD(&pool.dp_invalid, dc, dc_list); + pool.dp_invalidcnt++; + DCDEBUG("insert unused: %p -> invalid list: type=%d\n", + dc, dc->dc_type); + } else { + TAILQ_INSERT_TAIL(&pool.dp_unused, dc, dc_list); + pool.dp_unusedcnt++; + DCDEBUG("insert unused: %p -> unused list: type=%d\n", + dc, dc->dc_type); + } + mtx_unlock(&pool.dp_mtx); +} + +static void +dp_removeunused(struct dircache *dc) +{ + mtx_lock(&pool.dp_mtx); + TAILQ_REMOVE(&pool.dp_unused, dc, dc_list); + pool.dp_unusedcnt--; + mtx_unlock(&pool.dp_mtx); +} + +static void +dp_clearinvalid(void) +{ + struct dircache *dc; + + mtx_lock(&pool.dp_mtx); + while (!TAILQ_EMPTY(&pool.dp_invalid)) { + dc = TAILQ_FIRST(&pool.dp_invalid); + TAILQ_REMOVE(&pool.dp_invalid, dc, dc_list); + pool.dp_invalidcnt--; + mtx_unlock(&pool.dp_mtx); + dc_lock(dc); + if (dc_dropsafe(dc) == 0) { + dc_assertlock(dc, MA_OWNED); + dc_hold(dc); + MPASS(dc->dc_vnode == NULL); + if (dc->dc_parent != NULL) { + dc_lock(dc->dc_parent); + dc_removeentry(dc); + dc_lock(dc); + } + dc_removechildren(dc); + dc_drop(dc); + } + mtx_lock(&pool.dp_mtx); + } + mtx_unlock(&pool.dp_mtx); } void @@ -563,18 +857,77 @@ MPASS(mp->mnt_dircache == NULL); dc = dc_alloc(DT_ROOT, NULL, 0); + dc_lock(dc); + dp_insertunused(dc); dc->dc_inode = inode; - mp->mnt_dircache = dc; + mp->mnt_dircache = dc_ref(dc); + dc_unlock(dc); DCDEBUG("init: root=%p %d\n", dc, inode); } void dircache_uninit(struct mount *mp) { + struct dircache *dc, *child; + int dropped, dchold; + MPASS(mp->mnt_dircache != NULL); - dc_rele(mp->mnt_dircache); + + dp_clearinvalid(); + +restart: DCDEBUG("uninit: root=%p\n", mp->mnt_dircache); + dc = mp->mnt_dircache; + dc_lock(dc); + + while (dc != NULL && !RB_EMPTY(&dc->dc_children)) { +nested: + dc_assertlock(dc, MA_OWNED); + RB_FOREACH(child, dircache_tree, &dc->dc_children) { + if (!RB_EMPTY(&child->dc_children)) { + dchold = 0; + dropped = dc_parentinterlock(dc, child, + &dchold); + if (dchold != 0) + dc_droplocked(dc); + else + dc_unlock(dc); + if (dropped != 0) + goto restart; + dc = child; + DCDEBUG("uninit: go down: %p %s\n", + dc, dc->dc_name); + goto nested; + } + } + child = dc; + dc = dc->dc_parent; + if (dc != NULL) + dc_hold(dc); + dc_hold(child); + dc_removechildren(child); + dc_drop(child); + if (dc != NULL) { + dc_lock(dc); + if (dc_dropsafe(dc) != 0) + goto restart; + DCDEBUG("uninit: go up: %p %s\n", dc, dc->dc_name); + } + } + + if (dc == NULL) { + dc = mp->mnt_dircache; + dc_lock(dc); + } + + MPASS(RB_EMPTY(&dc->dc_children)); + mp->mnt_dircache = NULL; + dc_invalidate(dc); + dropped = dc_rele(dc); + MPASS(dropped != 0); + + dp_clearinvalid(); } void @@ -592,7 +945,7 @@ return; } if (vp->v_type == VDIR) { - MPASS(TAILQ_NEXT(dc, dc_vnodelist) == NULL); + MPASS(TAILQ_NEXT(dc, dc_list) == NULL); if (dc_vinterlock(vp, dc) != 0) goto restart; dc_ref(dc); @@ -602,9 +955,8 @@ child); if (dc_trylock(child) != 0) { child->dc_parent = NULL; - dc_unlock(child); - dc_rele(child); - r = dc_relel(dc); + dc_droplocked(child); + r = dc_relesafe(dc); MPASS(r == 0); } else TAILQ_INSERT_HEAD(&head, child, @@ -614,18 +966,19 @@ dc_unlock(dc); while(!TAILQ_EMPTY(&head)) { child = TAILQ_FIRST(&head); + TAILQ_REMOVE(&head, child, dc_tmplist); dc_lock(child); MPASS(child->dc_parent == dc); dc_lock(dc); child->dc_parent = NULL; - dc_unlock(dc); - dc_rele(child); + dc_droplocked(child); dc_rele(dc); } + dc_lock(dc); dc_rele(dc); } else { /* Check invariants */ - TAILQ_FOREACH(dc, &vp->v_dircache, dc_vnodelist) { + TAILQ_FOREACH(dc, &vp->v_dircache, dc_list) { MPASS(dc->dc_type != DT_NEGATIVE); } VI_UNLOCK(vp); @@ -692,7 +1045,7 @@ return (0); } error = 0; - if (dc->dc_type == DT_NEGATIVE) + if (dc->dc_type == DT_NEGATIVE) { switch (cnp->cn_nameiop) { case CREATE: case RENAME: @@ -701,13 +1054,17 @@ default: error = ENOENT; } - else if (dc->dc_vnode != NULL) { + DC_STAT_INC(ds_hit_negative); + } else if (dc->dc_vnode != NULL) { *vpp = dc->dc_vnode; error = -1; + DC_STAT_INC(ds_hit); + } else { + DC_STAT_INC(ds_miss); } dc_unlock(dc); - DCDEBUG("lookup: error=%d: %p %s; dvp=%p; op=%ld\n", error, dc, - dc->dc_name, dvp, cnp->cn_nameiop); + DCDEBUG("lookup: error=%d: %p %s; dvp=%p; op=%ld\n", + error, dc, dc->dc_name, dvp, cnp->cn_nameiop); if (error == -1) { ltype = 0; if ((cnp->cn_flags & ISDOTDOT) != 0) { @@ -745,7 +1102,8 @@ dc_lock(ndc); pdc = dc_getentry(dvp, NULL, NULL); if (pdc == NULL) { - dc_rele(ndc); + dc_drop(ndc); + DC_STAT_INC(ds_add_error); return (ENOENT); } ndc = dc_insert(pdc, ndc, vp, inode); @@ -753,6 +1111,7 @@ dc_updategen(ndc); dc_unlock(ndc); } + DC_STAT_INC(ds_add); return (0); } @@ -765,12 +1124,15 @@ dc = dc_getentry(vp, cnp, dvp); if (dc == NULL) { - DCDEBUG("remove: vp not found: %s vp=%p\n", cnp->cn_nameptr, - vp); + DCDEBUG("remove: vp not found: %s vp=%p\n", + cnp->cn_nameptr, vp); MPASS(dc_find(dvp, cnp) == 0); + DC_STAT_INC(ds_remove_error); return (ENOENT); } + dc_lock(dc->dc_parent); dc_marknegative(dc); + DC_STAT_INC(ds_remove); return (0); } @@ -784,16 +1146,19 @@ >>> TRUNCATED FOR MAIL (1000 lines) <<< From owner-p4-projects@FreeBSD.ORG Mon Jun 28 23:58:34 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BC83C1065670; Mon, 28 Jun 2010 23:58:34 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80C29106564A for ; Mon, 28 Jun 2010 23:58:34 +0000 (UTC) (envelope-from bfiedler@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 549AC8FC1B for ; Mon, 28 Jun 2010 23:58:34 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5SNwY8K002547 for ; Mon, 28 Jun 2010 23:58:34 GMT (envelope-from bfiedler@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5SNwYQo002545 for perforce@freebsd.org; Mon, 28 Jun 2010 23:58:34 GMT (envelope-from bfiedler@FreeBSD.org) Date: Mon, 28 Jun 2010 23:58:34 GMT Message-Id: <201006282358.o5SNwYQo002545@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bfiedler@FreeBSD.org using -f From: Benjamin Fiedler To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180308 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 23:58:35 -0000 http://p4web.freebsd.org/@@180308?ac=10 Change 180308 by bfiedler@freebsd-7803 on 2010/06/28 23:58:10 Simple cleanup, reordering Affected files ... .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#6 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#5 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#6 edit Differences ... ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#6 (text+ko) ==== @@ -46,9 +46,11 @@ #include "diff.h" #include "pathnames.h" -int aflag, bflag, Bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; -int sflag, tflag, Tflag, wflag, uniflag, strip_cr, tabsize=8; -int horizon, Eflag; +int aflag, bflag, Bflag, dflag, Eflag, iflag; +int lflag, Nflag, Pflag, pflag, rflag, sflag; +int tflag, Tflag, wflag, uniflag; +int strip_cr, horizon; +int tabsize = 8; int format, status; int fcase_behave = FCASE_SENSITIVE; unsigned long long context; @@ -67,8 +69,6 @@ UNIDIR_OPT, STRIPCR_OPT, HORIZ_OPT, - NOOP_OPT, - LEFTC_OPT, SUPCL_OPT, GTYPE_OPT, @@ -77,6 +77,7 @@ TSIZE_OPT, HLINES_OPT, LFILES_OPT, + NOOP_OPT, }; @@ -98,7 +99,6 @@ { "context", optional_argument, NULL, 'C' }, { "ifdef", required_argument, NULL, 'D' }, { "minimal", no_argument, NULL, 'd' }, -/* XXX: UNIMPLEMENTED */ { "ignore-tab-expansion", no_argument, NULL, 'E' }, { "ed", no_argument, NULL, 'e' }, { "forward-ed", no_argument, NULL, 'f' }, ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#5 (text+ko) ==== @@ -82,9 +82,11 @@ struct excludes *next; }; -extern int aflag, bflag, Bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, - sflag, tflag, Tflag, wflag, uniflag, strip_cr, tabsize, Eflag; -extern int format, status, horizon; +extern int aflag, bflag, Bflag, dflag, Eflag, iflag; +extern int lflag, Nflag, Pflag, pflag, rflag, sflag; +extern int tflag, Tflag, wflag, uniflag; +extern int strip_cr, tabsize, horizon; +extern int format, status; extern int fcase_behave; extern unsigned long long context; extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#6 (text+ko) ==== @@ -719,8 +719,6 @@ strc = fgetwln(f1, &lenc); strd = fgetwln(f2, &lend); - ccol = lenc; - dcol = lend; if (Bflag) { while ((lenc = 1) && (strc[0] == L'\n')) From owner-p4-projects@FreeBSD.ORG Tue Jun 29 07:16:36 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0831B1065675; Tue, 29 Jun 2010 07:16:36 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEC2F106564A for ; Tue, 29 Jun 2010 07:16:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id ABE188FC13 for ; Tue, 29 Jun 2010 07:16:35 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5T7GZbU065003 for ; Tue, 29 Jun 2010 07:16:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5T7GZYb065001 for perforce@freebsd.org; Tue, 29 Jun 2010 07:16:35 GMT (envelope-from hselasky@FreeBSD.org) Date: Tue, 29 Jun 2010 07:16:35 GMT Message-Id: <201006290716.o5T7GZYb065001@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180311 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 07:16:36 -0000 http://p4web.freebsd.org/@@180311?ac=10 Change 180311 by hselasky@hselasky_laptop001 on 2010/06/29 07:15:36 - Add one more USB device ID. PR: usb/148189 Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usbdevs#128 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usbdevs#128 (text+ko) ==== @@ -2158,6 +2158,7 @@ product NATIONAL BEARPAW2400 0x1001 BearPaw 2400 /* NEC products */ +product NEC NUB_0050 0x0050 USB 2.0 7-Port Hub product NEC NUB_005A 0x005a USB 2.0 4-Port Hub product NEC HUB 0x55aa hub product NEC HUB_B 0x55ab hub From owner-p4-projects@FreeBSD.ORG Tue Jun 29 08:23:49 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 408B91065678; Tue, 29 Jun 2010 08:23:49 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04A191065675 for ; Tue, 29 Jun 2010 08:23:49 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E5AA78FC08 for ; Tue, 29 Jun 2010 08:23:48 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5T8NmgS071113 for ; Tue, 29 Jun 2010 08:23:48 GMT (envelope-from andre@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5T8NmQ2071111 for perforce@freebsd.org; Tue, 29 Jun 2010 08:23:48 GMT (envelope-from andre@freebsd.org) Date: Tue, 29 Jun 2010 08:23:48 GMT Message-Id: <201006290823.o5T8NmQ2071111@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andre@freebsd.org using -f From: Andre Oppermann To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180312 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 08:23:49 -0000 http://p4web.freebsd.org/@@180312?ac=10 Change 180312 by andre@andre_t61 on 2010/06/29 08:22:48 Update and improve comments and add more RFC references. Change logic for reassembly timer activation on first block. Affected files ... .. //depot/projects/tcp_reass/netinet/tcp_reass.c#56 edit Differences ... ==== //depot/projects/tcp_reass/netinet/tcp_reass.c#56 (text+ko) ==== @@ -64,7 +64,8 @@ * queue has O(n) worst case behavior whereas the red-black tree is * O(log n). This prevents complexity attacks where a long chain of * blocks would have to be traversed to find the right place for the new - * segment. + * segment. Especially with high bandwidth*delay product links and large + * socket buffers this is a valid concern. * * For the segment merging into a block queue structure the operator can * chose between time and space efficiency. For time efficiency only the @@ -80,26 +81,26 @@ * reasons and because can't easily know at DMA time how large the packet * effectively actually is. * - * Limits, timeout. XXX + * To prevent resource exhaustion attacks a local and global limit governs + * the number of reassembly blocks. The local limit prevents single connections + * from monopolizing the global limit. When used in space efficient mode + * the total memory consumption of the reassembly queue can't be more than + * the receive socket buffer size. To prevent lost connections from holding + * on for too long a timeout causes flushing of all queued data. * - * The reassembly queue block structure is also used to track SACK - * information as the data receiver. A double-linked list is added - * that tracks the blocks LIFO order of their arrival or updating. + * The reassembly queue block structure is also used to track SACK information + * as the data receiver. A double-linked list is added that tracks the blocks + * LIFO order of their arrival or updating. * * Implemented / relevant RFC's: * RFC793: Transmission Control Protocol - * RFC1123: - * RFC2018: This makes us fully compliant to RFC2018 Section 4 including all optional parts marked as "SHOULD". - * RFC2883: + * RFC1122: section 4.2.2.20 and section 4.2.2.21 + * RFC2018: SACK, section 4 including all optional parts marked as "SHOULD" + * RFC2883: D-SACK, section 4 * * TODO: - * - Improve comments and annotate RFC references. - * - Style improvements. - * - Activate timeout on first insert. - * - Partial D-SACK support. * - D-SACK when only one SACK slot available? - * - Direct pointer to last block in RB-tree. - * - Return flags should be same minus FIN. + * - Direct pointer to highest seqnum block in RB-tree? * - Remove T/TCP gonk. * - Lots of testing. */ @@ -298,7 +299,7 @@ /* * Move block to front of SACK list to report SACK blocks in LIFO order. - * RFC2018: section x + * RFC2018: section 4 */ static __inline void tcp_reass_sacktrack(struct tcpcb *tp, struct tcp_reass_block *trb) @@ -311,8 +312,9 @@ } /* - * Insert segment into the reassembly queue and - * XXX append to socket buffer. + * Integrate the new segment into the reassembly queue. When the segment + * matches RCV.NXT append it to the socket buffer including all eglible + * data from the reassembly queue. * * NB: We must always consume the mbuf. Either by appeding it to * the queue or by freeing it. @@ -454,7 +456,7 @@ * Find a block that has at least partial overlap to either side. * If no block is found either insert a new one or use the stack * if the segment directly fits rcv_nxt. - * RFC793: xxx + * RFC793: section 3.9, page 69-76 * RFC2018: section 3 */ if ((trb = RB_FIND(tcp_ra, &tp->rcv_reass, &trbs)) != NULL) { @@ -488,9 +490,8 @@ tcp_reass_sacktrack(tp, trb); /* - * Update XXX + * Update the D-SACK information. * RFC2883: section 4.2, Reporting Partial Duplicate Segments - * XXXAO: Add D-SACK block. */ if ((len = SEQ_DELTA(trbs.trb_seqs, trbs.trb_seqe)) > 0) { tp->rcv_reass_size -= len; @@ -516,8 +517,15 @@ TCPSTAT_INC(tcps_reass_merge); } } else if (tp->rcv_nxt == th_seq) { + /* + * For segments attaching to RCV.NXT do not allocate + * a new block structure to prevent failure under tight + * memory conditions. Instead use temporary stack based + * storage. + */ trb = &trbs; } else if ((trb = (struct tcp_reass_block *)uma_zalloc(tcp_reass_zone, (M_NOWAIT|M_ZERO))) != NULL) { + /* Insert new block as no eglible existing block for merging was found. */ trb->trb_seqs = trbs.trb_seqs; trb->trb_seqe = trbs.trb_seqe; trb->trb_m = trbs.trb_m; @@ -527,9 +535,9 @@ LIST_INSERT_HEAD(&tp->rcv_reass_sack, trb, trb_sack); tp->rcv_reass_size += SEQ_DELTA(trbs.trb_seqs, trbs.trb_seqe); tp->rcv_reass_blocks++; - if (RB_EMPTY(&tp->rcv_reass)) { + if (tp->rcv_reass_blocks == 1)) { KASSERT(tcp_timer_active(tp, TT_REASS) == 0, - ("%s: ", __func__)); + ("%s: reassembly timer already active", __func__)); tcp_timer_activate(tp, TT_REASS, tcp_reass_timeout); } TCPSTAT_INC(tcps_reass_blocks); @@ -541,9 +549,7 @@ KASSERT(tcp_reass_verify(tp, 1), ("%s: reassembly queue went inconsistent", __func__)); - /* - * Deliver data if we've got the missing segment. - */ + /* Deliver data if we've got the missing segment. */ if (trb->trb_seqs == tp->rcv_nxt) goto present; @@ -574,7 +580,7 @@ } if (trb == &trbs) - m_freem(trb->trb_m); + m_freem(trb->trb_m); /* NB: trb_m can be =! NULL */ else tcp_reass_free(tp, trb); From owner-p4-projects@FreeBSD.ORG Tue Jun 29 08:26:52 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 989C71065707; Tue, 29 Jun 2010 08:26:52 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C6081065701 for ; Tue, 29 Jun 2010 08:26:52 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 488468FC13 for ; Tue, 29 Jun 2010 08:26:52 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5T8QqLJ071412 for ; Tue, 29 Jun 2010 08:26:52 GMT (envelope-from andre@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5T8Qq7S071410 for perforce@freebsd.org; Tue, 29 Jun 2010 08:26:52 GMT (envelope-from andre@freebsd.org) Date: Tue, 29 Jun 2010 08:26:52 GMT Message-Id: <201006290826.o5T8Qq7S071410@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andre@freebsd.org using -f From: Andre Oppermann To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180313 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 08:26:52 -0000 http://p4web.freebsd.org/@@180313?ac=10 Change 180313 by andre@andre_t61 on 2010/06/29 08:26:05 Import new reassembly queue implementation from //depot/projects/tcp_reass/netinet/tcp_reass.c #56/56 Affected files ... .. //depot/projects/tcp_new/netinet/tcp_reass.c#3 edit Differences ... ==== //depot/projects/tcp_new/netinet/tcp_reass.c#3 (text+ko) ==== @@ -1,6 +1,6 @@ /*- - * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 2007-2009 + * Andre Oppermann, Internet Business Solutions AG. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,14 +27,85 @@ * SUCH DAMAGE. * * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95 + * $FreeBSD: src/sys/netinet/tcp_reass.c,v 1.352 2007/05/13 22:16:13 andre Exp $ */ #include -__FBSDID("$FreeBSD: src/sys/netinet/tcp_reass.c,v 1.353 2007/10/07 20:44:24 silby Exp $"); +__FBSDID("$FreeBSD: src/sys/netinet/tcp_reass.c,v 1.364 2009/08/01 19:26:27 rwatson Exp $"); + +/* + * Operational overview of TCP reassembly: + * + * It is the purpose of tcp reassembly to store segments that are received + * out of order. This happens when packets are lost along the way due to + * various reasons. The most common one is traffic overload which causes + * routers to drop packets for brief moments. + * + * Upon arrival of the missing segment the whole chain of stored contiguous + * segments is moved into the socket buffer at once. In case of multiple + * missing segments the remainder kept in the queue until the next missing + * segment arrives. + * + * When the TCP receiver is in reassembly state *all* arrving segments are + * passed through the reassembly queue until all missing segments have been + * received and all data is dequeued. + * + * Implementation details and choices: + * + * Instead of storing all segments on their own and tracking each with + * with a queue structure we build blocks of contiguous segments merged + * together. This way one missing segment needs only one queue structure + * tracking the whole block of following contiguous segments. If a new + * segment matches the end of one block and the start of the next block + * the two are joined together. If no match is found a new block is created. + * + * Instead of a classical list or tailqueue a red-black tree is used to + * cope with arbitrary complexity of the blocks and missing segments. A + * queue has O(n) worst case behavior whereas the red-black tree is + * O(log n). This prevents complexity attacks where a long chain of + * blocks would have to be traversed to find the right place for the new + * segment. Especially with high bandwidth*delay product links and large + * socket buffers this is a valid concern. + * + * For the segment merging into a block queue structure the operator can + * chose between time and space efficiency. For time efficiency only the + * head or tail mbuf chain pointers are updated with the new segments mbuf. + * This results in a minimal amount of data accesses and no memory allocations + * unless a new block is created. For space efficiency mbufs and mbuf chains + * are compacted and possibly merged together. It may even allocate a new + * and larger mbuf(-chain) to store the segment data with less overhead and + * less wasted space. This makes it immune against mbuf exhaustion attacks + * where only tiny amounts of data are received per segment, possibly only + * one byte. Usually network drivers allocate only mbuf cluster of 2KBytes + * on receive no matter how large the packet actually is for efficiency + * reasons and because can't easily know at DMA time how large the packet + * effectively actually is. + * + * To prevent resource exhaustion attacks a local and global limit governs + * the number of reassembly blocks. The local limit prevents single connections + * from monopolizing the global limit. When used in space efficient mode + * the total memory consumption of the reassembly queue can't be more than + * the receive socket buffer size. To prevent lost connections from holding + * on for too long a timeout causes flushing of all queued data. + * + * The reassembly queue block structure is also used to track SACK information + * as the data receiver. A double-linked list is added that tracks the blocks + * LIFO order of their arrival or updating. + * + * Implemented / relevant RFC's: + * RFC793: Transmission Control Protocol + * RFC1122: section 4.2.2.20 and section 4.2.2.21 + * RFC2018: SACK, section 4 including all optional parts marked as "SHOULD" + * RFC2883: D-SACK, section 4 + * + * TODO: + * - D-SACK when only one SACK slot available? + * - Direct pointer to highest seqnum block in RB-tree? + * - Remove T/TCP gonk. + * - Lots of testing. + */ #include "opt_inet.h" -#include "opt_inet6.h" -#include "opt_tcpdebug.h" #include #include @@ -50,236 +121,668 @@ #include #include +#include #include #include #include -#include #include #include #include -#include -#include -#include -#include #include #include #include #include #include -#include #include -#ifdef TCPDEBUG -#include -#endif /* TCPDEBUG */ + +uma_zone_t tcp_reass_zone; SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static int tcp_reass_maxseg = 0; -SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, - &tcp_reass_maxseg, 0, - "Global maximum number of TCP Segments in Reassembly Queue"); +static int tcp_reass_enable = 1; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, enable, CTLFLAG_RW, + &tcp_reass_enable, 0, + "Enable/disable use of TCP reassembly queue"); + +static int tcp_reass_maxblocks = 32; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxblocks, CTLFLAG_RW, + &tcp_reass_maxblocks, 0, + "Per connection limit of TCP segment blocks in reassembly queue"); + +static int tcp_reass_globalmaxblocks = 65535; +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, globalmaxblocks, + CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_TUN, &tcp_reass_zone, 0, + sysctl_zonelimit, "I", + "Global limit of TCP segment blocks in reassembly queue"); + +static int tcp_reass_timeout = 0; +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, timeout, CTLTYPE_INT|CTLFLAG_RW, + &tcp_reass_timeout, 0, sysctl_msec_to_ticks, "I", + "Reassembly queue flush timeout in milliseconds"); + +static int tcp_reass_spacetime = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, space_time, CTLFLAG_RW, + &tcp_reass_spacetime, 0, + "Reassembly queue strategy of space vs. time efficiency"); + +static struct tcp_reass_block * + tcp_reass_merge(struct tcp_reass_block *, struct tcp_reass_block *); + +/* + * Trim empty mbufs from the head of an mbuf chain. + */ +static struct mbuf * +m_trimhead(struct mbuf *m) +{ + + while (m != NULL && m->m_len == 0) + m = m_free(m); + + return (m); +} + +/* + * Initialize TCP reassembly zone on startup. + */ +void +tcp_reass_init(void) +{ + + TUNABLE_INT_FETCH("net.inet.tcp.reass.globalmaxblocks", + &tcp_reass_globalmaxblocks); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof(struct tcp_reass_block), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + uma_zone_set_max(tcp_reass_zone, tcp_reass_globalmaxblocks); + tcp_reass_timeout = 2 * TCPTV_MSL; +} + +/* + * Compare function implementing the ranged lookup on the RB tree. + * NB: The tree must never have any overlapping elements. + */ +static __inline int +tcp_reass_cmp(struct tcp_reass_block *a, struct tcp_reass_block *b) +{ + + if (SEQ_LT(a->trb_seqe, b->trb_seqs)) + return (-1); + else if (SEQ_GT(a->trb_seqs, b->trb_seqe)) + return (1); + else + return (0); +} + +RB_PROTOTYPE_STATIC(tcp_ra, tcp_reass_block, trb_rb, tcp_reass_cmp); +RB_GENERATE_STATIC(tcp_ra, tcp_reass_block, trb_rb, tcp_reass_cmp); + +/* + * Verify the integrity of the reassembly queue. + */ +#ifdef INVARIANTS +static int +tcp_reass_verify(struct tcpcb *tp, int prepost) +{ + int i = 0, size = 0, total = 0; + struct mbuf *m; + struct tcp_reass_block *trb, *trbn; -int tcp_reass_qsize = 0; -SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_RD, - &tcp_reass_qsize, 0, - "Global number of TCP Segments currently in Reassembly Queue"); + RB_FOREACH_SAFE(trb, tcp_ra, &tp->rcv_reass, trbn) { + KASSERT(SEQ_LT(trb->trb_seqs, trb->trb_seqe), + ("%s: trb_seqs >= trb_seqe", __func__)); + KASSERT(SEQ_GT(trb->trb_seqs, tp->rcv_nxt) || + prepost, ("%s: rcv_nxt >= trb_seqs", __func__)); + KASSERT(trb->trb_m != NULL, + ("%s: trb_m == NULL", __func__)); + KASSERT(trb->trb_mt != NULL, + ("%s: trb_mt == NULL", __func__)); + size = SEQ_DELTA(trb->trb_seqs, trb->trb_seqe); + KASSERT(size == m_length(trb->trb_m, &m), + ("%s: seq# size != actual mbuf size", __func__)); + KASSERT(trb->trb_mt == m, + ("%s: trb_mt is not last mbuf", __func__)); + KASSERT(trbn == NULL || SEQ_LT(trb->trb_seqe, trbn->trb_seqs), + ("%s: overlaps into next block", __func__)); + total += size; + i++; + } + KASSERT(tp->rcv_reass_size == total, + ("%s: rcv_reass_size not correct", __func__)); -static int tcp_reass_maxqlen = 48; -SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxqlen, CTLFLAG_RW, - &tcp_reass_maxqlen, 0, - "Maximum number of TCP Segments per individual Reassembly Queue"); + LIST_FOREACH(trb, &tp->rcv_reass_sack, trb_sack) { + i--; + } + KASSERT(i == 0, + ("%s: sack list incorrect", __func__)); -static int tcp_reass_overflows = 0; -SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD, - &tcp_reass_overflows, 0, - "Global number of TCP Segment Reassembly Queue Overflows"); + return (1); +} +#endif /* INVARIANTS */ -/* Initialize TCP reassembly queue */ +/* + * Remove a single block from the reassembly queue + * and free all of its mbufs, if any. + */ static void -tcp_reass_zone_change(void *tag) +tcp_reass_free(struct tcpcb *tp, struct tcp_reass_block *trb) { - tcp_reass_maxseg = nmbclusters / 16; - uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg); + trb = RB_REMOVE(tcp_ra, &tp->rcv_reass, trb); + KASSERT(trb != NULL, ("%s: RB_REMOVE failed", __func__)); + LIST_REMOVE(trb, trb_sack); + m_freem(trb->trb_m); + tp->rcv_reass_size -= SEQ_DELTA(trb->trb_seqs, trb->trb_seqe); + tp->rcv_reass_blocks--; + uma_zfree(tcp_reass_zone, trb); } -uma_zone_t tcp_reass_zone; +/* + * Remove and free all blocks from the reassembly queue. + */ +void +tcp_reass_flush(struct tcpcb *tp) +{ + struct tcp_reass_block *trb, *trbn; + + INP_WLOCK_ASSERT(tp->t_inpcb); + KASSERT(tcp_reass_verify(tp, 0), + ("%s: reassembly queue inconsistent", __func__)); + + RB_FOREACH_SAFE(trb, tcp_ra, &tp->rcv_reass, trbn) { + tcp_reass_free(tp, trb); + } + + KASSERT(tp->rcv_reass_size == 0, + ("%s: rcv_reass_size not zero after flushing", __func__)); +} -void -tcp_reass_init(void) +/* + * Move block to front of SACK list to report SACK blocks in LIFO order. + * RFC2018: section 4 + */ +static __inline void +tcp_reass_sacktrack(struct tcpcb *tp, struct tcp_reass_block *trb) { - tcp_reass_maxseg = nmbclusters / 16; - TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &tcp_reass_maxseg); - tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg); - EVENTHANDLER_REGISTER(nmbclusters_change, - tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); + if (LIST_FIRST(&tp->rcv_reass_sack) != trb) { + LIST_REMOVE(trb, trb_sack); + LIST_INSERT_HEAD(&tp->rcv_reass_sack, trb, trb_sack); + } } +/* + * Integrate the new segment into the reassembly queue. When the segment + * matches RCV.NXT append it to the socket buffer including all eglible + * data from the reassembly queue. + * + * NB: We must always consume the mbuf. Either by appeding it to + * the queue or by freeing it. + */ int -tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) +tcp_reass(struct tcpcb *tp, struct tcphdr *th, struct mbuf *m, int len, int hlen) { - struct tseg_qent *q; - struct tseg_qent *p = NULL; - struct tseg_qent *nq; - struct tseg_qent *te = NULL; + int thflags = 0; + tcp_seq th_seq; struct socket *so = tp->t_inpcb->inp_socket; - int flags; + struct tcp_reass_block *trb = NULL, *trbn; + struct tcp_reass_block trbs; - INP_LOCK_ASSERT(tp->t_inpcb); + INP_WLOCK_ASSERT(tp->t_inpcb); /* - * XXX: tcp_reass() is rather inefficient with its data structures - * and should be rewritten (see NetBSD for optimizations). While - * doing that it should move to its own file tcp_reass.c. + * Check if it is really neccessary to do all the work. */ + if (!tcp_reass_enable && RB_EMPTY(&tp->rcv_reass)) + goto done; /* - * Call with th==NULL after become established to + * Call with th==NULL after becoming established to * force pre-ESTABLISHED data up to user socket. + * XXX: Was used for T/TCP of which code remains. */ - if (th == NULL) + if (th == NULL) { + if (!TCPS_HAVEESTABLISHED(tp->t_state) || + RB_EMPTY(&tp->rcv_reass) || + ((trb = RB_MIN(tcp_ra, &tp->rcv_reass)) && + trb->trb_seqs != tp->rcv_nxt)) + return (0); + trb = RB_MIN(tcp_ra, &tp->rcv_reass); goto present; + } + + KASSERT(th != NULL, ("%s: th is NULL", __func__)); + KASSERT(m != NULL, ("%s: m is NULL", __func__)); + KASSERT(len + hlen == m_length(m, NULL), + ("%s: len + hlen != mbuf length", __func__)); + KASSERT(hlen <= m_length(m, NULL), + ("%s: hlen > mbuf length", __func__)); + + /* + * Store TCP header information in local variables as + * we may lose access to it after header dropping and + * mbuf compacting. + */ + thflags = th->th_flags; + th_seq = th->th_seq; + th = NULL; /* Prevent further use. */ + + KASSERT(SEQ_GEQ(th_seq, tp->rcv_nxt), + ("%s: sequence number below rcv_nxt", __func__)); + KASSERT(!(tp->rcv_nxt == th_seq) || !(RB_EMPTY(&tp->rcv_reass)), + ("%s: got missing segment but queue is empty", __func__)); + KASSERT(tcp_reass_verify(tp, 0), + ("%s: reassembly queue already inconsistent", __func__)); /* * Limit the number of segments in the reassembly queue to prevent * holding on to too many segments (and thus running out of mbufs). * Make sure to let the missing segment through which caused this - * queue. Always keep one global queue entry spare to be able to - * process the missing segment. + * queue. + * + * Count the gross space used by the mbufs in the reassembly queue + * and limit it to the free space in the socket buffer. This way + * the reassembly queue can never consume more mbuf space than the + * socket buffer got allocated anyway and it reflects the actual + * amount of kernel memory used. This effectively prevents mbuf + * exhaustion due to pathological traffic (one byte segments with + * a hole each time) on a single connection. + * + * Counting the gross mbuf space effectively sets the net data + * limit lower than the socket buffer would allow. + * Don't underestimates the effective free space in the socket + * buffer vs. actual real data with 2k clusters and 1500 byte + * packets by introducing a correction factor of 11/8th. */ - if (th->th_seq != tp->rcv_nxt && - (tcp_reass_qsize + 1 >= tcp_reass_maxseg || - tp->t_segqlen >= tcp_reass_maxqlen)) { - tcp_reass_overflows++; - tcpstat.tcps_rcvmemdrop++; - m_freem(m); - *tlenp = 0; - return (0); + if (th_seq != tp->rcv_nxt && + tp->rcv_reass_blocks > tcp_reass_maxblocks) { + //(sbspace(&so->so_rcv) / 8 * 11) + TCPSTAT_INC(tcps_reass_overflow); + TCPSTAT_INC(tcps_rcvmemdrop); + goto done; } /* - * Allocate a new queue entry. If we can't, or hit the zone limit - * just drop the pkt. + * FIN handling is a bit tricky. + * We cannot trust a FIN that goes into the reassembly queue. + * It can be easily spoofed as it may be anywhere in the receive + * window (see RST attack mitigation in tcp-secure). + * For this reason (and complexity avoidance) we generally ignore + * any FIN arriving at the reassembly queue with one exception; + * When it exactly matches rcv_nxt together with any data in the + * same segment we can conclude it to be genuine and proceed with + * flushing any other data waiting in the reassembly queue. + * A FIN is part of the sequence space and will get retransmitted + * if it was genuine. + * This approach is based on a discussion on TCPM mailing list. */ - te = uma_zalloc(tcp_reass_zone, M_NOWAIT); - if (te == NULL) { - tcpstat.tcps_rcvmemdrop++; - m_freem(m); - *tlenp = 0; - return (0); + if ((thflags & TH_FIN) && tp->rcv_nxt == th_seq) { + tcp_reass_flush(tp); + if (m->m_len == 0) { + tcp_timer_activate(tp, TT_REASS, 0); + return (thflags); + } + } else if (len == 0) + goto done; + else + thflags &= ~TH_FIN; + + /* Statistics. */ + if (tp->rcv_nxt != th_seq) { + TCPSTAT_INC(tcps_rcvoopack); + TCPSTAT_ADD(tcps_rcvoobyte, len); } - tp->t_segqlen++; - tcp_reass_qsize++; /* - * Find a segment which begins after this one does. + * Remove and free packet header and mtags. + * Trim empty mbufs from head of chain. + * Compact the mbuf chain. */ - LIST_FOREACH(q, &tp->t_segq, tqe_q) { - if (SEQ_GT(q->tqe_th->th_seq, th->th_seq)) - break; - p = q; - } + m_demote(m, 1); + m_adj(m, hlen); + m = m_trimhead(m); + if (tcp_reass_spacetime && m->m_next != NULL) + m = m_collapse(m, M_DONTWAIT, 1024); + + KASSERT(m != NULL, ("%s: m is NULL after collapse", __func__)); + + /* Set up search structure. */ + trbs.trb_seqs = th_seq; + trbs.trb_seqe = th_seq + len; + trbs.trb_m = m; + trbs.trb_mt = m_last(m); /* - * If there is a preceding segment, it may provide some of - * our data already. If so, drop the data from the incoming - * segment. If it provides all of our data, drop us. + * Find a block that has at least partial overlap to either side. + * If no block is found either insert a new one or use the stack + * if the segment directly fits rcv_nxt. + * RFC793: section 3.9, page 69-76 + * RFC2018: section 3 */ - if (p != NULL) { - int i; - /* conversion to int (in i) handles seq wraparound */ - i = p->tqe_th->th_seq + p->tqe_len - th->th_seq; - if (i > 0) { - if (i >= *tlenp) { - tcpstat.tcps_rcvduppack++; - tcpstat.tcps_rcvdupbyte += *tlenp; - m_freem(m); - uma_zfree(tcp_reass_zone, te); - tp->t_segqlen--; - tcp_reass_qsize--; - /* - * Try to present any queued data - * at the left window edge to the user. - * This is needed after the 3-WHS - * completes. - */ - goto present; /* ??? */ + if ((trb = RB_FIND(tcp_ra, &tp->rcv_reass, &trbs)) != NULL) { + /* + * The new segment is a retransmit and within an already + * received block and thus a full duplicate. + * + * Report it with D-SACK only if it is a subset of and + * not equal to the already existing block. + * RFC2883: section 4, part (1) and (4) + * RFC2883: section 4.1, Reporting Full Duplicate Segments + */ + if (SEQ_GEQ(trbs.trb_seqs, trb->trb_seqs) && + SEQ_LEQ(trbs.trb_seqe, trb->trb_seqe)) { + tcp_reass_sacktrack(tp, trb); + if (SEQ_GT(trbs.trb_seqs, trb->trb_seqs) || + SEQ_LT(trbs.trb_seqe, trb->trb_seqe)) { + tp->rcv_reass_dsack.start = trbs.trb_seqs; + tp->rcv_reass_dsack.end = trbs.trb_seqe; } - m_adj(m, i); - *tlenp -= i; - th->th_seq += i; + TCPSTAT_INC(tcps_rcvduppack); + TCPSTAT_ADD(tcps_rcvdupbyte, len); + goto done; + } + + /* + * Merge the new segment with the already existing block. + */ + tp->rcv_reass_size += SEQ_DELTA(trbs.trb_seqs, trbs.trb_seqe); + (void)tcp_reass_merge(trb, &trbs); + tcp_reass_sacktrack(tp, trb); + + /* + * Update the D-SACK information. + * RFC2883: section 4.2, Reporting Partial Duplicate Segments + */ + if ((len = SEQ_DELTA(trbs.trb_seqs, trbs.trb_seqe)) > 0) { + tp->rcv_reass_size -= len; + tp->rcv_reass_dsack.start = trbs.trb_seqs; + tp->rcv_reass_dsack.end = trbs.trb_seqe; + TCPSTAT_INC(tcps_rcvpartduppack); + TCPSTAT_ADD(tcps_rcvpartdupbyte, len); + } + + /* + * Merge in previous/next block(s) if there is overlap. + */ + while ((trbn = RB_PREV(tcp_ra, &tp->rcv_reass, trb)) != NULL && + SEQ_LEQ(trb->trb_seqs, trbn->trb_seqe)) { + trbn = tcp_reass_merge(trb, trbn); + tcp_reass_free(tp, trbn); + TCPSTAT_INC(tcps_reass_merge); + } + while ((trbn = RB_NEXT(tcp_ra, &tp->rcv_reass, trb)) != NULL && + SEQ_GEQ(trb->trb_seqe, trbn->trb_seqs)) { + trbn = tcp_reass_merge(trb, trbn); + tcp_reass_free(tp, trbn); + TCPSTAT_INC(tcps_reass_merge); + } + } else if (tp->rcv_nxt == th_seq) { + /* + * For segments attaching to RCV.NXT do not allocate + * a new block structure to prevent failure under tight + * memory conditions. Instead use temporary stack based + * storage. + */ + trb = &trbs; + } else if ((trb = (struct tcp_reass_block *)uma_zalloc(tcp_reass_zone, (M_NOWAIT|M_ZERO))) != NULL) { + /* Insert new block as no eglible existing block for merging was found. */ + trb->trb_seqs = trbs.trb_seqs; + trb->trb_seqe = trbs.trb_seqe; + trb->trb_m = trbs.trb_m; + trb->trb_mt = trbs.trb_mt; + trbn = RB_INSERT(tcp_ra, &tp->rcv_reass, trb); + KASSERT(trbn == NULL, ("%s: RB_INSERT failed", __func__)); + LIST_INSERT_HEAD(&tp->rcv_reass_sack, trb, trb_sack); + tp->rcv_reass_size += SEQ_DELTA(trbs.trb_seqs, trbs.trb_seqe); + tp->rcv_reass_blocks++; + if (tp->rcv_reass_blocks == 1)) { + KASSERT(tcp_timer_active(tp, TT_REASS) == 0, + ("%s: reassembly timer already active", __func__)); + tcp_timer_activate(tp, TT_REASS, tcp_reass_timeout); } + TCPSTAT_INC(tcps_reass_blocks); + } else { + /* Memory allocation failure. */ + TCPSTAT_INC(tcps_rcvmemdrop); + goto done; } - tcpstat.tcps_rcvoopack++; - tcpstat.tcps_rcvoobyte += *tlenp; + KASSERT(tcp_reass_verify(tp, 1), + ("%s: reassembly queue went inconsistent", __func__)); + + /* Deliver data if we've got the missing segment. */ + if (trb->trb_seqs == tp->rcv_nxt) + goto present; + + return (0); +present: /* - * While we overlap succeeding segments trim them or, - * if they are completely covered, dequeue them. + * Present data to user, advancing rcv_nxt through the + * completed sequence space. */ - while (q) { - int i = (th->th_seq + *tlenp) - q->tqe_th->th_seq; - if (i <= 0) - break; - if (i < q->tqe_len) { - q->tqe_th->th_seq += i; - q->tqe_len -= i; - m_adj(q->tqe_m, i); - break; - } + KASSERT(trb != NULL, + ("%s: queue empty at present", __func__)); + KASSERT(trb->trb_seqs == tp->rcv_nxt, + ("%s: first block does not match rcv_nxt", __func__)); + + TCPSTAT_INC(tcps_reass_missingseg); - nq = LIST_NEXT(q, tqe_q); - LIST_REMOVE(q, tqe_q); - m_freem(q->tqe_m); - uma_zfree(tcp_reass_zone, q); - tp->t_segqlen--; - tcp_reass_qsize--; - q = nq; + SOCKBUF_LOCK(&so->so_rcv); + /* + * We can only ever dequeue one consecutive + * block of data at most. + */ + if (!(so->so_rcv.sb_state & SBS_CANTRCVMORE)) { + sbappendstream_locked(&so->so_rcv, trb->trb_m); + tp->rcv_nxt += SEQ_DELTA(trb->trb_seqs, trb->trb_seqe); + trb->trb_m = NULL; + trb->trb_mt = NULL; } - /* Insert the new segment queue entry into place. */ - te->tqe_m = m; - te->tqe_th = th; - te->tqe_len = *tlenp; + if (trb == &trbs) + m_freem(trb->trb_m); /* NB: trb_m can be =! NULL */ + else + tcp_reass_free(tp, trb); + + /* NB: sorwakeup_locked() does an implicit socket buffer unlock. */ + sorwakeup_locked(so); + + /* + * Don't hold on to data in the reassembly queue for too long. + * Kernel memory is limited and if the connection doesn't make + * any progress in filling the holes we don't want to wait + * forever to prevent memory exhaustion attacks. The sender + * can always retransmit again. + * RFC2018: section 8, Data Receiver Reneging + * + * Restart the reassembly queue flush timer after advancing + * the sequence space and if the queue still isn't empty. + */ + if (tcp_reass_timeout && !RB_EMPTY(&tp->rcv_reass)) + tcp_timer_activate(tp, TT_REASS, tcp_reass_timeout); + else if (tcp_timer_active(tp, TT_REASS)) + tcp_timer_activate(tp, TT_REASS, 0); + + ND6_HINT(tp); + return (thflags); + +done: + m_freem(m); + return (0); +} + +/* + * Trim a reassembly block. + * A positive value is from head, negative from tail. + */ +static void +tcp_reass_trim(struct tcp_reass_block *trb, int i) +{ + + m_adj(trb->trb_m, i); - if (p == NULL) { - LIST_INSERT_HEAD(&tp->t_segq, te, tqe_q); + /* + * Update the tail pointer or free empty mbufs + * at the head of the chain. + */ + if (i < 0) { + trb->trb_mt = m_last(trb->trb_m); + trb->trb_seqe -= i; } else { - LIST_INSERT_AFTER(p, te, tqe_q); + trb->trb_m = m_trimhead(trb->trb_m); + trb->trb_seqs += i; + } +} + +/* + * Merge one or more consecutive blocks together. The number of + * redundant bytes is reported as the difference between trbn-> + * trb_seqs and trb_seqe. + * + * NB: trbn is always merged into trb! + */ +static struct tcp_reass_block * +tcp_reass_merge(struct tcp_reass_block *trb, struct tcp_reass_block *trbn) +{ + int i; + tcp_seq s; + + KASSERT(trb != NULL && trbn != NULL, + ("%s: incomplete input", __func__)); + KASSERT(SEQ_LT(trbn->trb_seqs, trb->trb_seqs) || + SEQ_GT(trbn->trb_seqe, trb->trb_seqe), + ("%s: blocks not overlapping", __func__)); + + /* + * Replace, prepend or append a block. + */ + if (SEQ_LEQ(trbn->trb_seqs, trb->trb_seqs) && + SEQ_GEQ(trbn->trb_seqe, trb->trb_seqe)) { + + i = SEQ_DELTA(trb->trb_seqs, trbn->trb_seqe); + s = trb->trb_seqs; + + m_freem(trb->trb_m); + trb->trb_seqs = trbn->trb_seqs; + trb->trb_seqe = trbn->trb_seqe; + trb->trb_m = trbn->trb_m; + trb->trb_mt = trbn->trb_mt; + + TCPSTAT_INC(tcps_reass_replace); + + } else if (SEQ_LT(trbn->trb_seqs, trb->trb_seqs)) { + + if ((i = SEQ_DELTA(trb->trb_seqs, trbn->trb_seqe)) > 0) + tcp_reass_trim(trbn, -i); + + s = trb->trb_seqs; + trb->trb_seqs = trbn->trb_seqs; + trbn->trb_mt->m_next = trb->trb_m; + trb->trb_m = trbn->trb_m; + + if (tcp_reass_spacetime) { + trbn->trb_mt = m_collapse(trbn->trb_mt, M_DONTWAIT, 1024); + trb->trb_mt = m_last(trbn->trb_mt); + } + + } else if (SEQ_GT(trbn->trb_seqe, trb->trb_seqe)) { + + if ((i = SEQ_DELTA(trb->trb_seqe, trbn->trb_seqs)) > 0) + tcp_reass_trim(trbn, i); + + s = trb->trb_seqe; + trb->trb_seqe = trbn->trb_seqe; + trb->trb_mt->m_next = trbn->trb_m; + + if (tcp_reass_spacetime) { + trb->trb_mt = m_collapse(trb->trb_mt, M_DONTWAIT, 1024); + trb->trb_mt = m_last(trb->trb_mt); + } else + trb->trb_mt = trbn->trb_mt; + + } else + return (NULL); + + trbn->trb_seqs = s; + trbn->trb_seqe = trbn->trb_seqs + i; + trbn->trb_m = NULL; + trbn->trb_mt = NULL; + return (trbn); +} + +/* + * Put the sequence number of the reassembly queue blocks into the + * SACK options of an outgoing segment. If a D-SACK block is available + * insert it in the first position followed by the regular SACK blocks. + * RFC2018: section 3, Sack Option Format + * RFC2018: section 4, Generating Sack Options: Data Receiver Behavior + * RFC2883: section 4, Use of the SACK option for reporting a duplicate segment + */ +int +tcp_reass_sack(struct tcpcb *tp, u_char *optp, int numsacks) +{ + int nsacks = 0; + tcp_seq sack_seq; + struct tcp_reass_block *trb, trbs; + + INP_WLOCK_ASSERT(tp->t_inpcb); + KASSERT(numsacks > 0, + ("%s: zero sack blocks to add", __func__)); + KASSERT(!LIST_EMPTY(&tp->rcv_reass_sack), + ("%s: sack list empty", __func__)); + + /* + * Create fake SACK block on the stack for D-SACK and prepend it. + * RFC2883: section 4, part (3) + */ + if (tp->rcv_reass_dsack.start != tp->rcv_reass_dsack.end) { + bzero(&trbs, sizeof(trbs)); + trbs.trb_seqs = htonl(tp->rcv_reass_dsack.start); + trbs.trb_seqe = htonl(tp->rcv_reass_dsack.end); + LIST_INSERT_HEAD(&tp->rcv_reass_sack, &trbs, trb_sack); + } + + /* + * The most recent block must appear first. Add the other + * blocks in most recent created or updated order. + * RFC2018: section 3 and 4, part (4) and (5) + */ + LIST_FOREACH(trb, &tp->rcv_reass_sack, trb_sack) { + if (numsacks < 1) + break; + sack_seq = htonl(trb->trb_seqs); + bcopy((u_char *)&sack_seq, optp, sizeof(sack_seq)); + optp += sizeof(sack_seq); + sack_seq = htonl(trb->trb_seqe); + bcopy((u_char *)&sack_seq, optp, sizeof(sack_seq)); + optp += sizeof(sack_seq); + numsacks--; + nsacks++; } -present: /* - * Present data to user, advancing rcv_nxt through - * completed sequence space. + * Remove fake D-SACK block again and zero out the D-SACK + * information. It must be reported only once. + * RFC2883: section 4, part (2) */ - if (!TCPS_HAVEESTABLISHED(tp->t_state)) - return (0); - q = LIST_FIRST(&tp->t_segq); - if (!q || q->tqe_th->th_seq != tp->rcv_nxt) - return (0); - SOCKBUF_LOCK(&so->so_rcv); - do { - tp->rcv_nxt += q->tqe_len; - flags = q->tqe_th->th_flags & TH_FIN; - nq = LIST_NEXT(q, tqe_q); - LIST_REMOVE(q, tqe_q); - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) - m_freem(q->tqe_m); - else - sbappendstream_locked(&so->so_rcv, q->tqe_m); - uma_zfree(tcp_reass_zone, q); - tp->t_segqlen--; - tcp_reass_qsize--; - q = nq; - } while (q && q->tqe_th->th_seq == tp->rcv_nxt); - //ND6_HINT(tp); - sorwakeup_locked(so); - return (flags); + if (LIST_FIRST(&tp->rcv_reass_sack) == &trbs) { + LIST_REMOVE(&trbs, trb_sack); + tp->rcv_reass_dsack.start = 0; + tp->rcv_reass_dsack.end = 0; + } + + return (nsacks); +} + +#ifdef DDB +static void +db_print_reassblocks(struct tcpcb *tp) +{ + struct tcp_reass_block *trb; + + RB_FOREACH(trb, tcp_ra, &tp->rcv_reass) { + db_printf(" reass block 0x%08x - 0x%08x\n", + trb->trb_seqs, trb->trb_seqe); + } } +#endif From owner-p4-projects@FreeBSD.ORG Tue Jun 29 21:26:05 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7B5841065675; Tue, 29 Jun 2010 21:26:05 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E62A1065674 for ; Tue, 29 Jun 2010 21:26:05 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E9DEB8FC16 for ; Tue, 29 Jun 2010 21:26:04 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5TLQ4H1087550 for ; Tue, 29 Jun 2010 21:26:04 GMT (envelope-from gpf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5TLQ40E087548 for perforce@freebsd.org; Tue, 29 Jun 2010 21:26:04 GMT (envelope-from gpf@FreeBSD.org) Date: Tue, 29 Jun 2010 21:26:04 GMT Message-Id: <201006292126.o5TLQ40E087548@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gpf@FreeBSD.org using -f From: Efstratios Karatzas To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180327 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 21:26:05 -0000 http://p4web.freebsd.org/@@180327?ac=10 Change 180327 by gpf@gpf_desktop on 2010/06/29 21:25:59 - fixed a minor bug in nfsrv_auditpath() wrapper function. We don't really need to have a file handle to get the parent of the vnode if e.g. our fs is ZFS, VOP_GETPARENT() does require a 'hint'. - found & fixed an interesting bug: I hadn't spotted this before because I wasn't auditing the class 'ad' (administrative), but now I saw that auditing this class causes my code to kernel panic. The kernel thread that traps via the nfssvc(2) syscall never really exits. It stays in the kernel as nfsd and services various NFS RPCs. So it never really audit_syscall_exit()s and the first time it will try to service an RPC and audit_nfs_enter(), it will kernel panic because we already have an active td_ar. Providing audit support for multiple simultaneous td_ars does not solve this problem so I applied a fix of sorts, please refer to the comment+code in sys/nfs/nfs_nfssvc.c. - minor typo fixes in /etc/audit_event - tried to add audit support for a few nfsv4 ops and hit a wall. I'm tired of saying that auditing paths from vnodes for UFS requires a connection between vnode + parent directory that contains it. For NFSv 2 & 3, we keep a 'hint' directory inode. This hint is kept with the file handle that is sent back to the client, et voila. NFSv4 has a peculiar way of doing a lot of things. For example, say we wish to acquire the fh of a regular file. This is the compound RPC: putfh(directory filehandle), lookup(file entry name), getfh(). Note that in NFSv4, lookup() is supposed to change the 'current file handle' (to that of the file that is looked up), and getfh() is supposed to return the file handle via the reply buffer of the RPC. In FreeBSD's nfsv4 implementation, the 'current' and saved file handles' are actually current and saved vnode pointers. The author notes that it might be cleaner to save & use fhs instead of vps. So, although NFSv3 would return a filehandle inside lookup(), NFSv4 will return the filehandle through getfh(). getfh() should push the current filehandle into the reply buffer of the rpc. But since the current filehandle is actually a vnode pointer, it can only do a VOP_VPTOFH() and therefore, not save the beforementioned hint. To put it simply, we can't audit file paths when the namecache fails us, because of the way nfsv4 is implemented. It will require some considerable change to work the way I want it to. Note: excuse the lengthy description but I'm writing this in hopes of my mentor and Rick Macklem one day reading this. Thank you Affected files ... .. //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/etc/audit_event#4 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdsocket.c#9 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdsubs.c#3 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/nfs/nfs_nfssvc.c#2 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/nfsserver/nfs_serv.c#17 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit.c#8 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit_bsm.c#11 edit Differences ... ==== //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/etc/audit_event#4 (text) ==== @@ -391,7 +391,7 @@ 2023:AUE_NFS_CLOSE:nfsrv_close():cl 2024:AUE_NFS_DELEGPURGE:nfsrv_delegpurge():ad 2025:AUE_NFS_DELEGRETURN:nfsrv_delegreturn():ad -2026:AUE_NFSv4_GETFH:nfsrv_getfh():ad +2026:AUE_NFSv4_GETFH:nfsrv4_getfh():ad 2027:AUE_NFS_LOCK:nfsrv_lock():fm 2028:AUE_NFS_LOCKT:nfsrv_lockt():fm 2029:AUE_NFS_LOCKU:nfsrv_locku():fm @@ -403,7 +403,7 @@ 2035:AUE_NFS_OPENDOWNGRADE:nfsrv_opendowngrade():fm 2036:AUE_NFS_PUTFH:nfsrv_putfh():ad 2037:AUE_NFS_PUTPUBFH:nfsrv_putpubfh():ad -2038:AUE_NFS_PUTROOTFH:nfsrv_rootfh():ad +2038:AUE_NFS_PUTROOTFH:nfsrv_putrootfh():ad 2039:AUE_NFS_RENEW:nfsrv_renew():ad 2040:AUE_NFS_RESTOREFH:nfsrv_restorefh():ad 2041:AUE_NFS_SAVEFH:nfsrv_savefh():ad ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdsocket.c#9 (text+ko) ==== @@ -436,6 +436,7 @@ nfsrvd_compound(nd, isdgram, p); printf("compound rpc exit\n"); } else { + printf("non compound rpc %d\n", nd->nd_procnum); if (nd->nd_flag & ND_NFSV2) nfsprot = ND_NFSV2; else @@ -736,14 +737,19 @@ } if (nfsv4_opflag[op].savereply) nd->nd_flag |= ND_SAVEREPLY; - NFSINCRGLOBAL(newnfsstats.srvrpccnt[nd->nd_procnum]); + NFSINCRGLOBAL(newnfsstats.srvrpccnt[nd->nd_procnum]); + AUDIT_NFS_ENTER(op, nd->nd_cred, curthread, ND_NFSV4); + if (nd->nd_nam != NULL) + AUDIT_ARG_SOCKADDR_IN((struct sockaddr_in *)nd->nd_nam); switch (op) { /* xxx gpf */ printf("op = %d\n", op); case NFSV4OP_PUTFH: error = nfsrv_mtofh(nd, &fh); - if (error) + if (error) { + printf("error! %p\n", curthread); goto nfsmout; + } if (!nd->nd_repstat) { nes.nes_vfslocked = vpnes.nes_vfslocked; nfsd_fhtovp(nd, &fh, &nvp, &nes, &mp, @@ -754,7 +760,12 @@ if (vp) vrele(vp); vp = nvp; + vref(vp); + AUDIT_ARG_VNODE1(vp); NFSVOPUNLOCK(vp, 0, p); + nfsrv_auditpath(vp, NULL, NULL, + (fhandle_t *)fh.nfsrvfh_data, 1); + vrele(vp); vpnes = nes; } break; @@ -770,7 +781,12 @@ if (vp) vrele(vp); vp = nvp; + vref(vp); + AUDIT_ARG_VNODE1(vp); NFSVOPUNLOCK(vp, 0, p); + nfsrv_auditpath(vp, NULL, NULL, + (fhandle_t *)nfs_pubfh.nfsrvfh_data, 1); + vrele(vp); vpnes = nes; } break; @@ -783,7 +799,12 @@ if (vp) vrele(vp); vp = nvp; + vref(vp); + AUDIT_ARG_VNODE1(vp); NFSVOPUNLOCK(vp, 0, p); + nfsrv_auditpath(vp, NULL, NULL, + (fhandle_t *)nfs_rootfh.nfsrvfh_data, 1); + vrele(vp); vpnes = nes; } } else if (nfsv4root_vp && nfsv4root_set) { @@ -813,6 +834,14 @@ savevpnes = vpnes; savemp = mp; } + /* XXXgpf: is this the correct filehandle? */ + if (savevp) { + nfsrv_auditpath(savevp, NULL, NULL, + (fhandle_t *)fh.nfsrvfh_data, 1); + vn_lock(savevp, LK_EXCLUSIVE); + AUDIT_ARG_VNODE1(savevp); + VOP_UNLOCK(savevp, 0); + } } else { nd->nd_repstat = NFSERR_NOFILEHANDLE; } @@ -820,6 +849,14 @@ case NFSV4OP_RESTOREFH: if (savevp) { nd->nd_repstat = 0; + /* XXXgpf: file handle? */ + vref(savevp); + nfsrv_auditpath(savevp, NULL, NULL, + NULL, 1); + vn_lock(savevp, LK_EXCLUSIVE); + AUDIT_ARG_VNODE1(savevp); + VOP_UNLOCK(savevp, 0); + vrele(savevp); /* If vp == savevp, a no-op */ if (vp != savevp) { VREF(savevp); @@ -945,8 +982,16 @@ if (nfsv4_opflag[op].modifyfs) NFS_STARTWRITE(NULL, &mp); NFSVOPLOCK(savevp, LK_EXCLUSIVE | LK_RETRY, p); + if (savevp) + vref(savevp); error = (*(nfsrv4_ops2[op]))(nd, isdgram, savevp, vp, p, &savevpnes, &vpnes); + if (savevp) { + if (nd->nd_procnum == NFSPROC_LINK) + nfsrv_auditpath(savevp, NULL, NULL, + (fhandle_t *)fh.nfsrvfh_data, 2); + vrele(savevp); + } if (nfsv4_opflag[op].modifyfs) NFS_ENDWRITE(mp); } else { @@ -981,6 +1026,7 @@ } } }; + AUDIT_NFS_EXIT(nd->nd_repstat, curthread); if (error) { if (error == EBADRPC || error == NFSERR_BADXDR) { nd->nd_repstat = NFSERR_BADXDR; @@ -999,6 +1045,9 @@ } } nfsmout: + /* XXXgpf: when error occurs, we may jump here */ + AUDIT_NFS_EXIT(nd->nd_repstat, curthread); + KASSERT(curthread->td_ar == NULL, ("gamw sto nfsmout: td->td_ar != NULL")); if (error) { if (error == EBADRPC || error == NFSERR_BADXDR) nd->nd_repstat = NFSERR_BADXDR; ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdsubs.c#3 (text+ko) ==== @@ -2061,6 +2061,9 @@ * fname - name used to reference vp inside dvp * fhp - file handle for vp * n - AUDIT_ARG_UPATH1 or AUDIT_ARG_UPATH2 + * + * Note: vp and dvp may be vref'd but not locks should be held on them as the + * two vn_fullpath_* KPIs may try to lock them themselves. */ void nfsrv_auditpath(vnode_t vp, vnode_t dvp, char *fname, fhandle_t *fhp, int n) @@ -2085,11 +2088,13 @@ success = 1; goto out; } + /* if our cache fails us */ - if (fhp != NULL && vp->v_mount != NULL) { + if (vp->v_mount != NULL) { uint64_t parent_hint; /* get the hint stored inside the file handle */ - VFS_FHHINT(vp->v_mount, &fhp->fh_fid, &parent_hint); + if (fhp != NULL) + VFS_FHHINT(vp->v_mount, &fhp->fh_fid, &parent_hint); vn_fullpath_nocache(vp, &fullpath, &freepath, parent_hint, PARENTHINT | WANTNAME); if (freepath != NULL) { ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/nfs/nfs_nfssvc.c#2 (text+ko) ==== @@ -79,7 +79,18 @@ KASSERT(!mtx_owned(&Giant), ("nfssvc(): called with Giant")); - AUDIT_ARG_CMD(uap->flag); + AUDIT_ARG_CMD(uap->flag); + /* + * XXX:gpf quick fix until I figure out something better. + * Even if Audit supports multiple simultaneous td_ars per + * kernel thread, we still want to end the audit record for + * nfs_svc so that Audit records for NFS RPCs that are serviced + * by this thread are recorded without any trouble such as waiting + * for nfssvc() to return before commiting them to the audit daemon. + * Problem is that we are now *not* recording the return value from + * the nfs server. + */ + AUDIT_SYSCALL_EXIT(0, td); error = priv_check(td, PRIV_NFS_DAEMON); if (error) ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/nfsserver/nfs_serv.c#17 (text+ko) ==== @@ -203,6 +203,9 @@ * fname - name used to reference vp inside dvp * fhp - file handle for vp * n - AUDIT_ARG_UPATH1 or AUDIT_ARG_UPATH2 + * + * Note: vp and dvp may be vref'd but not locks should be held on them as the + * two vn_fullpath_* KPIs may try to lock them themselves. */ static void nfsrv_auditpath(struct vnode *vp, struct vnode *dvp, char *fname, fhandle_t *fhp, int n) @@ -226,10 +229,11 @@ } /* if our cache fails us */ - if (fhp != NULL && vp->v_mount != NULL) { + if (vp->v_mount != NULL) { uint64_t parent_hint; /* get the hint stored inside the file handle */ - VFS_FHHINT(vp->v_mount, &fhp->fh_fid, &parent_hint); + if (fhp != NULL) + VFS_FHHINT(vp->v_mount, &fhp->fh_fid, &parent_hint); vn_fullpath_nocache(vp, &fullpath, &freepath, parent_hint, PARENTHINT | WANTNAME); if (freepath != NULL) { ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit.c#8 (text) ==== @@ -706,6 +706,9 @@ au_id_t auid; int error; + if (td->td_ar != NULL) { + printf("bug event = %d\n", td->td_ar->k_ar.ar_event); + } KASSERT(td->td_ar == NULL, ("audit_nfs_enter: td->td_ar != NULL")); KASSERT((td->td_pflags & TDP_AUDITREC) == 0, ("audit_nfs_enter: TDP_AUDITREC set")); @@ -797,7 +800,6 @@ audit_nfs_exit(int error, struct thread *td) { int retval; - /* * Commit the audit record as desired; once we pass the record into * audit_commit(), the memory is owned by the audit subsystem. The ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit_bsm.c#11 (text) ==== @@ -1648,6 +1648,44 @@ } break; + case AUE_NFS_PUTFH: + case AUE_NFS_PUTPUBFH: + case AUE_NFS_PUTROOTFH: + case AUE_NFS_RESTOREFH: + case AUE_NFS_SAVEFH: + UPATH1_VNODE1_TOKENS; + if (ARG_IS_VALID(kar, ARG_TEXT)) { + tok = au_to_text(ar->ar_arg_text); + kau_write(rec, tok); + } + break; + + /* XXXgpf: temporary fallthrough for nfsv4 events */ + case AUE_NFS_CLOSE: + case AUE_NFS_DELEGPURGE: + case AUE_NFS_DELEGRETURN: + case AUE_NFSv4_GETFH: + case AUE_NFS_LOCK: + case AUE_NFS_LOCKT: + case AUE_NFS_LOCKU: + case AUE_NFS_LOOKUPP: + case AUE_NFS_NVERIFY: + case AUE_NFS_OPEN: + case AUE_NFS_OPENATTR: + case AUE_NFS_OPENCONFIRM: + case AUE_NFS_OPENDOWNGRADE: + case AUE_NFS_RENEW: + case AUE_NFS_SECINFO: + case AUE_NFS_SETCLIENTID: + case AUE_NFS_SETCLIENTIDCFRM: + case AUE_NFS_VERIFY: + case AUE_NFS_RELEASELCKOWN: + if (ARG_IS_VALID(kar, ARG_TEXT)) { + tok = au_to_text(ar->ar_arg_text); + kau_write(rec, tok); + } + break; + case AUE_WAIT4: PROCESS_PID_TOKENS(1); if (ARG_IS_VALID(kar, ARG_VALUE)) { From owner-p4-projects@FreeBSD.ORG Tue Jun 29 22:39:26 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DEC9D1065673; Tue, 29 Jun 2010 22:39:25 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2F6A1065672 for ; Tue, 29 Jun 2010 22:39:25 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 90B678FC23 for ; Tue, 29 Jun 2010 22:39:25 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5TMdPYQ094060 for ; Tue, 29 Jun 2010 22:39:25 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5TMdPo1094058 for perforce@freebsd.org; Tue, 29 Jun 2010 22:39:25 GMT (envelope-from afiveg@FreeBSD.org) Date: Tue, 29 Jun 2010 22:39:25 GMT Message-Id: <201006292239.o5TMdPo1094058@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180333 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 22:39:26 -0000 http://p4web.freebsd.org/@@180333?ac=10 Change 180333 by afiveg@cottonmouth on 2010/06/29 22:39:01 Bugfixes: check the taskqueue with delayed tasks after disabling interrupts. Unfortunately, after disabling interrupts some delayed task can be in the queue and they can do some problems (kernel panics) Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#8 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#16 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#14 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#15 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#13 edit .. //depot/projects/soc2010/ringmap/current/sys/modules/ringmap/Makefile#2 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#19 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#19 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#4 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#4 edit .. //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#5 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#8 (text+ko) ==== @@ -360,7 +360,7 @@ return (cnt - ws); } - curr_slot = R_MODULO(SW_TAIL(ring) + 1); + curr_slot = R_MODULO( SW_TAIL(ring) + 1 ); if (!(ring->slot[curr_slot].is_ok)) { #ifdef __RINGMAP_DEB printf("Slot %d was not accepted by driver!\n", curr_slot); @@ -380,8 +380,12 @@ (*callback)(user, &pkthdr, datap); +#ifdef __RINGMAP_DEB + PRINT_SLOT(ring, ring->cur_slot_user, datap); +#endif + out: - INC_TAIL(ring); + SW_INCR_TAIL(ring); ring->slot[curr_slot].is_ok = 0; ring->slot[curr_slot].filtered = 0; ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#16 (text+ko) ==== @@ -1390,8 +1390,11 @@ taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); #ifdef RINGMAP - if (adapter->rm != NULL) - wakeup(adapter->rm); + if ((adapter->rm != NULL) && (adapter->rm->ring != NULL)) { + adapter->rm->funcs->sync_head(adapter->dev, adapter->rm->ring); + if (adapter->rm != NULL) + wakeup(adapter->rm); + } #endif #if (RINGMAP_TX_ENABLE) @@ -3578,9 +3581,13 @@ if (accept_frame) { #ifdef RINGMAP - if ((adapter->rm != NULL) && (adapter->rm->ring != NULL)) + if ((adapter->rm != NULL) && (adapter->rm->ring != NULL)) { adapter->rm->funcs->delayed_isr_per_packet(adapter->rm->ring, i); +#ifdef __RINGMAP_DEB + PRINT_SLOT((adapter->rm->ring), (i), (adapter)); +#endif + } #endif #ifndef RINGMAP ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#14 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#15 (text+ko) ==== @@ -29,13 +29,92 @@ void rm_8254_delayed_interrupt(void *); int rm_8254_print_ring_pointers(struct adapter *); void rm_8254_sync_head_tail(device_t, struct ring *); +void rm_8254_sync_tail(device_t, struct ring *); +void rm_8254_sync_head(device_t, struct ring *); void rm_8254_delayed_interrupt_per_packet(struct ring *, int); +struct ring *rm_8254_alloc_ring(device_t); +void rm_8254_free_ring(device_t, struct ring *); extern devclass_t em_devclass; extern void lem_enable_intr(struct adapter *); extern void lem_disable_intr(struct adapter *); + +void +rm_8254_free_ring(device_t dev, struct ring *ring) +{ + struct adapter *adapter = (struct adapter *)device_get_softc(dev); + + if ( adapter == NULL ) + goto out; + + /* Disable interrupts of adapter */ + rm_8254_disable_intr(dev); + + /* Check whether we have some tasks in queue */ + taskqueue_drain(adapter->tq, &adapter->rxtx_task); + + if (ring != NULL){ + contigfree(ring, sizeof(struct ring), M_DEVBUF); + ring = NULL; + } else { + RINGMAP_ERROR(The pointer to ring structure is NULL); + } +out: ; +} + +struct ring * +rm_8254_alloc_ring(device_t dev) +{ + struct ring *ring; + struct adapter *adapter = (struct adapter *)device_get_softc(dev); + + if ( adapter == NULL ) { + return (NULL); + } + + /* + * Allocate memory for ring structure + * Use contigmalloc(9) to get PAGE_SIZE alignment that is needed + * for memory mapping. + */ + ring = (struct ring *) contigmalloc (sizeof(struct ring), + M_DEVBUF, M_ZERO, 0, -1L, PAGE_SIZE, 0); + if (ring == NULL) { + RINGMAP_ERROR(Can not allocate space for ring structure); + + return (NULL); + } + + /* Disable interrupts of adapter while allocating the ring */ + rm_8254_disable_intr(dev); + + /* + * Before continue look whether any delayed interrupt tasks are + * in the taskqueue. + */ + taskqueue_drain(adapter->tq, &adapter->rxtx_task); + + /* Set ring fields in the initial state */ + ring->kern_wait_user = 0; + ring->user_wait_kern = 0; + ring->interrupts_counter = 0; + ring->pkt_counter = 0; + ring->size = SLOTS_NUMBER; + + if (rm_8254_init_slots(ring, dev) == -1) { + RINGMAP_ERROR(The ring is not initialized. Device will not be opened!); + contigfree(ring, sizeof(struct ring), M_DEVBUF); + + return (NULL); + } + + rm_8254_enable_intr(dev); + + return (ring); +} + void rm_8254_delayed_interrupt_per_packet(struct ring *ring, int slot_num) { @@ -52,6 +131,7 @@ RINGMAP_INTR(end); } + /* * This function synchronize the tail and head hardware registers * with head and tail software varibles, that are visible from @@ -64,13 +144,28 @@ void rm_8254_sync_head_tail(device_t dev, struct ring *ring) { + rm_8254_sync_tail(dev, ring); + rm_8254_sync_head(dev, ring); +} + + +void +rm_8254_sync_tail(device_t dev, struct ring *ring) +{ struct adapter *adapter; adapter = (struct adapter *)device_get_softc(dev); - RINGMAP_HW_SYNC_HEAD(adapter, ring); /* SW_HEAD <== HW_HEAD */ RINGMAP_HW_SYNC_TAIL(adapter, ring); /* SW_TAIL ==> HW_TAIL */ +} - adapter->rm->ring->hw_RDT = RINGMAP_HW_READ_TAIL(adapter); + +void +rm_8254_sync_head(device_t dev, struct ring *ring) +{ + struct adapter *adapter; + adapter = (struct adapter *)device_get_softc(dev); + + RINGMAP_HW_SYNC_HEAD(adapter, ring); /* SW_TAIL ==> HW_HEAD */ } @@ -103,7 +198,7 @@ * TODO: we want multithreading, it means we should later * sync not one ring but many rings, each per thread */ - rm_8254_sync_head_tail(adapter->dev, adapter->rm->ring); + rm_8254_sync_tail(adapter->dev, adapter->rm->ring); #ifdef RINGMAP_TIMESTAMP @@ -329,18 +424,28 @@ rm_8254_print_ring_pointers(struct adapter *adapter) { unsigned int rdt, rdh; - struct ringmap *rm = adapter->rm; + struct ringmap *rm = NULL; + + if ( (adapter == NULL) || + (adapter->rm == NULL) || + (adapter->rm->ring ) == NULL){ + RINGMAP_WARN(NULL pointer! Can not print rings pointers); + + return (0); + } + + rm = adapter->rm; rdh = RINGMAP_HW_READ_HEAD(adapter); rdt = RINGMAP_HW_READ_TAIL(adapter); - printf("\n +++++++++ RING POINTERS ++++++++++++ \n"); - printf(" + HW HEAD = %d (KERN POINTER)\n", rdh); - printf(" + HW TAIL = %d (USER POINTER)\n", rdt); - printf(" +\n"); - printf(" + kernrp = %d \n", rm->ring->kernrp); - printf(" + userrp = %d \n", rm->ring->userrp); - printf(" ++++++++++++++++++++++++++++++++++++++ \n\n"); + printf("\n== +++++++++ RING POINTERS ++++++++++++ \n"); + printf("== + HW HEAD = %d (KERN POINTER)\n", rdh); + printf("== + HW TAIL = %d (USER POINTER)\n", rdt); + printf("== +\n"); + printf("== + kernrp = %d \n", rm->ring->kernrp); + printf("== + userrp = %d \n", rm->ring->userrp); + printf("== ++++++++++++++++++++++++++++++++++++++ \n\n"); return (0); } ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#13 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/modules/ringmap/Makefile#2 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#19 (text+ko) ==== @@ -51,8 +51,11 @@ extern void rm_8254_interrupt(void *); extern void rm_8254_delayed_interrupt(void *); extern void rm_8254_sync_head_tail(device_t, struct ring *); +extern void rm_8254_sync_tail(device_t, struct ring *); +extern void rm_8254_sync_head(device_t, struct ring *); extern void rm_8254_delayed_interrupt_per_packet(struct ring *, int); - +extern struct ring *rm_8254_alloc_ring(device_t); +extern void rm_8254_free_ring(device_t, struct ring *); d_open_t ringmap_open; d_close_t ringmap_close; @@ -123,6 +126,10 @@ rm->funcs->delayed_isr_per_packet = rm_8254_delayed_interrupt_per_packet; rm->funcs->sync_head_tail = rm_8254_sync_head_tail; + rm->funcs->sync_tail = rm_8254_sync_tail; + rm->funcs->sync_head = rm_8254_sync_head; + rm->funcs->alloc_ring = rm_8254_alloc_ring; + rm->funcs->free_ring = rm_8254_free_ring; get_ringmap_p = rm_8254_get_ringmap_p; get_device_p = rm_8254_get_device_p; @@ -184,8 +191,9 @@ set_ringmap_funcs(rm, controller_type); /* - * Create char device for communication with user space. User space process - * wich want to capture should first open this device. Then, by syscalls + * Create char device for communication with user-space. The user-space + * process wich want to capture should first open this device. Then, by + * syscalls * on this device it will: * - get physical adresses of packet buffers for mapping them in its * virtual memory space @@ -247,9 +255,7 @@ int ringmap_open(struct cdev *cdev, int flag, int otyp, struct thread *td) { - int err = 0; struct ringmap *rm = NULL; - struct ring *ring = NULL; RINGMAP_FUNC_DEBUG(start); @@ -262,6 +268,7 @@ rm = get_ringmap_p(get_device_p(cdev)); if (rm == NULL) { RINGMAP_ERROR(Null pointer to ringmap structure); + return (EIO); } @@ -271,57 +278,32 @@ if (!atomic_cmpset_int(&rm->open_cnt, 0, 1)){ RINGMAP_ERROR(Sorry! Can not open device more then one time!); atomic_readandclear_int(&rm->open_cnt); + return (EIO); } if (rm->dev == NULL){ RINGMAP_ERROR(Null pointer to device structure of adapter); atomic_readandclear_int(&rm->open_cnt); + return (EIO); } - - /* - * Allocate memory for ring structure - * Use contigmalloc(9) to get PAGE_SIZE alignment that is needed - * for memory mapping. - */ - ring = (struct ring *) contigmalloc (sizeof(struct ring), - M_DEVBUF, M_ZERO, 0, -1L, PAGE_SIZE, 0); - if (ring == NULL) { - RINGMAP_ERROR(Can not allocate space for ring structure); + + /* Allocate ring */ + rm->ring = rm->funcs->alloc_ring(rm->dev); + if (rm->ring == NULL){ + RINGMAP_ERROR(Null pointer to ring the structure); + atomic_readandclear_int(&rm->open_cnt); - atomic_readandclear_int(&rm->open_cnt); return (EIO); } - rm->ring = ring; /* Store pointer to the thread */ rm->ring->td = td; - - /* Disable interrupts of adapter */ - rm->funcs->disable_intr(rm->dev); - /* Set ring fields in the initial state */ - ring->kern_wait_user = 0; - ring->user_wait_kern = 0; - ring->interrupts_counter = 0; - ring->pkt_counter = 0; - ring->size = SLOTS_NUMBER; - - if (rm->funcs->init_slots(rm->ring, rm->dev) == -1){ - RINGMAP_ERROR(The ring is not initialized. Device will not be opened!); - contigfree(rm->ring, sizeof(struct ring), M_DEVBUF); - rm->ring = NULL; - - atomic_readandclear_int(&rm->open_cnt); - err = EIO; - } - - rm->funcs->enable_intr(rm->dev); - RINGMAP_FUNC_DEBUG(end); - return (err); + return (0); } @@ -340,18 +322,12 @@ return (0); } - /* Disable interrupts of adapter */ - rm->funcs->disable_intr(rm->dev); + atomic_readandclear_int(&rm->open_cnt); if (rm->ring != NULL){ - contigfree(rm->ring, sizeof(struct ring), M_DEVBUF); - rm->ring = NULL; - } else { - RINGMAP_ERROR(The pointer to ring structure is NULL); + rm->funcs->free_ring(rm->dev, rm->ring); } - atomic_readandclear_int(&rm->open_cnt); - RINGMAP_FUNC_DEBUG(end); return (0); @@ -416,25 +392,32 @@ /* Enable Interrupts */ case IOCTL_ENABLE_INTR: ringmap->funcs->enable_intr(ringmap->dev); + RINGMAP_IOCTL(interrupts schould be enabled); break; /* Disable Interrupts */ case IOCTL_DISABLE_INTR: ringmap->funcs->disable_intr(ringmap->dev); + RINGMAP_IOCTL(interrupts schould be disabled); break; /* Sleep and wait for new frames */ case IOCTL_SLEEP_WAIT: + RINGMAP_IOCTL(Sleep and wait for new packets); ringmap->ring->user_wait_kern++; ringmap->funcs->sync_head_tail(get_device_p(cdev), ringmap->ring); err_sleep = tsleep(ringmap, (PRI_MIN) | PCATCH, "ioctl", 0); break; - /* Synchronize sowftware ring-tail with hardware-ring-tail (RDT) */ case IOCTL_SYNC_HEAD_TAIL: ringmap->funcs->sync_head_tail(get_device_p(cdev), ringmap->ring); break; + /* Synchronize sowftware ring-tail with hardware-ring-tail (RDT) */ + case IOCTL_SYNC_TAIL: + ringmap->funcs->sync_tail(get_device_p(cdev), ringmap->ring); + break; + default: RINGMAP_ERROR("Undefined command!"); return (ENODEV); ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#19 (text+ko) ==== @@ -64,10 +64,10 @@ struct address packet; /* 1 - if accepted by (bpf) filter */ - int filtered; + int volatile filtered; /* 1 if accepted by driver and contains no errors */ - int is_ok; + int volatile is_ok; /* * Next fields are for statistics: @@ -109,9 +109,6 @@ */ unsigned int volatile userrp; - /* This variable represents the value of Hardware TAIL register */ - unsigned int hw_RDT; - /* Number of slots (descriptors a.k.a memory areas for frames) */ unsigned int size; @@ -253,6 +250,14 @@ * into the hardware TAIL-register. */ void (*sync_head_tail)(device_t, struct ring *); + void (*sync_tail)(device_t, struct ring *); + void (*sync_head)(device_t, struct ring *); + + /* Alloc memory for our ring and initialize the slots */ + struct ring *(*alloc_ring)(device_t); + + /* Free memory that was allocated for the ring */ + void (*free_ring)(device_t, struct ring *); }; #endif /* _KERNEL */ @@ -266,7 +271,12 @@ * *************************************/ #define RINGMAP_IOC_MAGIC 'T' -/* RDT = (userrp - RING_SAFETY_MARGIN) mod SLOTS_NUMBER */ +/* + * Should call the function that synchtonizes hardware TAIL + * with SW_TAIL(ring) + */ +#define IOCTL_SYNC_TAIL _IO(RINGMAP_IOC_MAGIC, 1) + #define IOCTL_SYNC_HEAD_TAIL _IO(RINGMAP_IOC_MAGIC, 2) /* @@ -282,7 +292,7 @@ * Sleep and wait for new pkts in ring buffer. By this * system call should the user-space process be blocked * and should be awoken from ISR or delayed ISR after the - * new packets was received. Additional in kontext of this + * new packets was received. Additionaly, in kontext of this * syscall hardware HEAD and TAIL registers should be * synchronized with ring->kernerp and ring->userrp */ @@ -298,8 +308,8 @@ #define SW_HEAD(ringp) ((ringp)->kernrp) /* - * The hardware HEAD and TAIL are defined in the hardware dependent - * header files + * The macroses for accessing to the hardware HEAD and TAIL are defined in the + * hardware dependent header files */ #define RING_MODULO(a,b) \ @@ -324,7 +334,7 @@ ((SW_TAIL(ringp) == SW_HEAD(ringp)) ? SLOTS_NUMBER : \ R_DISTANCE(SW_TAIL(ringp), SW_HEAD(ringp))) -#define INC_TAIL(ringp) \ +#define SW_INCR_TAIL(ringp) \ (SW_TAIL(ringp)) = R_MODULO(SW_TAIL(ringp) + 1); #define RING_IS_EMPTY(ringp) \ @@ -400,31 +410,42 @@ #ifdef _KERNEL -#define RINGMAP_PRINT_DESC(i) \ - printf("[%s] - DESC INFO: desc_num=%d, status=0x%X, pktlen=%d\n[%s] - ADDRESSES: pkt_virt=0x%X (kern), pkt_phys=0x%X\n", \ - __func__, \ - i, \ - (unsigned int)(adapter->rx_desc_base[i].status) & 255, \ - adapter->rx_desc_base[i].length, \ - __func__, \ - (unsigned int)adapter->rx_buffer_area[i].m_head->m_data,\ - (unsigned int)adapter->rx_desc_base[i].buffer_addr); +#define RINGMAP_PRINT_DESC(adapter, i) \ + printf("[%s] - DESC INFO: desc_num=%d, status=0x%X, pktlen=%d\n[%s] - ADDRESSES: pkt_virt=0x%X (kern), pkt_phys=0x%X\n", \ + __func__, \ + i, \ + (unsigned int)(adapter->rx_desc_base[i].status) & 255, \ + adapter->rx_desc_base[i].length, \ + __func__, \ + (unsigned int)adapter->rx_buffer_area[i].m_head->m_data,\ + (unsigned int)adapter->rx_desc_base[i].buffer_addr); -#define FIVEG_PRINT_SOME_BYTES_FROM_PKT(i) \ - printf("[%s] SOME BYTES FROM PKT: %hhX %hhX %hhX %hhX %hhX\n", \ - __func__, \ - adapter->rx_buffer_area[i].m_head->m_data[0], \ - adapter->rx_buffer_area[i].m_head->m_data[1], \ - adapter->rx_buffer_area[i].m_head->m_data[16], \ - adapter->rx_buffer_area[i].m_head->m_data[32], \ - adapter->rx_buffer_area[i].m_head->m_data[59]); +#define PRINT_SOME_BYTES_FROM_PKT(adapter, i) \ + printf("=+= [%s] SOME BYTES FROM PKT: %hhX %hhX %hhX %hhX %hhX\n", \ + __func__, \ + adapter->rx_buffer_area[i].m_head->m_data[0], \ + adapter->rx_buffer_area[i].m_head->m_data[1], \ + adapter->rx_buffer_area[i].m_head->m_data[16], \ + adapter->rx_buffer_area[i].m_head->m_data[32], \ + adapter->rx_buffer_area[i].m_head->m_data[59]); #else -#define FIVEG_PRINT_SOME_BYTES_FROM_PKT(pktp) \ - printf("[%s] SOME BYTES FROM PKT: %hhX %hhX %hhX %hhX %hhX\n", \ - __func__, \ - pktp[0], \ - pktp[1], \ - pktp[16], \ - pktp[32], \ - pktp[59]); +#define PRINT_SOME_BYTES_FROM_PKT(pktp, i) \ + printf("=+= [%s] SOME BYTES FROM PKT: %hhX %hhX %hhX %hhX %hhX\n", \ + __func__, \ + pktp[0], \ + pktp[1], \ + pktp[16], \ + pktp[32], \ + pktp[59]); #endif + +#define PRINT_SLOT(ring, i, arg) \ + if (((ring) != NULL) && ((arg) != NULL) && ((i) < SLOTS_NUMBER)){ \ + printf("\n=+= =============================\n"); \ + printf("=+= Kernel slot: %d \n", (ring)->cur_slot_kern); \ + printf("=+= Intrr num: %llu\n", (ring)->slot[(i)].intr_num); \ + printf("=+= Time stamp: %llu\n", (unsigned long long)(((ring)->slot[(i)].ts.tv_sec*1000000 + (ring)->slot[(i)].ts.tv_usec))); \ + printf("=+= Accepted: %d\n", (ring)->slot[(i)].is_ok); \ + PRINT_SOME_BYTES_FROM_PKT((arg), (i)); \ + printf("=+= =============================\n\n"); \ + } ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#5 (text+ko) ==== @@ -68,11 +68,5 @@ got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet) { pcnt++; - - printf("===> Packet %d \n", pcnt); - printf("Packet Length: %d \n", header->len); - printf("Time Stamp: %llu \n", - (header->ts.tv_sec*1000000 + header->ts.tv_usec)); - - printf("\n\n"); + printf("===> [%s] Packet %d \n", __func__, pcnt); } From owner-p4-projects@FreeBSD.ORG Tue Jun 29 22:53:42 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 86BE81065673; Tue, 29 Jun 2010 22:53:42 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A8B6106564A for ; Tue, 29 Jun 2010 22:53:42 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 370E88FC14 for ; Tue, 29 Jun 2010 22:53:42 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5TMrfuA095092 for ; Tue, 29 Jun 2010 22:53:41 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5TMrffP095090 for perforce@freebsd.org; Tue, 29 Jun 2010 22:53:41 GMT (envelope-from trasz@freebsd.org) Date: Tue, 29 Jun 2010 22:53:41 GMT Message-Id: <201006292253.o5TMrffP095090@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to trasz@freebsd.org using -f From: Edward Tomasz Napierala To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180334 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jun 2010 22:53:42 -0000 http://p4web.freebsd.org/@@180334?ac=10 Change 180334 by trasz@trasz_victim on 2010/06/29 22:53:06 IFC. Affected files ... .. //depot/projects/soc2009/trasz_limits/Makefile.inc1#12 integrate .. //depot/projects/soc2009/trasz_limits/Makefile.mips#1 branch .. //depot/projects/soc2009/trasz_limits/contrib/binutils/binutils/doc/readelf.1#2 integrate .. //depot/projects/soc2009/trasz_limits/etc/mtree/BSD.usr.dist#9 integrate .. //depot/projects/soc2009/trasz_limits/games/fortune/datfiles/fortunes-o.real#7 integrate .. //depot/projects/soc2009/trasz_limits/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh#2 integrate .. //depot/projects/soc2009/trasz_limits/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh#2 integrate .. //depot/projects/soc2009/trasz_limits/lib/Makefile#9 integrate .. //depot/projects/soc2009/trasz_limits/lib/libc/mips/sys/brk.S#4 integrate .. //depot/projects/soc2009/trasz_limits/lib/libc/mips/sys/sbrk.S#3 integrate .. //depot/projects/soc2009/trasz_limits/lib/libc/sys/getgroups.2#3 integrate .. //depot/projects/soc2009/trasz_limits/libexec/rtld-elf/rtld.c#10 integrate .. //depot/projects/soc2009/trasz_limits/sbin/devd/devd.cc#2 integrate .. //depot/projects/soc2009/trasz_limits/sbin/devd/devd.hh#2 integrate .. //depot/projects/soc2009/trasz_limits/sbin/fsck_ffs/main.c#4 integrate .. //depot/projects/soc2009/trasz_limits/sbin/fsck_ffs/suj.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sbin/geom/class/part/geom_part.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sbin/geom/core/geom.c#5 integrate .. //depot/projects/soc2009/trasz_limits/sbin/geom/core/geom.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sbin/geom/misc/subr.c#4 integrate .. //depot/projects/soc2009/trasz_limits/sbin/geom/misc/subr.h#2 integrate .. //depot/projects/soc2009/trasz_limits/share/examples/perfmon/perfmon.c#2 integrate .. //depot/projects/soc2009/trasz_limits/share/man/man3/pthread_join.3#3 integrate .. //depot/projects/soc2009/trasz_limits/share/man/man4/Makefile#19 integrate .. //depot/projects/soc2009/trasz_limits/share/man/man4/aibs.4#1 branch .. //depot/projects/soc2009/trasz_limits/share/man/man9/style.9#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/amd64/amd64/exception.S#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/amd64/amd64/machdep.c#16 integrate .. //depot/projects/soc2009/trasz_limits/sys/amd64/amd64/mp_machdep.c#8 integrate .. //depot/projects/soc2009/trasz_limits/sys/amd64/ia32/ia32_exception.S#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/amd64/include/asmacros.h#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/amd64/linux32/linux32_sysent.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/boot/forth/loader.conf#9 integrate .. //depot/projects/soc2009/trasz_limits/sys/cam/cam_xpt.c#13 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/freebsd32/freebsd32_proto.h#11 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/freebsd32/freebsd32_syscall.h#10 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/freebsd32/freebsd32_syscalls.c#10 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/freebsd32/freebsd32_sysent.c#11 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/freebsd32/syscalls.master#13 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/linux/linux_signal.c#4 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/svr4/svr4_proto.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/svr4/svr4_syscall.h#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/svr4/svr4_syscallnames.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/svr4/svr4_sysent.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/x86bios/x86bios.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/compat/x86bios/x86bios.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/conf/files#29 integrate .. //depot/projects/soc2009/trasz_limits/sys/conf/files.amd64#13 integrate .. //depot/projects/soc2009/trasz_limits/sys/conf/files.i386#14 integrate .. //depot/projects/soc2009/trasz_limits/sys/conf/ldscript.mips.n32#1 branch .. //depot/projects/soc2009/trasz_limits/sys/dev/acpi_support/atk0110.c#1 branch .. //depot/projects/soc2009/trasz_limits/sys/dev/acpica/acpi_hpet.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/ath/ath_hal/ar5416/ar5416reg.h#5 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/bwi/if_bwi.c#8 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/e1000/if_igb.c#16 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/fb/fbreg.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/fb/vesa.c#11 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/mpt/mpt.c#4 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/mpt/mpt.h#5 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/mpt/mpt_cam.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/mpt/mpt_pci.c#5 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/mpt/mpt_raid.c#8 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/sound/usb/uaudio.c#13 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/sound/usb/uaudioreg.h#5 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/controller/ehci.c#14 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/controller/ohci.c#8 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/controller/uhci.c#10 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/net/if_rue.c#8 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/quirk/usb_quirk.c#12 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/usb_transfer.c#13 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/usbdevs#22 integrate .. //depot/projects/soc2009/trasz_limits/sys/dev/usb/wlan/if_upgt.c#10 integrate .. //depot/projects/soc2009/trasz_limits/sys/fs/udf/udf_vnops.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/geom/part/g_part.c#8 integrate .. //depot/projects/soc2009/trasz_limits/sys/geom/part/g_part.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/geom/part/g_part_mbr.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/conf/NOTES#15 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/i386/apic_vector.s#4 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/i386/atpic_vector.s#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/i386/exception.s#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/i386/identcpu.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/i386/machdep.c#14 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/i386/mp_machdep.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/i386/support.s#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/i386/vm_machdep.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/ibcs2/ibcs2_proto.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/ibcs2/ibcs2_syscall.h#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/ibcs2/ibcs2_sysent.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/include/md_var.h#4 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/include/npx.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/include/pcb.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/isa/npx.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/i386/linux/linux_sysent.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/init_sysent.c#12 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_acct.c#4 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_clock.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_exec.c#14 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_exit.c#20 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_malloc.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_mbuf.c#5 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_module.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#34 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_sdt.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_sig.c#11 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_syscalls.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_tc.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_thr.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_umtx.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/makesyscalls.sh#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/subr_bus.c#13 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/subr_devstat.c#4 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/subr_fattime.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/subr_lock.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/subr_mchain.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/subr_module.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/subr_param.c#5 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/subr_trap.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/subr_unit.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/subr_witness.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/sys_generic.c#9 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/sys_process.c#9 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/sys_socket.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/syscalls.c#11 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/syscalls.master#12 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/systrace_args.c#10 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/sysv_shm.c#8 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/uipc_mbuf.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/uipc_mbuf2.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/uipc_mqueue.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/uipc_syscalls.c#14 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/vfs_cache.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/vfs_subr.c#16 integrate .. //depot/projects/soc2009/trasz_limits/sys/kern/vfs_vnops.c#15 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/atheros/ar71xxreg.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/conf/XLRN32#1 branch .. //depot/projects/soc2009/trasz_limits/sys/mips/include/asm.h#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/include/cpu.h#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/include/pte.h#5 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/include/setjmp.h#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/include/vm.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/include/vmparam.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/mips/exception.S#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/mips/machdep.c#8 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/mips/pm_machdep.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/mips/pmap.c#11 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/mips/stack_machdep.c#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/mips/trap.c#8 integrate .. //depot/projects/soc2009/trasz_limits/sys/mips/mips/vm_machdep.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/modules/acpi/Makefile#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/modules/acpi/aibs/Makefile#1 branch .. //depot/projects/soc2009/trasz_limits/sys/modules/mqueue/Makefile#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/netinet/ipfw/ip_fw2.c#12 integrate .. //depot/projects/soc2009/trasz_limits/sys/netinet/sctp_pcb.c#10 integrate .. //depot/projects/soc2009/trasz_limits/sys/pc98/include/npx.h#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/pc98/pc98/machdep.c#10 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/aim/nexus.c#4 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/booke/pmap.c#12 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/include/asm.h#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/include/intr_machdep.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/include/openpicvar.h#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/include/profile.h#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/mpc85xx/atpic.c#4 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/mpc85xx/ocpbus.c#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/mpc85xx/opic.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/mpc85xx/pci_ocp.c#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/powermac/cpcht.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/powermac/openpic_macio.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/powerpc/intr_machdep.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/powerpc/openpic.c#5 integrate .. //depot/projects/soc2009/trasz_limits/sys/powerpc/powerpc/pic_if.m#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/sys/diskmbr.h#2 integrate .. //depot/projects/soc2009/trasz_limits/sys/sys/signalvar.h#5 integrate .. //depot/projects/soc2009/trasz_limits/sys/sys/syscall.h#11 edit .. //depot/projects/soc2009/trasz_limits/sys/sys/syscall.mk#11 edit .. //depot/projects/soc2009/trasz_limits/sys/sys/sysent.h#6 integrate .. //depot/projects/soc2009/trasz_limits/sys/sys/sysproto.h#12 edit .. //depot/projects/soc2009/trasz_limits/sys/vm/vm_page.c#12 integrate .. //depot/projects/soc2009/trasz_limits/sys/vm/vm_page.h#7 integrate .. //depot/projects/soc2009/trasz_limits/sys/vm/vm_pageout.c#9 integrate .. //depot/projects/soc2009/trasz_limits/sys/x86/isa/atrtc.c#3 integrate .. //depot/projects/soc2009/trasz_limits/sys/x86/isa/clock.c#4 integrate .. //depot/projects/soc2009/trasz_limits/tools/tools/netrate/tcpp/README#3 integrate .. //depot/projects/soc2009/trasz_limits/tools/tools/netrate/tcpp/parallelism.csh#1 branch .. //depot/projects/soc2009/trasz_limits/tools/tools/netrate/tcpp/runit.pl#1 branch .. //depot/projects/soc2009/trasz_limits/usr.bin/locate/bigram/locate.bigram.c#2 integrate .. //depot/projects/soc2009/trasz_limits/usr.bin/locate/code/locate.code.c#2 integrate .. //depot/projects/soc2009/trasz_limits/usr.bin/lock/Makefile#3 integrate .. //depot/projects/soc2009/trasz_limits/usr.bin/lock/lock.c#3 integrate .. //depot/projects/soc2009/trasz_limits/usr.bin/ministat/ministat.1#2 integrate .. //depot/projects/soc2009/trasz_limits/usr.bin/tcopy/Makefile#3 integrate .. //depot/projects/soc2009/trasz_limits/usr.bin/tcopy/tcopy.c#3 integrate .. //depot/projects/soc2009/trasz_limits/usr.bin/tftp/tftp.c#4 integrate .. //depot/projects/soc2009/trasz_limits/usr.sbin/Makefile#14 integrate .. //depot/projects/soc2009/trasz_limits/usr.sbin/boot0cfg/boot0cfg.c#2 integrate .. //depot/projects/soc2009/trasz_limits/usr.sbin/mptutil/mptutil.8#4 integrate .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/Makefile#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/Makefile.inc#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-partmanager/Makefile#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-partmanager/delete-part.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/Makefile#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/detect-vmware.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/disk-info.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/disk-list.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/disk-part.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/enable-net.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/list-components.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/list-config.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/list-mirrors.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/list-rsync-backups.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/list-tzones.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/query-langs.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/send-logs.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/setup-ssh-keys.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/sys-mem.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/test-live.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/test-netup.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/Makefile#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-disk.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-ftp.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-localize.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-mountoptical.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-networking.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-newfs.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-parse.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-runcommands.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-unmount.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-upgrade.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions-users.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/functions.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/parseconfig.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/backend/startautoinstall.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/conf/Makefile#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/conf/avail-langs#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/conf/exclude-from-upgrade#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/conf/licenses/bsd-en.txt#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/conf/licenses/intel-en.txt#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/conf/licenses/nvidia-en.txt#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/conf/pc-sysinstall.conf#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/doc/Makefile#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/doc/help-disk-list#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/doc/help-disk-size#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/doc/help-index#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/doc/help-start-autoinstall#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/Makefile#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/README#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/pc-autoinstall.conf#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.fbsd-netinstall#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.geli#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.gmirror#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.netinstall#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.restore#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.rsync#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.upgrade#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/examples/pcinstall.cfg.zfs#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/pc-sysinstall/Makefile#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh#1 branch .. //depot/projects/soc2009/trasz_limits/usr.sbin/sysinstall/dist.c#6 integrate .. //depot/projects/soc2009/trasz_limits/usr.sbin/sysinstall/install.c#6 integrate .. //depot/projects/soc2009/trasz_limits/usr.sbin/sysinstall/sysinstall.8#5 integrate Differences ... ==== //depot/projects/soc2009/trasz_limits/Makefile.inc1#12 (text+ko) ==== @@ -1,5 +1,5 @@ # -# $FreeBSD: src/Makefile.inc1,v 1.653 2010/06/16 16:52:35 raj Exp $ +# $FreeBSD: src/Makefile.inc1,v 1.656 2010/06/24 17:53:25 imp Exp $ # # Make command line options: # -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir @@ -30,9 +30,7 @@ .include -.if ${MACHINE_ARCH} == "mips" -MK_RESCUE=no # not yet -.endif +.include # We must do share/info early so that installation of info `dir' # entries works correctly. Do it first since it is less likely to @@ -167,7 +165,7 @@ .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING) OBJTREE= ${MAKEOBJDIRPREFIX} .else -OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET} +OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} .endif WORLDTMP= ${OBJTREE}${.CURDIR}/tmp # /usr/games added for fortune which depend on strfile @@ -1110,10 +1108,10 @@ # all shared libraries for ELF. # _startup_libs= gnu/lib/csu -.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) -_startup_libs+= lib/csu/${MACHINE_ARCH}-elf +.if exists(${.CURDIR}/lib/csu/${MACHINE_CPUARCH}-elf) +_startup_libs+= lib/csu/${MACHINE_CPUARCH}-elf .else -_startup_libs+= lib/csu/${MACHINE_ARCH} +_startup_libs+= lib/csu/${MACHINE_CPUARCH} .endif _startup_libs+= gnu/lib/libgcc _startup_libs+= lib/libc ==== //depot/projects/soc2009/trasz_limits/contrib/binutils/binutils/doc/readelf.1#2 (text+ko) ==== @@ -247,14 +247,6 @@ .PD Displays the contents of the file's unwind section, if it has one. Only the unwind sections for \s-1IA64\s0 \s-1ELF\s0 files are currently supported. -.IP "\fB\-u\fR" 4 -.IX Item "-u" -.PD 0 -.IP "\fB\-\-unwind\fR" 4 -.IX Item "--unwind" -.PD -Displays the contents of the file's unwind section, if it has one. Only -the unwind sections for \s-1IA64\s0 \s-1ELF\s0 files are currently supported. .IP "\fB\-d\fR" 4 .IX Item "-d" .PD 0 ==== //depot/projects/soc2009/trasz_limits/etc/mtree/BSD.usr.dist#9 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/etc/mtree/BSD.usr.dist,v 1.345 2010/04/21 12:17:01 avg Exp $ +# $FreeBSD: src/etc/mtree/BSD.usr.dist,v 1.347 2010/06/28 08:05:30 pjd Exp $ # # Please see the file src/etc/mtree/README before making changes to this file. # @@ -261,6 +261,8 @@ .. nwclient .. + pc-sysinstall + .. perfmon .. pf @@ -1226,6 +1228,20 @@ .. .. .. + pc-sysinstall + backend + .. + backend-partmanager + .. + backend-query + .. + conf + license + .. + .. + doc + .. + .. security .. sendmail ==== //depot/projects/soc2009/trasz_limits/games/fortune/datfiles/fortunes-o.real#7 (text+ko) ==== @@ -1,4 +1,4 @@ -%% $FreeBSD: src/games/fortune/datfiles/fortunes-o.real,v 1.36 2010/03/31 18:21:25 uqs Exp $ +%% $FreeBSD: src/games/fortune/datfiles/fortunes-o.real,v 1.37 2010/06/26 07:02:31 dougb Exp $ % PLAYGIRL, Inc. Philadelphia, Pa. 19369 @@ -12433,6 +12433,39 @@ (chorus) -- Crosby, Stills, Nash, "Fair Game" % +Taken from actual police car videos: + +(15) Relax! The handcuffs are tight because they're new. They'll + stretch out after you wear them awhile. +(14) Take your hands off the car and I'll make your birth certificate + a worthless document. +(13) If you run you'll only go to jail tired. +(12) Can you run faster than 1200 feet per second? In case you didn't + know that's the average speed of a 9 mm bullet fired from my gun. +(11) So you don't know how fast you were going. I guess that means I + can write anything I want on the ticket, huh? +(10) Yes, sir, you can talk to the shift supervisor, but I don't think + it will help. Oh, did I mention that I AM the shift supervisor? +(9) Warning? You want a warning? OK, I'm warning you not to do that + again or I'll give you another ticket. +(8) The answer to this last question will determine whether you are + drunk or not. Is Mickey Mouse a cat or a dog? +% +Taken from actual police car videos: + +(7) Fair? You want me to be fair? Listen, fair is a place where you + go to ride on rides, eat cotton candy, and step in monkey poop. +(6) Yeah, we have a quota. Two more tickets and my wife gets a toaster + oven. +(5) No, sir, we don't have quotas anymore. We used to have quotas but + now we're allowed to write as many tickets as we want. +(4) Just how big were those two beers? +(3) In God we trust, all others we run through CPIC/NCIC. +(2) I'm glad to hear the Chief of Police is a good personal friend of + yours. At least you know someone who can post your bail. +(1) You didn't think we gave pretty women tickets? + You're right, we don't -- sign here. +% Taoism: Shit Happens. Confucianism: Confucius say, "Shit Happens". Buddhism: If shit happens, it isn't really shit. ==== //depot/projects/soc2009/trasz_limits/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh#2 (text+ko) ==== @@ -1,4 +1,5 @@ -# $FreeBSD: src/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh,v 1.2 2010/03/04 04:30:16 imp Exp $ +# $FreeBSD: src/gnu/usr.bin/binutils/ld/elf32btsmipn32_fbsd.sh,v 1.3 2010/06/25 05:07:42 jchandra Exp $ . ${srcdir}/emulparams/elf32btsmipn32.sh . ${srcdir}/emulparams/elf_fbsd.sh GENERATE_PIE_SCRIPT=yes +ALIGNMENT=8 ==== //depot/projects/soc2009/trasz_limits/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh#2 (text+ko) ==== @@ -1,4 +1,5 @@ -# $FreeBSD: src/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh,v 1.2 2010/03/04 04:30:16 imp Exp $ +# $FreeBSD: src/gnu/usr.bin/binutils/ld/elf32ltsmipn32_fbsd.sh,v 1.3 2010/06/25 05:07:42 jchandra Exp $ . ${srcdir}/emulparams/elf32ltsmipn32.sh . ${srcdir}/emulparams/elf_fbsd.sh GENERATE_PIE_SCRIPT=yes +ALIGNMENT=8 ==== //depot/projects/soc2009/trasz_limits/lib/Makefile#9 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 6/4/93 -# $FreeBSD: src/lib/Makefile,v 1.248 2010/06/09 19:57:20 rdivacky Exp $ +# $FreeBSD: src/lib/Makefile,v 1.249 2010/06/21 19:44:29 ed Exp $ .include @@ -138,7 +138,7 @@ _libbsnmp= libbsnmp .endif -.if ${MK_CLANG} != "no" +.if ${MK_CLANG} != "no" && !defined(COMPAT_32BIT) _clang= clang .endif ==== //depot/projects/soc2009/trasz_limits/lib/libc/mips/sys/brk.S#4 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/mips/sys/brk.S,v 1.5 2010/06/16 12:55:14 jchandra Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/mips/sys/brk.S,v 1.6 2010/06/25 05:36:36 jchandra Exp $"); #include "SYS.h" #if defined(LIBC_SCCS) && !defined(lint) @@ -47,7 +47,7 @@ .data _C_LABEL(minbrk): - .word _C_LABEL(_end) + PTR_WORD _C_LABEL(_end) .text LEAF(__sys_brk) ==== //depot/projects/soc2009/trasz_limits/lib/libc/mips/sys/sbrk.S#3 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/mips/sys/sbrk.S,v 1.4 2010/06/16 12:55:14 jchandra Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/mips/sys/sbrk.S,v 1.5 2010/06/25 05:36:36 jchandra Exp $"); #include "SYS.h" #if defined(LIBC_SCCS) && !defined(lint) @@ -46,7 +46,7 @@ .data _C_LABEL(__curbrk): - .word _C_LABEL(_end) + PTR_WORD _C_LABEL(_end) .text LEAF(__sys_sbrk) ==== //depot/projects/soc2009/trasz_limits/lib/libc/sys/getgroups.2#3 (text+ko) ==== @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)getgroups.2 8.2 (Berkeley) 4/16/94 -.\" $FreeBSD: src/lib/libc/sys/getgroups.2,v 1.14 2009/06/19 15:58:24 brooks Exp $ +.\" $FreeBSD: src/lib/libc/sys/getgroups.2,v 1.15 2010/06/26 21:44:05 pjd Exp $ .\" .Dd March 5, 1999 .Dt GETGROUPS 2 @@ -37,7 +37,7 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In sys/types.h +.In sys/param.h .In unistd.h .Ft int .Fn getgroups "int gidsetlen" "gid_t *gidset" ==== //depot/projects/soc2009/trasz_limits/libexec/rtld-elf/rtld.c#10 (text+ko) ==== @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/libexec/rtld-elf/rtld.c,v 1.149 2010/06/03 00:25:43 kan Exp $ + * $FreeBSD: src/libexec/rtld-elf/rtld.c,v 1.151 2010/06/28 01:40:56 nwhitehorn Exp $ */ /* ==== //depot/projects/soc2009/trasz_limits/sbin/devd/devd.cc#2 (text+ko) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002-2003 M. Warner Losh. + * Copyright (c) 2002-2010 M. Warner Losh. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,6 +22,35 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * my_system is a variation on lib/libc/stdlib/system.c: + * + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ /* @@ -34,13 +63,14 @@ // - devd.conf needs more details on the supported statements. #include -__FBSDID("$FreeBSD: src/sbin/devd/devd.cc,v 1.34 2008/12/14 11:48:51 phk Exp $"); +__FBSDID("$FreeBSD: src/sbin/devd/devd.cc,v 1.35 2010/06/29 03:52:12 imp Exp $"); #include #include #include #include #include +#include #include #include @@ -49,6 +79,7 @@ #include #include #include +#include #include #include #include @@ -152,13 +183,67 @@ // nothing } +static int +my_system(const char *command) +{ + pid_t pid, savedpid; + int pstat; + struct sigaction ign, intact, quitact; + sigset_t newsigblock, oldsigblock; + + if (!command) /* just checking... */ + return(1); + + /* + * Ignore SIGINT and SIGQUIT, block SIGCHLD. Remember to save + * existing signal dispositions. + */ + ign.sa_handler = SIG_IGN; + ::sigemptyset(&ign.sa_mask); + ign.sa_flags = 0; + ::sigaction(SIGINT, &ign, &intact); + ::sigaction(SIGQUIT, &ign, &quitact); + ::sigemptyset(&newsigblock); + ::sigaddset(&newsigblock, SIGCHLD); + ::sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); + switch (pid = ::fork()) { + case -1: /* error */ + break; + case 0: /* child */ + /* + * Restore original signal dispositions and exec the command. + */ + ::sigaction(SIGINT, &intact, NULL); + ::sigaction(SIGQUIT, &quitact, NULL); + ::sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + /* + * Close the PID file, and all other open descriptors. + * Inherit std{in,out,err} only. + */ + cfg.close_pidfile(); + ::closefrom(3); + ::execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL); + ::_exit(127); + default: /* parent */ + savedpid = pid; + do { + pid = ::wait4(savedpid, &pstat, 0, (struct rusage *)0); + } while (pid == -1 && errno == EINTR); + break; + } + ::sigaction(SIGINT, &intact, NULL); + ::sigaction(SIGQUIT, &quitact, NULL); + ::sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + return (pid == -1 ? -1 : pstat); +} + bool action::do_action(config &c) { string s = c.expand_string(_cmd); if (Dflag) fprintf(stderr, "Executing '%s'\n", s.c_str()); - ::system(s.c_str()); + my_system(s.c_str()); return (true); } @@ -391,6 +476,13 @@ } void +config::close_pidfile() +{ + + pidfile_close(pfh); +} + +void config::remove_pidfile() { ==== //depot/projects/soc2009/trasz_limits/sbin/devd/devd.hh#2 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sbin/devd/devd.hh,v 1.5 2007/12/21 01:00:04 imp Exp $ + * $FreeBSD: src/sbin/devd/devd.hh,v 1.6 2010/06/29 03:52:12 imp Exp $ */ #ifndef DEVD_HH @@ -153,6 +153,7 @@ void set_pidfile(const char *); void reset(); void parse(); + void close_pidfile(); void open_pidfile(); void write_pidfile(); void remove_pidfile(); ==== //depot/projects/soc2009/trasz_limits/sbin/fsck_ffs/main.c#4 (text+ko) ==== @@ -39,7 +39,7 @@ #endif /* not lint */ #endif #include -__FBSDID("$FreeBSD: src/sbin/fsck_ffs/main.c,v 1.59 2010/04/24 07:05:35 jeff Exp $"); +__FBSDID("$FreeBSD: src/sbin/fsck_ffs/main.c,v 1.60 2010/06/22 00:26:07 delphij Exp $"); #include #include @@ -388,16 +388,18 @@ /* * Determine if we can and should do journal recovery. */ - if ((sblock.fs_flags & (FS_SUJ | FS_NEEDSFSCK)) == FS_SUJ) { - if (preen || reply("USE JOURNAL?")) { - if (suj_check(filesys) == 0) { - if (chkdoreload(mntp) == 0) - exit(0); - exit(4); + if ((sblock.fs_flags & FS_SUJ) == FS_SUJ) { + if ((sblock.fs_flags & FS_NEEDSFSCK) != FS_NEEDSFSCK && skipclean) { + if (preen || reply("USE JOURNAL?")) { + if (suj_check(filesys) == 0) { + printf("\n***** FILE SYSTEM MARKED CLEAN *****\n"); + if (chkdoreload(mntp) == 0) + exit(0); + exit(4); + } } - /* suj_check failed, fall through. */ + printf("** Skipping journal, falling through to full fsck\n\n"); } - printf("** Skipping journal, falling through to full fsck\n"); /* * Write the superblock so we don't try to recover the * journal on another pass. ==== //depot/projects/soc2009/trasz_limits/sbin/fsck_ffs/suj.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sbin/fsck_ffs/suj.c,v 1.2 2010/04/24 07:58:59 pjd Exp $"); +__FBSDID("$FreeBSD: src/sbin/fsck_ffs/suj.c,v 1.3 2010/06/22 00:26:07 delphij Exp $"); #include #include @@ -37,12 +37,15 @@ #include #include +#include +#include #include #include #include #include #include #include +#include #include #include @@ -141,7 +144,10 @@ uint64_t jbytes; uint64_t jrecs; +static jmp_buf jmpbuf; + typedef void (*ino_visitor)(ino_t, ufs_lbn_t, ufs2_daddr_t, int); +static void err_suj(const char *, ...) __dead2; static void ino_trunc(ino_t, off_t); static void ino_decr(ino_t); static void ino_adjust(struct suj_ino *); @@ -155,11 +161,30 @@ a = malloc(n); if (a == NULL) - errx(1, "malloc(%zu)", n); + err(EX_OSERR, "malloc(%zu)", n); return (a); } /* + * When hit a fatal error in journalling check, print out + * the error and then offer to fallback to normal fsck. + */ +static void +err_suj(const char * restrict fmt, ...) +{ + va_list ap; + + if (preen) + (void)fprintf(stdout, "%s: ", cdevname); + + va_start(ap, fmt); + (void)vfprintf(stdout, fmt, ap); + va_end(ap); + + longjmp(jmpbuf, -1); +} + +/* * Open the given provider, load superblock. */ static void @@ -169,9 +194,9 @@ return; disk = malloc(sizeof(*disk)); if (disk == NULL) - errx(1, "malloc(%zu)", sizeof(*disk)); + err(EX_OSERR, "malloc(%zu)", sizeof(*disk)); if (ufs_disk_fillout(disk, devnam) == -1) { - err(1, "ufs_disk_fillout(%s) failed: %s", devnam, + err(EX_OSERR, "ufs_disk_fillout(%s) failed: %s", devnam, disk->d_error); } fs = &disk->d_fs; @@ -203,9 +228,9 @@ fs->fs_time = time(NULL); fs->fs_mtime = time(NULL); if (sbwrite(disk, 0) == -1) - err(1, "sbwrite(%s)", devnam); + err(EX_OSERR, "sbwrite(%s)", devnam); if (ufs_disk_close(disk) == -1) - err(1, "ufs_disk_close(%s)", devnam); + err(EX_OSERR, "ufs_disk_close(%s)", devnam); free(disk); disk = NULL; fs = NULL; @@ -221,10 +246,8 @@ struct cghd *hd; struct suj_cg *sc; - if (cgx < 0 || cgx >= fs->fs_ncg) { - abort(); - errx(1, "Bad cg number %d", cgx); - } + if (cgx < 0 || cgx >= fs->fs_ncg) + err_suj("Bad cg number %d\n", cgx); if (lastcg && lastcg->sc_cgx == cgx) return (lastcg); hd = &cghash[SUJ_HASH(cgx)]; @@ -241,7 +264,7 @@ LIST_INSERT_HEAD(hd, sc, sc_next); if (bread(disk, fsbtodb(fs, cgtod(fs, sc->sc_cgx)), sc->sc_cgbuf, fs->fs_bsize) == -1) - err(1, "Unable to read cylinder group %d", sc->sc_cgx); + err_suj("Unable to read cylinder group %d\n", sc->sc_cgx); return (sc); } @@ -344,7 +367,7 @@ dblk->db_buf = errmalloc(size); dblk->db_size = size; if (bread(disk, fsbtodb(fs, blk), dblk->db_buf, size) == -1) - err(1, "Failed to read data block %jd", blk); + err_suj("Failed to read data block %jd\n", blk); } return (dblk->db_buf); } @@ -370,7 +393,7 @@ continue; if (bwrite(disk, fsbtodb(fs, dblk->db_blk), dblk->db_buf, dblk->db_size) == -1) - err(1, "Unable to write block %jd", + err_suj("Unable to write block %jd\n", dblk->db_blk); } } @@ -403,7 +426,7 @@ iblk->ib_blk = blk; LIST_INSERT_HEAD(hd, iblk, ib_next); if (bread(disk, fsbtodb(fs, blk), iblk->ib_buf, fs->fs_bsize) == -1) - err(1, "Failed to read inode block %jd", blk); + err_suj("Failed to read inode block %jd\n", blk); found: sc->sc_lastiblk = iblk; off = ino_to_fsbo(fs, ino); @@ -447,7 +470,7 @@ return; if (bwrite(disk, fsbtodb(fs, iblk->ib_blk), iblk->ib_buf, fs->fs_bsize) == -1) - err(1, "Failed to write inode block %jd", iblk->ib_blk); + err_suj("Failed to write inode block %jd\n", iblk->ib_blk); } static int @@ -679,9 +702,9 @@ return (0); level = lbn_level(cur); if (level == -1) - errx(1, "Invalid indir lbn %jd", lbn); + err_suj("Invalid indir lbn %jd\n", lbn); if (level == 0 && lbn < 0) - errx(1, "Invalid lbn %jd", lbn); + err_suj("Invalid lbn %jd\n", lbn); bap2 = (void *)dblk_read(blk, fs->fs_bsize); bap1 = (void *)bap2; lbnadd = 1; @@ -693,7 +716,7 @@ else i = (-lbn - base) / lbnadd; if (i < 0 || i >= NINDIR(fs)) - errx(1, "Invalid indirect index %d produced by lbn %jd", + err_suj("Invalid indirect index %d produced by lbn %jd\n", i, lbn); if (level == 0) cur = base + (i * lbnadd); @@ -705,10 +728,8 @@ blk = bap2[i]; if (cur == lbn) return (blk); - if (level == 0) { - abort(); - errx(1, "Invalid lbn %jd at level 0", lbn); - } + if (level == 0) + err_suj("Invalid lbn %jd at level 0\n", lbn); return indir_blkatoff(blk, ino, cur, lbn); } @@ -762,7 +783,8 @@ continue; return indir_blkatoff(DIP(ip, di_ib[i]), ino, -cur - i, lbn); } - errx(1, "lbn %jd not in ino", lbn); + err_suj("lbn %jd not in ino\n", lbn); + /* NOTREACHED */ } /* @@ -851,7 +873,7 @@ dpoff += dp->d_reclen; } while (dpoff <= doff); if (dpoff > fs->fs_bsize) - errx(1, "Corrupt directory block in dir ino %d", parent); + err_suj("Corrupt directory block in dir ino %d\n", parent); /* Not found. */ if (dpoff != doff) { if (debug) @@ -907,7 +929,7 @@ return; level = lbn_level(lbn); if (level == -1) - errx(1, "Invalid level for lbn %jd", lbn); + err_suj("Invalid level for lbn %jd\n", lbn); if ((flags & VISIT_ROOT) == 0 && blk_isindir(blk, ino, lbn) == 0) { if (debug) printf("blk %jd ino %d lbn %jd(%d) is not indir.\n", @@ -1203,7 +1225,7 @@ uint32_t gen; if (ino == ROOTINO) - errx(1, "Attempting to free ROOTINO"); + err_suj("Attempting to free ROOTINO\n"); if (debug) printf("Truncating and freeing ino %d, nlink %d, mode %o\n", ino, DIP(ip, di_nlink), DIP(ip, di_mode)); @@ -1240,9 +1262,9 @@ nlink = DIP(ip, di_nlink); mode = DIP(ip, di_mode); if (nlink < 1) - errx(1, "Inode %d link count %d invalid", ino, nlink); + err_suj("Inode %d link count %d invalid\n", ino, nlink); if (mode == 0) - errx(1, "Inode %d has a link of %d with 0 mode.", ino, nlink); + err_suj("Inode %d has a link of %d with 0 mode\n", ino, nlink); nlink--; if ((mode & IFMT) == IFDIR) reqlink = 2; @@ -1300,8 +1322,8 @@ ip = ino_read(ino); mode = DIP(ip, di_mode) & IFMT; if (nlink > LINK_MAX) - errx(1, - "ino %d nlink manipulation error, new link %d, old link %d", + err_suj( + "ino %d nlink manipulation error, new link %d, old link %d\n", >>> TRUNCATED FOR MAIL (1000 lines) <<< From owner-p4-projects@FreeBSD.ORG Wed Jun 30 00:08:04 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 105091065673; Wed, 30 Jun 2010 00:08:04 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8C4F106566C for ; Wed, 30 Jun 2010 00:08:03 +0000 (UTC) (envelope-from jceel@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B66EB8FC12 for ; Wed, 30 Jun 2010 00:08:03 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5U0838m002775 for ; Wed, 30 Jun 2010 00:08:03 GMT (envelope-from jceel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5U083ex002773 for perforce@freebsd.org; Wed, 30 Jun 2010 00:08:03 GMT (envelope-from jceel@freebsd.org) Date: Wed, 30 Jun 2010 00:08:03 GMT Message-Id: <201006300008.o5U083ex002773@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jceel@freebsd.org using -f From: Jakub Wojciech Klama To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180337 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2010 00:08:04 -0000 http://p4web.freebsd.org/@@180337?ac=10 Change 180337 by jceel@jceel on 2010/06/30 00:07:50 Add initial version of DMA test suite. Affected files ... .. //depot/projects/soc2010/jceel_dma/sys/arm/conf/DAVINCI#3 edit .. //depot/projects/soc2010/jceel_dma/sys/contrib/dmatest/dmatest.c#1 add .. //depot/projects/soc2010/jceel_dma/sys/modules/dmatest/Makefile#1 add Differences ... ==== //depot/projects/soc2010/jceel_dma/sys/arm/conf/DAVINCI#3 (text+ko) ==== @@ -7,7 +7,7 @@ ident DAVINCI include "../davinci/std.davinci" -makeoptions MODULES_OVERRIDE="" +makeoptions MODULES_OVERRIDE="dmatest" #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" From owner-p4-projects@FreeBSD.ORG Wed Jun 30 02:36:47 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 65E001065678; Wed, 30 Jun 2010 02:36:47 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 120371065676 for ; Wed, 30 Jun 2010 02:36:47 +0000 (UTC) (envelope-from bfiedler@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id F23908FC1A for ; Wed, 30 Jun 2010 02:36:46 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5U2aksX027100 for ; Wed, 30 Jun 2010 02:36:46 GMT (envelope-from bfiedler@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5U2akvD027098 for perforce@freebsd.org; Wed, 30 Jun 2010 02:36:46 GMT (envelope-from bfiedler@FreeBSD.org) Date: Wed, 30 Jun 2010 02:36:46 GMT Message-Id: <201006300236.o5U2akvD027098@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bfiedler@FreeBSD.org using -f From: Benjamin Fiedler To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180341 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2010 02:36:47 -0000 http://p4web.freebsd.org/@@180341?ac=10 Change 180341 by bfiedler@freebsd-7803 on 2010/06/30 02:36:09 Initial work for formatting options Affected files ... .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#7 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#6 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#7 edit Differences ... ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#7 (text+ko) ==== @@ -71,9 +71,14 @@ HORIZ_OPT, LEFTC_OPT, SUPCL_OPT, - GTYPE_OPT, LF_OPT, - LLF_OPT, + UNCGF_OPT, + CHGF_OPT, + OLDGF_OPT, + NEWGF_OPT, + UNCLF_OPT, + OLDLF_OPT, + NEWLF_OPT, TSIZE_OPT, HLINES_OPT, LFILES_OPT, @@ -129,19 +134,16 @@ { "left-column", no_argument, NULL, LEFTC_OPT }, { "suppress-common-lines", no_argument, NULL, SUPCL_OPT }, -/* XXX: the following are not very well documented and rarely used. If we need - them at all, we will need to dig into the code to see what do they do - actually. - { "line-format", required_argument, NULL, NOOP_OPT }, +/* XXX: the following are not very well documented and rarely used. */ + { "line-format", required_argument, NULL, LF_OPT }, { "show-function-line", required_argument, NULL, 'F' }, - { "unchanged-group-format", required_argument, NULL, NOOP_OPT }, - { "old-group-format", required_argument, NULL, NOOP_OPT }, - { "new-group-format", required_argument, NULL, NOOP_OPT }, - { "changed-group-format", required_argument, NULL, NOOP_OPT }, - { "unchanged-line-format", required_argument, NULL, NOOP_OPT }, - { "old-line-format", required_argument, NULL, NOOP_OPT }, - { "new-line-format", required_argument, NULL, NOOP_OPT }, -*/ + { "unchanged-group-format", required_argument, NULL, UNCGF_OPT }, + { "old-group-format", required_argument, NULL, OLDGF_OPT }, + { "new-group-format", required_argument, NULL, NEWGF_OPT }, + { "changed-group-format", required_argument, NULL, CHGF_OPT }, + { "unchanged-line-format", required_argument, NULL, UNCLF_OPT }, + { "old-line-format", required_argument, NULL, OLDLF_OPT }, + { "new-line-format", required_argument, NULL, NEWLF_OPT }, { NULL, 0, NULL, '\0'} }; ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#6 (text+ko) ==== @@ -102,3 +102,4 @@ void diffdir(char *, char *); void print_only(const char *, size_t, const char *); void print_status(int, char *, char *, char *); +void print_line(char *, char *, char *, int *, int *); ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#7 (text+ko) ==== @@ -706,7 +706,7 @@ ixold[0] = ixnew[0] = 0; jackpot = 0; ctold = ctnew = 0; - ccol = dcol = 0; + b = ccol = dcol = 0; for (i = 1; i <= len[0]; i++) { if (J[i] == 0) { ixold[i] = ctold += skipline(f1); @@ -773,7 +773,7 @@ } else if(d == L'\t') { - b = strd[++b]; + d = strd[++b]; dcol += (b+dcol) % tabsize; } @@ -1529,3 +1529,44 @@ printf("%s %s\t%s", format == D_CONTEXT ? "---" : "+++", file2, ctime(&stb2.st_mtime)); } + +void print_line(char *line1, char *line2, char *fmt, int *pos1, int *pos2) +{ + int num = 0; + char *spec, *tmp, *end, *new; + + new = malloc(sizeof(char) * strlen(fmt)); + spec = tmp = NULL; + end = &fmt[strlen(fmt)]; + + for(; (spec = strchr(fmt, '%')) != NULL; num++); + + malloc(sizeof(char) * strlen(fmt)); + + + while( (spec = strchr(fmt,'%')) != NULL && spec+1 < end) + { + spec+=1; + + switch (*spec) { + case 'l': + break; + + case 'L': + break; + + case '%': + break; + + case '\'': + break; + + default: + break; + } + } + + printf("%s", new); + +} + From owner-p4-projects@FreeBSD.ORG Wed Jun 30 16:02:27 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 986D01065670; Wed, 30 Jun 2010 16:02:27 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CEAC106566B for ; Wed, 30 Jun 2010 16:02:27 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4A8AB8FC0C for ; Wed, 30 Jun 2010 16:02:27 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5UG2RGx034180 for ; Wed, 30 Jun 2010 16:02:27 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5UG2Rvp034178 for perforce@freebsd.org; Wed, 30 Jun 2010 16:02:27 GMT (envelope-from afiveg@FreeBSD.org) Date: Wed, 30 Jun 2010 16:02:27 GMT Message-Id: <201006301602.o5UG2Rvp034178@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180344 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2010 16:02:27 -0000 http://p4web.freebsd.org/@@180344?ac=10 Change 180344 by afiveg@cottonmouth on 2010/06/30 16:02:23 setting taskqueue_run() in order to wait for delayed tasks in the taskqueue. I am not sure it is a best solution :( Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#9 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#17 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#15 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#16 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#14 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#20 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#20 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#5 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#9 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#17 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#15 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#16 (text+ko) ==== @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -52,12 +53,15 @@ /* Disable interrupts of adapter */ rm_8254_disable_intr(dev); - /* Check whether we have some tasks in queue */ - taskqueue_drain(adapter->tq, &adapter->rxtx_task); + /* + * Check whether we have some tasks in the queue. It should be done + * because we want to free the memory regions that could be accessed + * from the delayed interrupt tasks + */ + taskqueue_run(adapter->tq); if (ring != NULL){ contigfree(ring, sizeof(struct ring), M_DEVBUF); - ring = NULL; } else { RINGMAP_ERROR(The pointer to ring structure is NULL); } @@ -94,7 +98,7 @@ * Before continue look whether any delayed interrupt tasks are * in the taskqueue. */ - taskqueue_drain(adapter->tq, &adapter->rxtx_task); + taskqueue_run(adapter->tq); /* Set ring fields in the initial state */ ring->kern_wait_user = 0; @@ -155,7 +159,9 @@ struct adapter *adapter; adapter = (struct adapter *)device_get_softc(dev); - RINGMAP_HW_SYNC_TAIL(adapter, ring); /* SW_TAIL ==> HW_TAIL */ + if (ring != NULL) { + RINGMAP_HW_SYNC_TAIL(adapter, ring); /* SW_TAIL ==> HW_TAIL */ + } } @@ -165,7 +171,9 @@ struct adapter *adapter; adapter = (struct adapter *)device_get_softc(dev); - RINGMAP_HW_SYNC_HEAD(adapter, ring); /* SW_TAIL ==> HW_HEAD */ + if (ring != NULL) { + RINGMAP_HW_SYNC_HEAD(adapter, ring); /* SW_TAIL ==> HW_HEAD */ + } } @@ -180,9 +188,6 @@ /* count interrupts */ adapter->rm->ring->interrupts_counter++; -#if (RINGMAP_INTR_DEB) - rm_8254_print_ring_pointers(adapter); -#endif } @@ -198,11 +203,16 @@ * TODO: we want multithreading, it means we should later * sync not one ring but many rings, each per thread */ - rm_8254_sync_tail(adapter->dev, adapter->rm->ring); + + if (adapter->rm != NULL) { + rm_8254_sync_tail(adapter->dev, adapter->rm->ring); + } #ifdef RINGMAP_TIMESTAMP - getmicrotime(&adapter->rm->ring->last_ts); + if (adapter->rm->ring != NULL) { + getmicrotime(&adapter->rm->ring->last_ts); + } #endif RINGMAP_INTR(end); ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#14 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#20 (text+ko) ==== @@ -326,6 +326,7 @@ if (rm->ring != NULL){ rm->funcs->free_ring(rm->dev, rm->ring); + rm->ring = NULL; } RINGMAP_FUNC_DEBUG(end); ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#20 (text+ko) ==== @@ -442,7 +442,7 @@ #define PRINT_SLOT(ring, i, arg) \ if (((ring) != NULL) && ((arg) != NULL) && ((i) < SLOTS_NUMBER)){ \ printf("\n=+= =============================\n"); \ - printf("=+= Kernel slot: %d \n", (ring)->cur_slot_kern); \ + printf("=+= Slot Number: %d \n", (i)); \ printf("=+= Intrr num: %llu\n", (ring)->slot[(i)].intr_num); \ printf("=+= Time stamp: %llu\n", (unsigned long long)(((ring)->slot[(i)].ts.tv_sec*1000000 + (ring)->slot[(i)].ts.tv_usec))); \ printf("=+= Accepted: %d\n", (ring)->slot[(i)].is_ok); \ ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#5 (text+ko) ==== From owner-p4-projects@FreeBSD.ORG Wed Jun 30 18:07:45 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 14FCA1065676; Wed, 30 Jun 2010 18:07:45 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD0FB1065674 for ; Wed, 30 Jun 2010 18:07:44 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B948A8FC15 for ; Wed, 30 Jun 2010 18:07:44 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5UI7ioW057384 for ; Wed, 30 Jun 2010 18:07:44 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5UI7iE4057382 for perforce@freebsd.org; Wed, 30 Jun 2010 18:07:44 GMT (envelope-from trasz@freebsd.org) Date: Wed, 30 Jun 2010 18:07:44 GMT Message-Id: <201006301807.o5UI7iE4057382@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to trasz@freebsd.org using -f From: Edward Tomasz Napierala To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180350 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2010 18:07:45 -0000 http://p4web.freebsd.org/@@180350?ac=10 Change 180350 by trasz@trasz_victim on 2010/06/30 18:07:01 Rename resource allocation and deallocation routines to rusage_add(), rusage_sub() and rusage_set(). The reason for such a naming, instead of e.g. container_rusage_add(), is that they might be reused for other mechanisms, such as IRIX jobs, which are being implemented by Gabor, which don't really require containers. Affected files ... .. //depot/projects/soc2009/trasz_limits/sys/compat/linux/linux_misc.c#12 edit .. //depot/projects/soc2009/trasz_limits/sys/compat/svr4/imgact_svr4.c#6 edit .. //depot/projects/soc2009/trasz_limits/sys/compat/svr4/svr4_filio.c#6 edit .. //depot/projects/soc2009/trasz_limits/sys/fs/unionfs/union_subr.c#7 edit .. //depot/projects/soc2009/trasz_limits/sys/i386/linux/imgact_linux.c#5 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/imgact_aout.c#6 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/imgact_elf.c#11 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/imgact_gzip.c#4 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/init_main.c#23 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#6 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_exit.c#21 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_fork.c#16 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#78 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#35 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/tty_pts.c#16 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/vfs_vnops.c#16 edit .. //depot/projects/soc2009/trasz_limits/sys/sys/container.h#4 edit .. //depot/projects/soc2009/trasz_limits/sys/vm/vm_map.c#15 edit .. //depot/projects/soc2009/trasz_limits/sys/vm/vm_unix.c#6 edit Differences ... ==== //depot/projects/soc2009/trasz_limits/sys/compat/linux/linux_misc.c#12 (text+ko) ==== @@ -363,7 +363,7 @@ error = ENOMEM; goto cleanup; } - error = hrl_allocated(td->td_proc, HRL_RESOURCE_DATASIZE, + error = rusage_set(td->td_proc, RUSAGE_DATASIZE, a_out->a_data + bss_size); if (error) { error = ENOMEM; ==== //depot/projects/soc2009/trasz_limits/sys/compat/svr4/imgact_svr4.c#6 (text+ko) ==== @@ -109,7 +109,7 @@ */ if (a_out->a_text > maxtsiz) return (ENOMEM); - error = hrl_allocated(imgp->proc, HRL_RESOURCE_DATASIZE, + error = rusage_set(imgp->proc, RUSAGE_DATASIZE, a_out->a_data + bss_size); if (error) return (ENOMEM); ==== //depot/projects/soc2009/trasz_limits/sys/compat/svr4/svr4_filio.c#6 (text+ko) ==== @@ -78,7 +78,7 @@ } PROC_UNLOCK(td->td_proc); - hrl_alloc(td->td_proc, HRL_RESOURCE_FILEDESCRIPTORS, uap->nfds); + rusage_add(td->td_proc, RUSAGE_FILEDESCRIPTORS, uap->nfds); pa.fds = uap->fds; pa.nfds = uap->nfds; @@ -105,7 +105,7 @@ forget to update it if I add more code */ } done: - hrl_free(td->td_proc, HRL_RESOURCE_FILEDESCRIPTORS, uap->nfds); + rusage_sub(td->td_proc, RUSAGE_FILEDESCRIPTORS, uap->nfds); free(pfd, M_TEMP); return error; } ==== //depot/projects/soc2009/trasz_limits/sys/fs/unionfs/union_subr.c#7 (text+ko) ==== @@ -779,7 +779,7 @@ chgproccnt(cred->cr_ruidinfo, 1, 0); #ifdef notyet /* XXX: What about the return value? And what's the purpose of this, anyway? */ - hrl_alloc(HRL_RESOURCE_MAXPROCESSES, 1); + rusage_add(RUSAGE_MAXPROCESSES, 1); #endif change_euid(cred, rootinfo); change_ruid(cred, rootinfo); @@ -832,7 +832,7 @@ cnp->cn_cred = credbk; chgproccnt(cred->cr_ruidinfo, -1, 0); #ifdef notyet - hrl_free(HRL_RESOURCE_MAXPROCESSES, 1); + rusage_sub(RUSAGE_MAXPROCESSES, 1); #endif crfree(cred); ==== //depot/projects/soc2009/trasz_limits/sys/i386/linux/imgact_linux.c#5 (text+ko) ==== @@ -107,7 +107,7 @@ */ if (a_out->a_text > maxtsiz) return (ENOMEM); - error = hrl_allocated(imgp->proc, HRL_RESOURCE_DATASIZE, + error = rusage_set(imgp->proc, RUSAGE_DATASIZE, a_out->a_data + bss_size); if (error) return (ENOMEM); ==== //depot/projects/soc2009/trasz_limits/sys/kern/imgact_aout.c#6 (text+ko) ==== @@ -188,7 +188,7 @@ if (/* text can't exceed maximum text size */ a_out->a_text > maxtsiz) return (ENOMEM); - error = hrl_allocated(imgp->proc, HRL_RESOURCE_DATASIZE, + error = rusage_set(imgp->proc, RUSAGE_DATASIZE, a_out->a_data + bss_size); if (error) return (ENOMEM); ==== //depot/projects/soc2009/trasz_limits/sys/kern/imgact_elf.c#11 (text+ko) ==== @@ -874,11 +874,11 @@ */ if (text_size > maxtsiz) return (ENOMEM); - error = hrl_allocated(imgp->proc, HRL_RESOURCE_DATASIZE, + error = rusage_set(imgp->proc, RUSAGE_DATASIZE, data_size); if (error) return (ENOMEM); - error = hrl_allocated(imgp->proc, HRL_RESOURCE_VMEMORYUSE, + error = rusage_set(imgp->proc, RUSAGE_VMEMORYUSE, total_size); if (error) return (ENOMEM); ==== //depot/projects/soc2009/trasz_limits/sys/kern/imgact_gzip.c#4 (text+ko) ==== @@ -215,7 +215,7 @@ gz->where = __LINE__; return (ENOMEM); } - error = hrl_allocated_proc(gz->ip->proc, HRL_RESOURCE_DATASIZE, + error = rusage_set(gz->ip->proc, RUSAGE_DATASIZE, gz->a_out.a_data + gz->bss_size); if (error) return (ENOMEM); ==== //depot/projects/soc2009/trasz_limits/sys/kern/init_main.c#23 (text+ko) ==== @@ -563,8 +563,8 @@ * Charge root for one process. */ (void)chgproccnt(p->p_ucred->cr_ruidinfo, 1, 0); - error = hrl_alloc(p, HRL_RESOURCE_MAXPROCESSES, 1); - KASSERT(error == 0, ("hrl_alloc failed")); + error = rusage_add(p, RUSAGE_MAXPROCESSES, 1); + KASSERT(error == 0, ("rusage_add failed")); } SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init, NULL); ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#6 (text+ko) ==== @@ -64,7 +64,7 @@ mtx_assert(&container_lock, MA_OWNED); - for (i = 0; i <= HRL_RESOURCE_MAX; i++) { + for (i = 0; i <= RUSAGE_MAX; i++) { KASSERT(dest->c_resources[i] >= 0, ("resource usage propagation meltdown: dest < 0")); KASSERT(src->c_resources[i] >= 0, @@ -82,7 +82,7 @@ mtx_assert(&container_lock, MA_OWNED); - for (i = 0; i <= HRL_RESOURCE_MAX; i++) { + for (i = 0; i <= RUSAGE_MAX; i++) { KASSERT(dest->c_resources[i] >= 0, ("resource usage propagation meltdown: dest < 0")); KASSERT(src->c_resources[i] >= 0, @@ -156,7 +156,7 @@ { int i; - for (i = 0; i <= HRL_RESOURCE_MAX; i++) + for (i = 0; i <= RUSAGE_MAX; i++) KASSERT(container->c_resources[i] == 0, ("container->c_resources[%d] != NULL", i)); for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) @@ -170,7 +170,7 @@ int i; mtx_lock(&container_lock); - for (i = 0; i <= HRL_RESOURCE_MAX; i++) { + for (i = 0; i <= RUSAGE_MAX; i++) { if (container->c_resources[i] != 0) printf("destroying non-empty container: " "%ju allocated for resource %d", @@ -195,7 +195,7 @@ mtx_assert(&container_lock, MA_OWNED); KASSERT(container != NULL, ("NULL container")); - for (resource = 0; resource <= HRL_RESOURCE_MAX; resource++) { + for (resource = 0; resource <= RUSAGE_MAX; resource++) { KASSERT(container->c_resources[resource] >= 0, ("resource usage propagation meltdown: resource < 0")); } @@ -205,7 +205,7 @@ if (parent == NULL); continue; container_assert(parent); - for (resource = 0; resource <= HRL_RESOURCE_MAX; resource++) { + for (resource = 0; resource <= RUSAGE_MAX; resource++) { KASSERT(parent->c_resources[resource] >= container->c_resources[resource], ("resource usage propagation meltdown: child > parent")); @@ -244,17 +244,17 @@ * Return 0 if it's below limits, or errno, if it's not. */ int -hrl_alloc(struct proc *p, int resource, uint64_t amount) +rusage_add(struct proc *p, int resource, uint64_t amount) { #ifdef HRL int error; #endif #if 0 - printf("hrl_alloc: allocating %ju of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); + printf("rusage_add: allocating %ju of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); #endif - KASSERT(amount > 0, ("hrl_alloc: invalid amount for resource %d: %ju", + KASSERT(amount > 0, ("rusage_add: invalid amount for resource %d: %ju", resource, amount)); mtx_lock(&container_lock); @@ -279,7 +279,7 @@ * even if it's above the limit. */ int -hrl_allocated(struct proc *p, int resource, uint64_t amount) +rusage_set(struct proc *p, int resource, uint64_t amount) { int64_t diff; #ifdef HRL @@ -287,10 +287,10 @@ #endif #if 0 - printf("hrl_allocated: allocated %lld of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); + printf("rusage_set: allocated %lld of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); #endif - KASSERT(amount >= 0, ("hrl_allocated: invalid amount for resource %d: %ju", + KASSERT(amount >= 0, ("rusage_set: invalid amount for resource %d: %ju", resource, amount)); mtx_lock(&container_lock); @@ -314,19 +314,19 @@ * Decrease allocation of 'resource' by 'amount' for process 'p'. */ void -hrl_free(struct proc *p, int resource, uint64_t amount) +rusage_sub(struct proc *p, int resource, uint64_t amount) { #if 0 - printf("hrl_free: freeing %lld of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); + printf("rusage_sub: freeing %lld of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid); #endif - KASSERT(amount > 0, ("hrl_free: invalid amount for resource %d: %ju", + KASSERT(amount > 0, ("rusage_sub: invalid amount for resource %d: %ju", resource, amount)); mtx_lock(&container_lock); KASSERT(amount <= p->p_container.c_resources[resource], - ("hrl_free: freeing %ju of resource %d, which is more than allocated " + ("rusage_sub: freeing %ju of resource %d, which is more than allocated " "%ld for %s (pid %d)", amount, resource, p->p_container.c_resources[resource], p->p_comm, p->p_pid)); @@ -339,7 +339,7 @@ { switch (resource) { - case HRL_RESOURCE_MAXPROCESSES: + case RUSAGE_MAXPROCESSES: return (0); default: return (1); @@ -352,9 +352,9 @@ /* * XXX: Free these three some other way. */ - hrl_allocated(p, HRL_RESOURCE_FILESIZE, 0); - hrl_allocated(p, HRL_RESOURCE_COREDUMPSIZE, 0); - hrl_allocated(p, HRL_RESOURCE_PTY, 0); + rusage_set(p, RUSAGE_FILESIZE, 0); + rusage_set(p, RUSAGE_COREDUMPSIZE, 0); + rusage_set(p, RUSAGE_PTY, 0); mtx_lock(&container_lock); container_destroy(&p->p_container); @@ -387,10 +387,10 @@ container_join(&child->p_container, container); } - for (i = 0; i <= HRL_RESOURCE_MAX; i++) { + for (i = 0; i <= RUSAGE_MAX; i++) { if (parent->p_container.c_resources[i] != 0 && container_resource_inheritable(i)) - hrl_allocated(child, i, + rusage_set(child, i, parent->p_container.c_resources[i]); } ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_exit.c#21 (text+ko) ==== @@ -767,7 +767,7 @@ * Decrement the count of procs running with this uid. */ (void)chgproccnt(p->p_ucred->cr_ruidinfo, -1, 0); - hrl_free(p->p_pptr, HRL_RESOURCE_MAXPROCESSES, 1); + rusage_sub(p->p_pptr, RUSAGE_MAXPROCESSES, 1); /* * Destroy resource container associated with the process. @@ -933,9 +933,9 @@ if (child->p_pptr == parent) return; - hrl_free(child->p_pptr, HRL_RESOURCE_MAXPROCESSES, 1); + rusage_sub(child->p_pptr, RUSAGE_MAXPROCESSES, 1); /* XXX: What about return value? */ - hrl_alloc(parent, HRL_RESOURCE_MAXPROCESSES, 1); + rusage_add(parent, RUSAGE_MAXPROCESSES, 1); PROC_LOCK(child->p_pptr); sigqueue_take(child->p_ksi); ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_fork.c#16 (text+ko) ==== @@ -224,7 +224,7 @@ p1 = td->td_proc; - error = hrl_alloc(p1, HRL_RESOURCE_MAXPROCESSES, 1); + error = rusage_add(p1, RUSAGE_MAXPROCESSES, 1); if (error) return (error); @@ -238,7 +238,7 @@ PROC_LOCK(p1); if (thread_single(SINGLE_BOUNDARY)) { PROC_UNLOCK(p1); - hrl_free(p1, HRL_RESOURCE_MAXPROCESSES, 1); + rusage_sub(p1, RUSAGE_MAXPROCESSES, 1); return (ERESTART); } PROC_UNLOCK(p1); @@ -273,7 +273,7 @@ } *procp = NULL; if (error) - hrl_free(p1, HRL_RESOURCE_MAXPROCESSES, 1); + rusage_sub(p1, RUSAGE_MAXPROCESSES, 1); return (error); } @@ -811,7 +811,7 @@ vmspace_free(vm2); uma_zfree(proc_zone, newproc); pause("fork", hz / 2); - hrl_free(p1, HRL_RESOURCE_MAXPROCESSES, 1); + rusage_sub(p1, RUSAGE_MAXPROCESSES, 1); return (error); } ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#78 (text+ko) ==== @@ -88,19 +88,19 @@ { NULL, -1 }}; static struct dict resourcenames[] = { - { "cputime", HRL_RESOURCE_CPUTIME }, - { "filesize", HRL_RESOURCE_FILESIZE }, - { "datasize", HRL_RESOURCE_DATASIZE }, - { "stacksize", HRL_RESOURCE_STACKSIZE }, - { "coredumpsize", HRL_RESOURCE_COREDUMPSIZE }, - { "memoryuse", HRL_RESOURCE_MEMORYUSE }, - { "memorylocked", HRL_RESOURCE_MEMORYLOCKED }, - { "maxprocesses", HRL_RESOURCE_MAXPROCESSES }, - { "filedescriptors", HRL_RESOURCE_FILEDESCRIPTORS }, - { "sbsize", HRL_RESOURCE_SBSIZE }, - { "vmemoryuse", HRL_RESOURCE_VMEMORYUSE }, - { "pty", HRL_RESOURCE_PTY }, - { "swap", HRL_RESOURCE_SWAP }, + { "cputime", RUSAGE_CPUTIME }, + { "filesize", RUSAGE_FILESIZE }, + { "datasize", RUSAGE_DATASIZE }, + { "stacksize", RUSAGE_STACKSIZE }, + { "coredumpsize", RUSAGE_COREDUMPSIZE }, + { "memoryuse", RUSAGE_MEMORYUSE }, + { "memorylocked", RUSAGE_MEMORYLOCKED }, + { "maxprocesses", RUSAGE_MAXPROCESSES }, + { "filedescriptors", RUSAGE_FILEDESCRIPTORS }, + { "sbsize", RUSAGE_SBSIZE }, + { "vmemoryuse", RUSAGE_VMEMORYUSE }, + { "pty", RUSAGE_PTY }, + { "swap", RUSAGE_SWAP }, { NULL, -1 }}; static struct dict actionnames[] = { @@ -263,7 +263,7 @@ int hrl_enforce_proc(struct proc *p, int resource, uint64_t amount) { - int64_t available[HRL_RESOURCE_MAX]; + int64_t available[RUSAGE_MAX]; struct hrl_rule *rule; struct hrl_rule_link *link; struct sbuf sb; @@ -369,7 +369,7 @@ mtx_assert(&container_lock, MA_OWNED); - for (i = 0; i <= HRL_RESOURCE_MAX; i++) + for (i = 0; i <= RUSAGE_MAX; i++) (*availablep)[i] = INT64_MAX; LIST_FOREACH(link, &p->p_container.c_rule_links, hrl_next) { @@ -428,7 +428,7 @@ } } - if (filter->hr_resource != HRL_RESOURCE_UNDEFINED) { + if (filter->hr_resource != RUSAGE_UNDEFINED) { if (rule->hr_resource != filter->hr_resource) return (0); } @@ -640,7 +640,7 @@ rule->hr_subject.hs_loginclass = NULL; rule->hr_subject.hs_prison = NULL; rule->hr_per = HRL_SUBJECT_TYPE_UNDEFINED; - rule->hr_resource = HRL_RESOURCE_UNDEFINED; + rule->hr_resource = RUSAGE_UNDEFINED; rule->hr_action = HRL_ACTION_UNDEFINED; rule->hr_amount = HRL_AMOUNT_UNDEFINED; refcount_init(&rule->hr_refcount, 1); @@ -724,7 +724,7 @@ panic("hrl_rule_fully_specified: unknown subject type %d", rule->hr_subject_type); } - if (rule->hr_resource == HRL_RESOURCE_UNDEFINED) + if (rule->hr_resource == RUSAGE_UNDEFINED) return (0); if (rule->hr_action == HRL_ACTION_UNDEFINED) return (0); @@ -816,7 +816,7 @@ } if (resourcestr == NULL || resourcestr[0] == '\0') - rule->hr_resource = HRL_RESOURCE_UNDEFINED; + rule->hr_resource = RUSAGE_UNDEFINED; else { error = str2value(resourcestr, &rule->hr_resource, resourcenames); @@ -1119,7 +1119,7 @@ struct sbuf *sb; sb = sbuf_new_auto(); - for (i = 0; i <= HRL_RESOURCE_MAX; i++) { + for (i = 0; i <= RUSAGE_MAX; i++) { sbuf_printf(sb, "%s=%jd,", hrl_resource_name(i), container->c_resources[i]); } ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#35 (text+ko) ==== @@ -671,49 +671,49 @@ switch (which) { case RLIMIT_CPU: - rule->hr_resource = HRL_RESOURCE_CPUTIME; + rule->hr_resource = RUSAGE_CPUTIME; rule->hr_action = HRL_ACTION_SIGXCPU; break; case RLIMIT_FSIZE: - rule->hr_resource = HRL_RESOURCE_FILESIZE; + rule->hr_resource = RUSAGE_FILESIZE; break; case RLIMIT_DATA: - rule->hr_resource = HRL_RESOURCE_DATASIZE; + rule->hr_resource = RUSAGE_DATASIZE; break; case RLIMIT_STACK: - rule->hr_resource = HRL_RESOURCE_STACKSIZE; + rule->hr_resource = RUSAGE_STACKSIZE; rule->hr_action = HRL_ACTION_SIGSEGV; break; case RLIMIT_CORE: - rule->hr_resource = HRL_RESOURCE_COREDUMPSIZE; + rule->hr_resource = RUSAGE_COREDUMPSIZE; break; case RLIMIT_RSS: - rule->hr_resource = HRL_RESOURCE_MEMORYUSE; + rule->hr_resource = RUSAGE_MEMORYUSE; break; case RLIMIT_MEMLOCK: - rule->hr_resource = HRL_RESOURCE_MEMORYLOCKED; + rule->hr_resource = RUSAGE_MEMORYLOCKED; break; case RLIMIT_NPROC: - rule->hr_resource = HRL_RESOURCE_MAXPROCESSES; + rule->hr_resource = RUSAGE_MAXPROCESSES; rule->hr_per = HRL_SUBJECT_TYPE_USER; break; case RLIMIT_NOFILE: - rule->hr_resource = HRL_RESOURCE_FILEDESCRIPTORS; + rule->hr_resource = RUSAGE_FILEDESCRIPTORS; rule->hr_action = HRL_ACTION_SIGXFSZ; break; case RLIMIT_SBSIZE: - rule->hr_resource = HRL_RESOURCE_SBSIZE; + rule->hr_resource = RUSAGE_SBSIZE; rule->hr_per = HRL_SUBJECT_TYPE_USER; break; case RLIMIT_VMEM: - rule->hr_resource = HRL_RESOURCE_VMEMORYUSE; + rule->hr_resource = RUSAGE_VMEMORYUSE; break; case RLIMIT_NPTS: - rule->hr_resource = HRL_RESOURCE_PTY; + rule->hr_resource = RUSAGE_PTY; rule->hr_per = HRL_SUBJECT_TYPE_USER; break; case RLIMIT_SWAP: - rule->hr_resource = HRL_RESOURCE_SWAP; + rule->hr_resource = RUSAGE_SWAP; rule->hr_per = HRL_SUBJECT_TYPE_USER; break; default: ==== //depot/projects/soc2009/trasz_limits/sys/kern/tty_pts.c#16 (text+ko) ==== @@ -722,7 +722,7 @@ /* Resource limiting. */ PROC_LOCK(p); ok = chgptscnt(uid, 1, lim_cur(p, RLIMIT_NPTS)); - error = hrl_alloc(p, HRL_RESOURCE_PTY, 1); + error = rusage_add(p, RUSAGE_PTY, 1); PROC_UNLOCK(p); if (ok != !error) printf("pts_alloc: ok = %d, error = %d\n", ok, error); @@ -733,7 +733,7 @@ unit = alloc_unr(pts_pool); if (unit < 0) { chgptscnt(uid, -1, 0); - hrl_free(p, HRL_RESOURCE_PTY, 1); + rusage_sub(p, RUSAGE_PTY, 1); return (EAGAIN); } @@ -772,7 +772,7 @@ /* Resource limiting. */ PROC_LOCK(p); ok = chgptscnt(uid, 1, lim_cur(p, RLIMIT_NPTS)); - error = hrl_alloc(p, HRL_RESOURCE_PTY, 1); + error = rusage_add(p, RUSAGE_PTY, 1); PROC_UNLOCK(p); if (ok != !error) printf("pts_alloc: ok = %d, error = %d\n", ok, error); ==== //depot/projects/soc2009/trasz_limits/sys/kern/vfs_vnops.c#16 (text+ko) ==== @@ -1347,6 +1347,6 @@ if (vp->v_type != VREG || td == NULL) return (0); - return (hrl_allocated(td->td_proc, HRL_RESOURCE_FILESIZE, + return (rusage_set(td->td_proc, RUSAGE_FILESIZE, (uoff_t)uio->uio_offset + uio->uio_resid)); } ==== //depot/projects/soc2009/trasz_limits/sys/sys/container.h#4 (text+ko) ==== @@ -46,23 +46,23 @@ * one parent container, loginclass and uidinfo structures have none. * This may change when - and if - we add per-group resource limits. */ -#define CONTAINER_PARENTS_MAX 3 +#define CONTAINER_PARENTS_MAX 3 -#define HRL_RESOURCE_UNDEFINED -1 -#define HRL_RESOURCE_CPUTIME 0x0000 -#define HRL_RESOURCE_FILESIZE 0x0001 -#define HRL_RESOURCE_DATASIZE 0x0002 -#define HRL_RESOURCE_STACKSIZE 0x0003 -#define HRL_RESOURCE_COREDUMPSIZE 0x0004 -#define HRL_RESOURCE_MEMORYUSE 0x0005 -#define HRL_RESOURCE_MEMORYLOCKED 0x0006 -#define HRL_RESOURCE_MAXPROCESSES 0x0007 -#define HRL_RESOURCE_FILEDESCRIPTORS 0x0008 -#define HRL_RESOURCE_SBSIZE 0x0009 -#define HRL_RESOURCE_VMEMORYUSE 0x000a -#define HRL_RESOURCE_PTY 0x000b -#define HRL_RESOURCE_SWAP 0x000c -#define HRL_RESOURCE_MAX HRL_RESOURCE_SWAP +#define RUSAGE_UNDEFINED -1 +#define RUSAGE_CPUTIME 0x0000 +#define RUSAGE_FILESIZE 0x0001 +#define RUSAGE_DATASIZE 0x0002 +#define RUSAGE_STACKSIZE 0x0003 +#define RUSAGE_COREDUMPSIZE 0x0004 +#define RUSAGE_MEMORYUSE 0x0005 +#define RUSAGE_MEMORYLOCKED 0x0006 +#define RUSAGE_MAXPROCESSES 0x0007 +#define RUSAGE_FILEDESCRIPTORS 0x0008 +#define RUSAGE_SBSIZE 0x0009 +#define RUSAGE_VMEMORYUSE 0x000a +#define RUSAGE_PTY 0x000b +#define RUSAGE_SWAP 0x000c +#define RUSAGE_MAX RUSAGE_SWAP /* * 'container' defines resource consumption for a particular @@ -84,14 +84,14 @@ * This structure must be filled with zeroes initially. */ struct container { - int64_t c_resources[HRL_RESOURCE_MAX + 1]; + int64_t c_resources[RUSAGE_MAX + 1]; struct container *c_parents[CONTAINER_PARENTS_MAX + 1]; LIST_HEAD(, hrl_rule_link) c_rule_links; }; -int hrl_alloc(struct proc *p, int object, uint64_t amount); -int hrl_allocated(struct proc *p, int object, uint64_t amount); -void hrl_free(struct proc *p, int object, uint64_t amount); +int rusage_add(struct proc *p, int object, uint64_t amount); +int rusage_set(struct proc *p, int object, uint64_t amount); +void rusage_sub(struct proc *p, int object, uint64_t amount); void container_create(struct container *container); void container_destroy(struct container *container); ==== //depot/projects/soc2009/trasz_limits/sys/vm/vm_map.c#15 (text+ko) ==== @@ -412,11 +412,11 @@ pmap_activate(td); vmspace_dofree(vm); } - hrl_allocated(p, HRL_RESOURCE_DATASIZE, 0); - hrl_allocated(p, HRL_RESOURCE_STACKSIZE, 0); - hrl_allocated(p, HRL_RESOURCE_MEMORYUSE, 0); - hrl_allocated(p, HRL_RESOURCE_MEMORYLOCKED, 0); - hrl_allocated(p, HRL_RESOURCE_VMEMORYUSE, 0); + rusage_set(p, RUSAGE_DATASIZE, 0); + rusage_set(p, RUSAGE_STACKSIZE, 0); + rusage_set(p, RUSAGE_MEMORYUSE, 0); + rusage_set(p, RUSAGE_MEMORYLOCKED, 0); + rusage_set(p, RUSAGE_VMEMORYUSE, 0); } /* Acquire reference to vmspace owned by another process. */ ==== //depot/projects/soc2009/trasz_limits/sys/vm/vm_unix.c#6 (text+ko) ==== @@ -85,7 +85,7 @@ base = round_page((vm_offset_t) vm->vm_daddr); old = base + ctob(vm->vm_dsize); if (new > base) { - error = hrl_allocated(td->td_proc, HRL_RESOURCE_DATASIZE, + error = rusage_set(td->td_proc, RUSAGE_DATASIZE, new - base); if (error) { error = ENOMEM; @@ -105,7 +105,7 @@ goto done; } if (new > old) { - error = hrl_allocated(td->td_proc, HRL_RESOURCE_VMEMORYUSE, + error = rusage_set(td->td_proc, RUSAGE_VMEMORYUSE, vm->vm_map.size + (new - old)); if (error) { error = ENOMEM; From owner-p4-projects@FreeBSD.ORG Thu Jul 1 00:17:30 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DA80B1065672; Thu, 1 Jul 2010 00:17:29 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EAC6106564A for ; Thu, 1 Jul 2010 00:17:29 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8B1478FC1F for ; Thu, 1 Jul 2010 00:17:29 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o610HTOZ001642 for ; Thu, 1 Jul 2010 00:17:29 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o610HTTG001640 for perforce@freebsd.org; Thu, 1 Jul 2010 00:17:29 GMT (envelope-from afiveg@FreeBSD.org) Date: Thu, 1 Jul 2010 00:17:29 GMT Message-Id: <201007010017.o610HTTG001640@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180356 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 00:17:30 -0000 http://p4web.freebsd.org/@@180356?ac=10 Change 180356 by afiveg@cottonmouth on 2010/07/01 00:16:33 Using EM_RX_LOCK for locking the ringmap data structures Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#5 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#10 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#18 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#16 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#17 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#15 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#21 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#21 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#5 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#6 edit .. //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#6 edit .. //depot/projects/soc2010/ringmap/tests/libpcap/test_pcap.c#5 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#10 (text+ko) ==== @@ -347,7 +347,7 @@ goto again; } - if (cnt == -1) + if ( (cnt == -1) || (cnt == 0) ) cnt = SW_TAIL_TO_HEAD_DIST(p->ring); for (ws = cnt ; ( (ws) && (RING_NOT_EMPTY(p->ring)) ) ; ) ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#18 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#16 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#17 (text+ko) ==== @@ -47,25 +47,22 @@ { struct adapter *adapter = (struct adapter *)device_get_softc(dev); - if ( adapter == NULL ) + if ( (adapter == NULL) || (ring == NULL) ) goto out; /* Disable interrupts of adapter */ rm_8254_disable_intr(dev); - /* - * Check whether we have some tasks in the queue. It should be done - * because we want to free the memory regions that could be accessed - * from the delayed interrupt tasks - */ - taskqueue_run(adapter->tq); - - if (ring != NULL){ - contigfree(ring, sizeof(struct ring), M_DEVBUF); - } else { - RINGMAP_ERROR(The pointer to ring structure is NULL); - } + EM_RX_LOCK(adapter); + + contigfree(ring, sizeof(struct ring), M_DEVBUF); + + adapter->rm->ring = NULL; + + EM_RX_UNLOCK(adapter); + out: ; + } struct ring * @@ -74,7 +71,7 @@ struct ring *ring; struct adapter *adapter = (struct adapter *)device_get_softc(dev); - if ( adapter == NULL ) { + if ( (adapter == NULL) || (adapter->rm == NULL) ) { return (NULL); } @@ -93,12 +90,7 @@ /* Disable interrupts of adapter while allocating the ring */ rm_8254_disable_intr(dev); - - /* - * Before continue look whether any delayed interrupt tasks are - * in the taskqueue. - */ - taskqueue_run(adapter->tq); + EM_RX_LOCK(adapter); /* Set ring fields in the initial state */ ring->kern_wait_user = 0; @@ -111,9 +103,28 @@ RINGMAP_ERROR(The ring is not initialized. Device will not be opened!); contigfree(ring, sizeof(struct ring), M_DEVBUF); + EM_RX_UNLOCK(adapter); + rm_8254_enable_intr(dev); + return (NULL); } + + /** + ** Currently only one process only one time can open our device !!! + **/ + if (!atomic_cmpset_int(&adapter->rm->open_cnt, 0, 1)){ + RINGMAP_ERROR(Sorry! Can not open device more then one time!); + atomic_readandclear_int(&adapter->rm->open_cnt); + + EM_RX_UNLOCK(adapter); + rm_8254_enable_intr(dev); + + return (NULL); + } + adapter->rm->ring = ring; + + EM_RX_UNLOCK(adapter); rm_8254_enable_intr(dev); return (ring); @@ -123,14 +134,17 @@ rm_8254_delayed_interrupt_per_packet(struct ring *ring, int slot_num) { RINGMAP_INTR(start); - ring->cur_slot_kern = slot_num; - ring->slot[slot_num].is_ok = 1; - ring->slot[slot_num].intr_num = ring->interrupts_counter; + + if ( ring != NULL ) { + ring->cur_slot_kern = slot_num; + ring->slot[slot_num].is_ok = 1; + ring->slot[slot_num].intr_num = ring->interrupts_counter; #ifdef RINGMAP_TIMESTAMP - ring->slot[slot_num].ts.tv_sec = ring->last_ts.tv_sec; - ring->slot[slot_num].ts.tv_usec = ring->last_ts.tv_usec; + ring->slot[slot_num].ts.tv_sec = ring->last_ts.tv_sec; + ring->slot[slot_num].ts.tv_usec = ring->last_ts.tv_usec; #endif + } RINGMAP_INTR(end); } ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#15 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#21 (text+ko) ==== @@ -43,7 +43,6 @@ device_t (*get_device_p)(struct cdev *); extern int rm_8254_set_ringmap_to_adapter(device_t, struct ringmap *); -extern int rm_8254_init_slots(struct ring *, device_t); extern struct ringmap * rm_8254_get_ringmap_p(device_t); extern device_t rm_8254_get_device_p(struct cdev *); extern void rm_8254_enable_intr(device_t); @@ -120,7 +119,6 @@ rm_8254_set_ringmap_to_adapter; rm->funcs->enable_intr = rm_8254_enable_intr; rm->funcs->disable_intr = rm_8254_disable_intr; - rm->funcs->init_slots = rm_8254_init_slots; rm->funcs->isr = rm_8254_interrupt; rm->funcs->delayed_isr = rm_8254_delayed_interrupt; rm->funcs->delayed_isr_per_packet = @@ -176,7 +174,6 @@ return (-1); } - funcs = (struct ringmap_functions *) contigmalloc ( sizeof (struct ringmap_functions), @@ -266,35 +263,29 @@ /* a little magic */ rm = get_ringmap_p(get_device_p(cdev)); - if (rm == NULL) { + if ( rm == NULL ) { RINGMAP_ERROR(Null pointer to ringmap structure); return (EIO); } - /** - ** Currently only one process only one time can open our device !!! - **/ - if (!atomic_cmpset_int(&rm->open_cnt, 0, 1)){ - RINGMAP_ERROR(Sorry! Can not open device more then one time!); - atomic_readandclear_int(&rm->open_cnt); - return (EIO); - } - - if (rm->dev == NULL){ + if ( rm->dev == NULL ) { RINGMAP_ERROR(Null pointer to device structure of adapter); - atomic_readandclear_int(&rm->open_cnt); return (EIO); } /* Allocate ring */ - rm->ring = rm->funcs->alloc_ring(rm->dev); - if (rm->ring == NULL){ + if ( rm->funcs->alloc_ring(rm->dev ) == NULL) { RINGMAP_ERROR(Null pointer to ring the structure); - atomic_readandclear_int(&rm->open_cnt); + + return (EIO); + } + /* Check for any cases */ + if ( rm->ring == NULL ) { + RINGMAP_ERROR(Error! Please debug!); return (EIO); } ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#21 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/tests/libpcap/easy_pcap.c#6 (text+ko) ==== @@ -15,31 +15,66 @@ #include "../../current/sys/net/ringmap.h" - int capture_pkts (const char*); void got_packet(u_char *, const struct pcap_pkthdr *, const u_char *); - +void stop_cpusage_measurement(void); +void start_cpusage_measurement(void); +void exitFunc(void); +void sig_ctrlc(int); +void sig_alarm(int); pcap_t *handle; -unsigned int pcnt = 0; +unsigned long pcnt = 0; +long pkt_limit = 0; -#define HOWMANY 20 +/* Time stamps from first and last captured packets */ +struct timeval first_timestamp ; +struct timeval last_timestamp ; int main(int argc, char **argv) { char *iface; - if (argc < 2) { - printf("Usage: %s iface \n", argv[0]); + /* Proof the number of parameters */ + if (argc < 3) { + printf("Usage: %s iface pkt_limit\n", argv[0]); exit(1); } + /* Network interface name */ iface = argv[1]; + /* Packets number */ + pkt_limit = strtol(argv[2], NULL, 10); + if ( (pkt_limit == 0) && (errno == EINVAL)){ + printf("Wrong second parameter\n"); + exit (1); + } + if ( pkt_limit < 0 ) + pkt_limit = -1; + + /* Register Exit function */ + if (atexit(exitFunc)){ + printf("Error: Can't register exit function!\n"); + exit(1); + } + + /* Register signals */ + if (signal(SIGINT, sig_ctrlc) == SIG_ERR){ + printf("Error: Can't register signal\n"); + exit(1); + } + if (signal(SIGALRM, sig_alarm) == SIG_ERR){ + printf("Error: Can't register signal\n"); + exit(1); + } + + /* Let's go to capture */ capture_pkts(iface); - return (0); + /* Call our exitFunc() to end the job */ + exit(0); } int @@ -53,11 +88,8 @@ return (-1); } - pcap_loop(handle, HOWMANY, got_packet, NULL); - - if (handle != NULL) - pcap_close(handle); - + pcap_loop(handle, pkt_limit, got_packet, NULL); + return (0); } @@ -65,8 +97,85 @@ * Callback function. Will called for each captured packet */ void -got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet) +got_packet(u_char *args, const struct pcap_pkthdr *header, + const u_char *packet) { pcnt++; - printf("===> [%s] Packet %d \n", __func__, pcnt); + if ( pcnt == 1 ){ + start_cpusage_measurement(); + first_timestamp = header->ts; + } + last_timestamp = header->ts; + + printf("\n===> [%s] Packet %d\n", __func__, pcnt); +} + +/* + * Signal function for catching Ctrl-C + */ +void +sig_ctrlc(int signo) +{ + if (signo == SIGINT) { + printf("Stop Capturing. Exit!\n"); + exit(0); + } +} + +void +sig_alarm(int signo) +{ + if (signo == SIGALRM){ + printf("Stop capturing. Exit!\n"); + exit(0); + } +} + +/* Exit Point */ +void +exitFunc() +{ + unsigned long pps = 0; + unsigned long cap_time = 0; + + stop_cpusage_measurement(); + + cap_time = + ((last_timestamp.tv_sec*1000000+last_timestamp.tv_usec) - + (first_timestamp.tv_sec*1000000+first_timestamp.tv_usec))/1000000; + if ( !cap_time ) + cap_time = 1; + + pps = pcnt / cap_time; + + /* Print stats */ + printf("\n\nRESULTS:\n \n"); + printf("++++++++++++++++++++++++++++++++++++++++++++++++++ \n"); + printf("\n"); + printf("PROCESS STATISTICS: \n"); + printf("------------------ \n"); + printf("Captured: %lu pkts\n", pcnt); + printf("Capturing time: %lu (seconds)\n", cap_time); + printf("Packets per Second: %lu \n", pps); + printf("------------------\n\n"); + +#ifdef RINGMAP + /* Our function from libpcap */ + printf("RINGMAP STATISTICS: \n"); + printf("------------------ \n"); +#endif + + + /* close pcap */ + if (handle != NULL) + pcap_close(handle); +} + +void stop_cpusage_measurement() +{ + ; +} +void start_cpusage_measurement() +{ + ; } ==== //depot/projects/soc2010/ringmap/tests/libpcap/test_pcap.c#5 (text+ko) ==== From owner-p4-projects@FreeBSD.ORG Thu Jul 1 03:54:31 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 38BDB1065674; Thu, 1 Jul 2010 03:54:31 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFBCB106566B for ; Thu, 1 Jul 2010 03:54:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id DE3358FC16 for ; Thu, 1 Jul 2010 03:54:30 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o613sU7x031436 for ; Thu, 1 Jul 2010 03:54:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o613sUcY031434 for perforce@freebsd.org; Thu, 1 Jul 2010 03:54:30 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 1 Jul 2010 03:54:30 GMT Message-Id: <201007010354.o613sUcY031434@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180364 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 03:54:31 -0000 http://p4web.freebsd.org/@@180364?ac=10 Change 180364 by hselasky@hselasky_laptop001 on 2010/07/01 03:54:10 USB network: - correct a GET macro - if the expected buffer size is greater than 65535 bytes, the CDC driver might not work as expected, which is not likely with the existing USB speeds. - patch by: HPS @ Affected files ... .. //depot/projects/usb/src/sys/dev/usb/net/if_cdce.c#28 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/net/if_cdce.c#28 (text+ko) ==== @@ -312,14 +312,14 @@ /* Read correct set of parameters according to device mode */ if (usbd_get_mode(sc->sc_ue.ue_udev) == USB_MODE_HOST) { - sc->sc_ncm.rx_max = UGETW(temp.dwNtbInMaxSize); - sc->sc_ncm.tx_max = UGETW(temp.dwNtbOutMaxSize); + sc->sc_ncm.rx_max = UGETDW(temp.dwNtbInMaxSize); + sc->sc_ncm.tx_max = UGETDW(temp.dwNtbOutMaxSize); sc->sc_ncm.tx_remainder = UGETW(temp.wNdpOutPayloadRemainder); sc->sc_ncm.tx_modulus = UGETW(temp.wNdpOutDivisor); sc->sc_ncm.tx_struct_align = UGETW(temp.wNdpOutAlignment); } else { - sc->sc_ncm.rx_max = UGETW(temp.dwNtbOutMaxSize); - sc->sc_ncm.tx_max = UGETW(temp.dwNtbInMaxSize); + sc->sc_ncm.rx_max = UGETDW(temp.dwNtbOutMaxSize); + sc->sc_ncm.tx_max = UGETDW(temp.dwNtbInMaxSize); sc->sc_ncm.tx_remainder = UGETW(temp.wNdpInPayloadRemainder); sc->sc_ncm.tx_modulus = UGETW(temp.wNdpInDivisor); sc->sc_ncm.tx_struct_align = UGETW(temp.wNdpInAlignment); From owner-p4-projects@FreeBSD.ORG Thu Jul 1 06:53:47 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8BA941065673; Thu, 1 Jul 2010 06:53:47 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EA151065670 for ; Thu, 1 Jul 2010 06:53:47 +0000 (UTC) (envelope-from bfiedler@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 23EC28FC0A for ; Thu, 1 Jul 2010 06:53:47 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o616rlB0060015 for ; Thu, 1 Jul 2010 06:53:47 GMT (envelope-from bfiedler@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o616rlNR060013 for perforce@freebsd.org; Thu, 1 Jul 2010 06:53:47 GMT (envelope-from bfiedler@FreeBSD.org) Date: Thu, 1 Jul 2010 06:53:47 GMT Message-Id: <201007010653.o616rlNR060013@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bfiedler@FreeBSD.org using -f From: Benjamin Fiedler To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180366 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 06:53:47 -0000 http://p4web.freebsd.org/@@180366?ac=10 Change 180366 by bfiedler@freebsd-home on 2010/07/01 06:53:32 Add prototype strrep() func; squelch errors on sdiff build Affected files ... .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#7 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#8 edit .. //depot/projects/soc2010/bsdtextproc/sdiff/common.c#2 edit Differences ... ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.h#7 (text+ko) ==== @@ -95,6 +95,7 @@ extern regex_t ignore_re; char *splice(char *, char *); +char *strrep(char*, char*, char*); int diffreg(char *, char *, int); int easprintf(char **, const char *, ...); void *emalloc(size_t); ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#8 (text+ko) ==== @@ -1570,3 +1570,67 @@ } + +/* + * Replaces all occurences of substring 'old' with substring 'new', + * realloc()'ing base ptr as necessary + */ +char * +strrep(char *base, char *old, char *new) +{ + char *ptr, *tmp, *end; + int occ, len1, len2, newlen; + + occ = 0; + ptr = base; + + len1 = strlen(old); + len2 = strlen(new); + + if( len1 == 0 ) + { + return base; + } + + while( (ptr = strstr(ptr, old)) ) + { + occ++; + ptr+=len1; + } + + if( occ == 0){ + return base; + } + + + newlen = strlen(base) + occ * (len2 - len1); + end = base + newlen -1; + if( len2 > len1) + { + base = realloc(base, sizeof(char) * newlen ); + } + + tmp = malloc( sizeof(char) * strlen(base)); + + if( len2 > 0 ) + { + len2 = 1; + } + for (ptr = base; (ptr = strstr(base, old)) != NULL; ) + { + strncpy(tmp, ptr+len1, strlen(base) ); + strncpy(ptr, new, len2); + strncpy(ptr+len2, tmp, end - ptr ); + ptr+=len2; + } + + if(len2 < len1) + { + *(end + occ*(len2 - len1) ) = '\0'; + } + + free(tmp); + + return base; +} + ==== //depot/projects/soc2010/bsdtextproc/sdiff/common.c#2 (text+ko) ==== @@ -11,7 +11,7 @@ #include "common.h" -void +__dead void cleanup(const char *filename) { if (unlink(filename)) From owner-p4-projects@FreeBSD.ORG Thu Jul 1 07:23:20 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3022F1065672; Thu, 1 Jul 2010 07:23:20 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E835B106564A for ; Thu, 1 Jul 2010 07:23:19 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BDC608FC12 for ; Thu, 1 Jul 2010 07:23:19 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o617NJgc063388 for ; Thu, 1 Jul 2010 07:23:19 GMT (envelope-from andre@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o617NJtu063386 for perforce@freebsd.org; Thu, 1 Jul 2010 07:23:19 GMT (envelope-from andre@freebsd.org) Date: Thu, 1 Jul 2010 07:23:19 GMT Message-Id: <201007010723.o617NJtu063386@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andre@freebsd.org using -f From: Andre Oppermann To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180367 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 07:23:20 -0000 http://p4web.freebsd.org/@@180367?ac=10 Change 180367 by andre@andre_t61 on 2010/07/01 07:22:20 Add more comments. Affected files ... .. //depot/projects/tcp_new/netinet/tcp_sack.c#14 edit Differences ... ==== //depot/projects/tcp_new/netinet/tcp_sack.c#14 (text+ko) ==== @@ -67,14 +67,34 @@ #endif /* TCPDEBUG */ /* - * Implementation of Selective Acknowledgements (SACK) as described in - * RFC2018. + * Implementation of the data sender part of Selective Acknowledgements + * (SACK) as described in RFC2018 including detection of duplicate SACK + * (D-SACK) as described in RFC2883. * - * This file implements the data sender part of SACK. It stores all - * received SACK blocks in a scoreboard built on a ranged red-black tree. - * * The data receiver part (RFC2018: section 4) is part of the reassembly * queue. + * + * With SACK a receiver can signal the sender about the segments received + * beyond a lost one waiting in the reassembly queue. Based on this + * information the sender can make an informed decision about which parts + * of the send buffer to retransmit. Network resources are saved because + * only the missing parts are retransmitted. + * + * Implementation details and choices: + * + * The data sender part of SACK stores all received SACK blocks in a + * scoreboard. With large windows and large delay*bandwidth products and + * losses in the network the scoreboard can get quite large. To prevent + * long linked list chain traversals and complexity attacks a ranged + * red-black tree has been chosen. The overhead for small scoreboards + * is about the same as in a linked list but for larger ones it goes down + * to n log(n). All overlapping or contigous SACK blocks are automatically + * merged into one block at insert time. The red-black tree is layed out + * in a way to preserve the ordering of the SACK blocks upon lookup operations. + * + * To prevent resource exhaustion attacks a local and a global limit governs + * the SACK scoreboard. The local limits prevents single connections from + * (possibly maliciously) monopolizing the global limit. */ SYSCTL_NODE(_net_inet_tcp, OID_AUTO, sack, CTLFLAG_RW, 0, "TCP SACK"); From owner-p4-projects@FreeBSD.ORG Thu Jul 1 07:24:21 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 12027106567D; Thu, 1 Jul 2010 07:24:21 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9F74106564A for ; Thu, 1 Jul 2010 07:24:20 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B7DD78FC1A for ; Thu, 1 Jul 2010 07:24:20 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o617OKKm063450 for ; Thu, 1 Jul 2010 07:24:20 GMT (envelope-from andre@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o617OKa3063448 for perforce@freebsd.org; Thu, 1 Jul 2010 07:24:20 GMT (envelope-from andre@freebsd.org) Date: Thu, 1 Jul 2010 07:24:20 GMT Message-Id: <201007010724.o617OKa3063448@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andre@freebsd.org using -f From: Andre Oppermann To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180368 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 07:24:21 -0000 http://p4web.freebsd.org/@@180368?ac=10 Change 180368 by andre@andre_t61 on 2010/07/01 07:24:10 Adjust for new reassembly queue. Affected files ... .. //depot/projects/tcp_new/netinet/tcp_input.c#17 edit .. //depot/projects/tcp_new/netinet/tcp_reass.c#4 edit .. //depot/projects/tcp_new/netinet/tcp_var.h#16 edit Differences ... ==== //depot/projects/tcp_new/netinet/tcp_input.c#17 (text+ko) ==== @@ -1783,6 +1783,8 @@ */ if (tp->t_phase < TP_LOSSRECOV) { //tcp_cc_ack(tp, th, tiwin, acked, tlen, sacked); + } else { + tcp_do_lossrecovery(tp); } KASSERT(tp->snd_cwnd > tp->snd_mss, @@ -1925,7 +1927,7 @@ * If the segment doesn't carry any data, urgent data * or FIN we are done. */ - if (tlen == 0 && (th->th_flags & TH_FIN) == 0 && + if (tlen == 0 && (thflags & TH_FIN) == 0 && !TCPS_HAVERCVDFIN(tp->t_state)) { INP_INFO_WUNLOCK(&tcbinfo); m_freem(m); @@ -1961,13 +1963,16 @@ * segment with urgent that got pulled and now is zero */ if (!TCPS_HAVERCVDFIN(tp->t_state) && - (tlen > 0 || (!TAILQ_EMPTY(&tp->rcv_trq) && (th->th_flags & TH_FIN)))) { + (tlen > 0 || (!TAILQ_EMPTY(&tp->rcv_trq) && (thflags & TH_FIN)))) { int newsize = 0; /* Rcvbuf autoscaling. */ + th_seq = th->th_seq; + th = NULL; /* Safety */ /* * Delayed header drop of IPv[46] and TCP headers. */ m_adj(m, drop_hdrlen); +#if 0 if (m->m_next != NULL) { /* * XXXAO: m_adj doesn't drop mbufs from the front, @@ -1986,6 +1991,7 @@ ("%s: drop_hdrlen too big or mbuf chain broken", __func__)); } +#endif KASSERT(tlen == m_length(m, NULL), ("%s: tlen != mbuf chain length", __func__)); @@ -1996,23 +2002,18 @@ * will go there as well. Whenever a segment or a row of * segments can be reassembled and the left edge exactly * matches, it is returned together for further processing. - * The FIN flag is stored in the mbuf header as M_PROTO1. * Send a forced ACK for every segment we receive when * we are doing reassembly to immediately inform the sender * of missing segments and to trigger fast retransmits. * RFC793: section 3.9, page 70 * RFC1122: section 4.2.2.21 */ - if (th->th_seq != tp->rcv_nxt || !TAILQ_EMPTY(&tp->rcv_trq)) { - //m = tcp_reass(tp, m, tlen, thflags); - m = NULL; + if (th->th_seq != tp->rcv_nxt || !RB_EMPTY(&tp->rcv_trq)) { + m = tcp_reass(tp, m, &tlen, th_seq, &thflags); + tp->t_flags |= TF_ACKNOW; - if (m != NULL && (m->m_flags & M_PROTO1)) - thflags |= TH_FIN; - else if (m == NULL) - thflags &= ~TH_FIN; - - tp->t_flags |= TF_ACKNOW; + KASSERT(m == NULL || tlen == m_length(m, NULL), + ("%s: tlen != mbuf chain length", __func__)); } /* @@ -3031,6 +3032,15 @@ } /* + * Perform loss recovery. + */ +void +tcp_do_lossrecovery(struct tcpcb *tp) +{ + +} + +/* * Process urgent data in TCP segments. * * XXXAO: ==== //depot/projects/tcp_new/netinet/tcp_reass.c#4 (text+ko) ==== @@ -101,7 +101,6 @@ * TODO: * - D-SACK when only one SACK slot available? * - Direct pointer to highest seqnum block in RB-tree? - * - Remove T/TCP gonk. * - Lots of testing. */ @@ -319,11 +318,10 @@ * NB: We must always consume the mbuf. Either by appeding it to * the queue or by freeing it. */ -int -tcp_reass(struct tcpcb *tp, struct tcphdr *th, struct mbuf *m, int len, int hlen) +struct *mbuf +tcp_reass(struct tcpcb *tp, struct mbuf *m, int *tlen, tcp_seq th_seq, int *thflags) { - int thflags = 0; - tcp_seq th_seq; + int len = *tlen; struct socket *so = tp->t_inpcb->inp_socket; struct tcp_reass_block *trb = NULL, *trbn; struct tcp_reass_block trbs; @@ -336,37 +334,10 @@ if (!tcp_reass_enable && RB_EMPTY(&tp->rcv_reass)) goto done; - /* - * Call with th==NULL after becoming established to - * force pre-ESTABLISHED data up to user socket. - * XXX: Was used for T/TCP of which code remains. - */ - if (th == NULL) { - if (!TCPS_HAVEESTABLISHED(tp->t_state) || - RB_EMPTY(&tp->rcv_reass) || - ((trb = RB_MIN(tcp_ra, &tp->rcv_reass)) && - trb->trb_seqs != tp->rcv_nxt)) - return (0); - trb = RB_MIN(tcp_ra, &tp->rcv_reass); - goto present; - } - KASSERT(th != NULL, ("%s: th is NULL", __func__)); KASSERT(m != NULL, ("%s: m is NULL", __func__)); - KASSERT(len + hlen == m_length(m, NULL), - ("%s: len + hlen != mbuf length", __func__)); - KASSERT(hlen <= m_length(m, NULL), - ("%s: hlen > mbuf length", __func__)); - - /* - * Store TCP header information in local variables as - * we may lose access to it after header dropping and - * mbuf compacting. - */ - thflags = th->th_flags; - th_seq = th->th_seq; - th = NULL; /* Prevent further use. */ - + KASSERT(len == m_length(m, NULL), + ("%s: len != mbuf length", __func__)); KASSERT(SEQ_GEQ(th_seq, tp->rcv_nxt), ("%s: sequence number below rcv_nxt", __func__)); KASSERT(!(tp->rcv_nxt == th_seq) || !(RB_EMPTY(&tp->rcv_reass)), @@ -416,16 +387,16 @@ * if it was genuine. * This approach is based on a discussion on TCPM mailing list. */ - if ((thflags & TH_FIN) && tp->rcv_nxt == th_seq) { + if ((*thflags & TH_FIN) && tp->rcv_nxt == th_seq) { tcp_reass_flush(tp); if (m->m_len == 0) { tcp_timer_activate(tp, TT_REASS, 0); - return (thflags); + goto done; } } else if (len == 0) goto done; else - thflags &= ~TH_FIN; + *thflags &= ~TH_FIN; /* Statistics. */ if (tp->rcv_nxt != th_seq) { @@ -433,13 +404,7 @@ TCPSTAT_ADD(tcps_rcvoobyte, len); } - /* - * Remove and free packet header and mtags. - * Trim empty mbufs from head of chain. - * Compact the mbuf chain. - */ - m_demote(m, 1); - m_adj(m, hlen); + /* Compact the mbuf chain. */ m = m_trimhead(m); if (tcp_reass_spacetime && m->m_next != NULL) m = m_collapse(m, M_DONTWAIT, 1024); @@ -451,6 +416,7 @@ trbs.trb_seqe = th_seq + len; trbs.trb_m = m; trbs.trb_mt = m_last(m); + m = NULL; /* * Find a block that has at least partial overlap to either side. @@ -553,7 +519,7 @@ if (trb->trb_seqs == tp->rcv_nxt) goto present; - return (0); + return (m); present: /* @@ -567,26 +533,17 @@ TCPSTAT_INC(tcps_reass_missingseg); - SOCKBUF_LOCK(&so->so_rcv); /* - * We can only ever dequeue one consecutive - * block of data at most. + * We can only ever dequeue one consecutive block of data at most. */ - if (!(so->so_rcv.sb_state & SBS_CANTRCVMORE)) { - sbappendstream_locked(&so->so_rcv, trb->trb_m); - tp->rcv_nxt += SEQ_DELTA(trb->trb_seqs, trb->trb_seqe); - trb->trb_m = NULL; - trb->trb_mt = NULL; - } + m = trb->trb_m; + *tlen = SEQ_DELTA(trb->trb_seqs, trb->trb_seqe); + trb->trb_m = NULL; + trb->trb_mt = NULL; - if (trb == &trbs) - m_freem(trb->trb_m); /* NB: trb_m can be =! NULL */ - else + if (trb != &trbs) tcp_reass_free(tp, trb); - /* NB: sorwakeup_locked() does an implicit socket buffer unlock. */ - sorwakeup_locked(so); - /* * Don't hold on to data in the reassembly queue for too long. * Kernel memory is limited and if the connection doesn't make @@ -604,11 +561,11 @@ tcp_timer_activate(tp, TT_REASS, 0); ND6_HINT(tp); - return (thflags); + return (m); done: m_freem(m); - return (0); + return (m); } /* ==== //depot/projects/tcp_new/netinet/tcp_var.h#16 (text+ko) ==== @@ -71,28 +71,14 @@ #endif /* TCP reassembly queue segment entry. */ -/* XXXAO: new one */ -struct trq { - TAILQ_ENTRY(trq) trq_q; - tcp_seq trq_seq; /* start of segment */ - int trq_len; /* length of segment */ - int trq_segs; /* number of mbufs */ - int trq_flags; /* flags for segment chain */ -#define TRQ_FIN 0x01 /* FIN was on last segment */ - struct mbuf *trq_m; /* mbuf chain of data */ - struct mbuf *trq_ml; /* last mbuf in chain of data */ +struct tcp_reass_block { + RB_ENTRY(tcp_reass_block) trb_rb; + LIST_ENTRY(tcp_reass_block) trb_sack; /* linked list in SACK order */ + tcp_seq trb_seqs; /* start of block */ + tcp_seq trb_seqe; /* end of block */ + struct mbuf *trb_m; /* mbuf chain of data */ + struct mbuf *trb_mt; /* last mbuf in chain of data */ }; -TAILQ_HEAD(trq_head, trq); - -/* XXXAO: old one */ -struct tseg_qent { - LIST_ENTRY(tseg_qent) tqe_q; - int tqe_len; /* TCP segment data length */ - struct tcphdr *tqe_th; /* a pointer to tcp header */ - struct mbuf *tqe_m; /* mbuf contains packet */ -}; -LIST_HEAD(tsegqe_head, tseg_qent); - extern int tcp_reass_qsize; extern struct uma_zone *tcp_reass_zone; @@ -100,17 +86,11 @@ tcp_seq start; /* left */ tcp_seq end; /* right */ }; - struct tcp_sack_block { RB_ENTRY(tcp_sack_block) tsb_rb; /* scoreboard linkage */ struct sackblk tsb_blk; }; -struct sackhint { - struct sackhole *nexthole; - int sack_bytes_rexmit; -}; - struct tcptemp { u_char tt_ipgen[40]; /* the size must be of max ip header, now IPv6 */ struct tcphdr tt_t; @@ -223,9 +203,12 @@ u_long tsval_recent; /* highest ts reflected back to us */ u_long tsval_age; /* when reflected last updated */ - /* old reass */ - struct tsegqe_head t_segq; /* segment reassembly queue */ - int t_segqlen; /* segment reassembly queue length */ + /* reassembly */ + RB_HEAD(tcp_ra, tcp_reass_block) rcv_reass; /* segment reassembly queue */ + int rcv_reass_size; /* segment reassembly memory usage */ + int rcv_reass_blocks; /* blocks in reassembly queue */ + LIST_HEAD(tcp_ras, tcp_reass_block) rcv_reass_sack; /* last additions to reass queue */ + struct sackblk rcv_reass_dsack; /* DSACK block */ /* automatic socket buffer scaling */ tcp_ts rfbuf_ts; /* recv buffer autoscaling timestamp */ @@ -596,9 +579,11 @@ void tcp_fini(void *); char *tcp_log_addrs(struct in_conninfo *, struct tcphdr *, void *, const void *); -int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); +struct mbuf + *tcp_reass(struct tcpcb *, struct mbuf *, int*, tcp_seq, int*); void tcp_reass_init(void); -void tcp_reass_qfree(struct tcpcb *); +int tcp_reass_sack(struct tcpcb *, u_char *, int); +void tcp_reass_flush(struct tcpcb *); void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, int *); u_long tcp_maxmtu6(struct in_conninfo *, int *); From owner-p4-projects@FreeBSD.ORG Thu Jul 1 09:37:48 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5A809106566B; Thu, 1 Jul 2010 09:37:48 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F4CF106567E for ; Thu, 1 Jul 2010 09:37:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 0CED88FC13 for ; Thu, 1 Jul 2010 09:37:48 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o619blZc086136 for ; Thu, 1 Jul 2010 09:37:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o619bl9M086134 for perforce@freebsd.org; Thu, 1 Jul 2010 09:37:47 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 1 Jul 2010 09:37:47 GMT Message-Id: <201007010937.o619bl9M086134@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180379 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 09:37:48 -0000 http://p4web.freebsd.org/@@180379?ac=10 Change 180379 by hselasky@hselasky_laptop001 on 2010/07/01 09:36:52 USB CORE: - Fix compile issue when building on RTEMS OS. - Patch from: Sebastian Huber (Embedded brains GmbH) - Verified by: HPS Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usb_device.c#69 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usb_device.c#69 (text+ko) ==== @@ -45,12 +45,16 @@ #include #include #include -#include #include #include #include #include + +#if USB_HAVE_UGEN +#include +#endif + #include "usbdevs.h" #define USB_DEBUG_VAR usb_debug From owner-p4-projects@FreeBSD.ORG Thu Jul 1 10:37:54 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 217741065673; Thu, 1 Jul 2010 10:37:54 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1CA6106566C for ; Thu, 1 Jul 2010 10:37:53 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id AED0C8FC1C for ; Thu, 1 Jul 2010 10:37:53 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o61AbrFS091571 for ; Thu, 1 Jul 2010 10:37:53 GMT (envelope-from andre@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o61AbrpT091569 for perforce@freebsd.org; Thu, 1 Jul 2010 10:37:53 GMT (envelope-from andre@freebsd.org) Date: Thu, 1 Jul 2010 10:37:53 GMT Message-Id: <201007011037.o61AbrpT091569@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andre@freebsd.org using -f From: Andre Oppermann To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180382 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 10:37:54 -0000 http://p4web.freebsd.org/@@180382?ac=10 Change 180382 by andre@andre_t61 on 2010/07/01 10:37:40 Split tcp_retransmit into two functions. One for normal NewReno based FastRecovery and one for SACK based loss recovery. They are too different to have them in just one common function. Limited transmit is kept common as it happens before retransmits are started. Affected files ... .. //depot/projects/tcp_new/netinet/tcp_output.c#18 edit Differences ... ==== //depot/projects/tcp_new/netinet/tcp_output.c#18 (text+ko) ==== @@ -200,6 +200,8 @@ * <- duna -><- swnd -> * <- cwnd -> * <-dlen-> + * <-slen-> + * <-len -> * seq .......|+++++++++xxxxxxxx---z---------|....... * ^ ^ * snd_una snd_nxt @@ -249,17 +251,26 @@ break; case TP_SENDING: /* - * Limited transmit: transmit new data upon the arrival of the - * first two consecutive duplicate ACKs. - * RFC3042: section 2 + * Only straight transmitting is handled here. + * Everything else goes through the retransmit code which + * also controls sending of new segments during loss cases. + * + * Limited transmit. Clamp the amount of data sent */ - if (tp->snd_dupack > 0 && dlen > len && cwnd < tp->snd_mss) - len = min(slen, tp->snd_mss); /* up to one mss above cwnd */ + if (tp->snd_dupack > 0 && tp->snd_dupack < 3) { + len = min(tp->snd_mss, min(slen, len + 2 * tp->snd_mss)); + tp->t_flags |= TF_ACKNOW; + } break; case TP_LOSSRECOV: case TP_REXMT: optlen = tcp_options(tp, so, &to, &opt[0], flags); - error = tcp_retransmit(tp, so, &to, &opt[0], &len, optlen, rwin, dlen, slen, flags); + if (tp->t_flags & TF_SACKOK) + error = tcp_retransmit_sack(tp, so, &to, &opt[0], optlen, &len, rwin, duna, dlen, slen, len, flags); + else + error = tcp_retransmit(tp, so, &to, &opt[0], optlen, &len, rwin, dlen, slen, flags); + if (error) + return (error); break; case TP_PERSIST: /* @@ -267,11 +278,14 @@ * Send out probe byte if there is data available. * RFC793: section 3.7, page 42-44 * RFC1122: section 4.2.2.17 + * + * XXXAO: Make sure to send ACKs and our window updates anyways. */ if (swnd == 0 && dlen > 0 && (tp->t_flags & TF_FORCEDATA)) { len = 1; goto send; - } + } else + len = 0; if (swnd == 0 && duna > tp->snd_wnd) { /* * Window shrank after we sent into it. @@ -768,31 +782,134 @@ /* * Do a retransmit from snd_nxt or a later point. This is separate * from the normal transmit case as the logic is quite a bit different. + * + * Normal NewReno FastRecovery with Limited Transmit. + * 1. Fast recovery: After we get three duplicate ACKs RFC5681 + * 2. NewReno RFC3782 + * 3. Limited transmit RFC3042 + * + * The fast recovery algorithms start their work by the third + * duplicate ACK. */ static int tcp_retransmit(struct tcpcb *tp, struct socket *so, struct tcpopt *to, - u_char *opt, int *len, int optlen, int rwin, int dlen, int slen, int flags) + u_char *opt, int optlen, int *lenp, int duna, int dlen, int slen, int len, int flags) +{ + int error = 0, off, rlen = 0, rxmit; + struct tcphdr ths, *th = &ths; + + /* + * duna = flight size + * dlen = available unsent data in send buffer + * len = data available to be sent (within cwnd and wnd) + * + * 1a) ssthresh = max (FlightSize / 2, 2*SMSS) [input] + * recover = snd_nxt [input] + * + * 2) retransmit snd_una+mss [output] + * cwnd = ssthresh + 3*mss [input] + * + * 3) on dupack > 3: cwnd =+ mss [input] + * + * 4) transmit new segment if cwnd allows [output] + */ + + /* Retransmit one mss or the unacknowledged amount of data. */ + rlen = min(tp->snd_mss, duna); + + /* Transmit one more new data. */ + if (len > 0 && (len >= tp->snd_mss || dlen == len)) + *lenp = len; + else + *lenp = 0; + + /* Fill in headers. */ + th->th_win = (u_short)rwin; + th->th_seq = tp->snd_nxt; + th->th_flags = flags; + th->th_ack = tp->rcv_nxt; + + /* If resending a SYN or FIN, be sure NOT to use a new sequence number. */ + if ((flags & TH_SYN) && (tp->t_flags & TF_SENTSYN)) + th->th_seq--; + if ((flags & TH_FIN) && (tp->t_flags & TF_SENTFIN) && + th->th_seq == tp->snd_nxt) + th->th_seq--; + + SOCKBUF_LOCK(&so->so_snd); + off = 0; + error = tcp_send_segments(tp, &ths, opt, off, &rlen, optlen); + SOCKBUF_UNLOCK(&so->so_snd); + + if (rlen > 0) { + } + + if (error == 0) { + } + + if (rlen > 0 || error == 0) { + /* Update last send timestamp. */ + if ((tp->t_flags & TF_TIMESTAMP) && tp->snd_tslast != to->to_tsval) + tp->snd_tslast = to->to_tsval; + + /* Last ACK we sent. */ + if (tp->snd_lastack != th->th_ack) + tp->snd_lastack = th->th_ack; + } + + if (rlen > 0 && error == 0) { + } + + switch (error) { + case EPERM: + case EACCES: + break; + case ENOBUFS: + case ENOMEM: + break; + case EMSGSIZE: + break; + case ENETDOWN: + case ENETUNREACH: + case EHOSTDOWN: + case EHOSTUNREACH: + break; + case 0: /* No error. */ + break; + default: + KASSERT(0 == 1, + ("%s: unkown error %i", __func__, error)); + } + + return (error); +} + +/* + * Do a retransmit from snd_nxt or a later point when SACK is enabled. + * This is separate from the normal transmit case as the logic is quite + * a bit different. + * + * We have the following mechanisms: + * 1. SACK tells us where to send how much data RFC3517 + * 2. TCP congestion window validation RFC2861 + * 3. Update to RFC3517 draft-ietf-tcpm-sack-recovery-entry-01.txt + */ +static int +tcp_retransmit_sack(struct tcpcb *tp, struct socket *so, struct tcpopt *to, + u_char *opt, int optlen, int *lenp, int rwin, int dlen, int slen, int flags) { int error = 0, off, rlen = 0, rxmit; struct tcphdr ths, *th = &ths; /* + * SACK based retransmission RFC3517 * Retransmit over the SACK holes. * Do not retransmit too many times. * Limit the amount of data that is inflight. * Retransmit only the stuff that was not SACK'ed. - * - * The fast recovery algorithms start their work by the third - * duplicate ACK. - * - * We have the following mechanisms: - * 1. Fast recovery: After we get three duplicate ACKs RFC2581 - * 2. NewReno RFC3782 - * 3. Limited transmit RFC3042 - * 4. SACK tells us where to send how much data RFC3517 - * 5. TCP congestion window validation RFC2861 + * With SACK we may be able to retransmit more than one segment + * from different blocks. */ - do { /* Calculate amount of data we may inject into the pipe (C). */ rxmit = imax(0, tp->snd_cwnd - tp->snd_pipe); @@ -814,9 +931,9 @@ if (rlen == 0) { if (slen > 0 && (rxmit >= tp->snd_mss || (rxmit >= slen && dlen == slen))) - *len = min(slen, rxmit); + *lenp = min(slen, rxmit); else - *len = 0; + *lenp = 0; break; } /* @@ -832,17 +949,13 @@ else break; - /* - * Fill in headers. - */ + /* Fill in headers. */ th->th_win = (u_short)rwin; th->th_seq = tp->snd_rxmit; th->th_flags = flags; th->th_ack = tp->rcv_nxt; - /* - * If resending a SYN or FIN, be sure NOT to use a new sequence number. - */ + /* If resending a SYN or FIN, be sure NOT to use a new sequence number. */ if ((flags & TH_SYN) && (tp->t_flags & TF_SENTSYN)) th->th_seq--; if ((flags & TH_FIN) && (tp->t_flags & TF_SENTFIN) && @@ -868,15 +981,11 @@ } if (rlen > 0 || error == 0) { - /* - * Update last send timestamp. - */ + /* Update last send timestamp. */ if ((tp->t_flags & TF_TIMESTAMP) && tp->snd_tslast != to->to_tsval) tp->snd_tslast = to->to_tsval; - /* - * Last ACK we sent. - */ + /* Last ACK we sent. */ if (tp->snd_lastack != th->th_ack) tp->snd_lastack = th->th_ack; } @@ -898,12 +1007,8 @@ case EHOSTDOWN: case EHOSTUNREACH: break; - case 0: - /* - * No error. - */ + case 0: /* No error. */ break; - default: KASSERT(0 == 1, ("%s: unkown error %i", __func__, error)); From owner-p4-projects@FreeBSD.ORG Thu Jul 1 14:59:40 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B0CBD1065670; Thu, 1 Jul 2010 14:59:40 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 683AC106567A for ; Thu, 1 Jul 2010 14:59:40 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 3C9798FC13 for ; Thu, 1 Jul 2010 14:59:40 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o61ExePm025736 for ; Thu, 1 Jul 2010 14:59:40 GMT (envelope-from andre@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o61Exev6025734 for perforce@freebsd.org; Thu, 1 Jul 2010 14:59:40 GMT (envelope-from andre@freebsd.org) Date: Thu, 1 Jul 2010 14:59:40 GMT Message-Id: <201007011459.o61Exev6025734@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andre@freebsd.org using -f From: Andre Oppermann To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180387 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 14:59:41 -0000 http://p4web.freebsd.org/@@180387?ac=10 Change 180387 by andre@andre_t61 on 2010/07/01 14:59:16 Add tcp_do_recovery() to handle the loss recovery period. Affected files ... .. //depot/projects/tcp_new/netinet/tcp_input.c#18 edit Differences ... ==== //depot/projects/tcp_new/netinet/tcp_input.c#18 (text+ko) ==== @@ -1784,7 +1784,7 @@ if (tp->t_phase < TP_LOSSRECOV) { //tcp_cc_ack(tp, th, tiwin, acked, tlen, sacked); } else { - tcp_do_lossrecovery(tp); + tcp_do_lossrecovery(tp, th, tiwin, acked, tlen, sacked); } KASSERT(tp->snd_cwnd > tp->snd_mss, @@ -3035,9 +3035,51 @@ * Perform loss recovery. */ void -tcp_do_lossrecovery(struct tcpcb *tp) +tcp_do_lossrecovery(struct tcpcb *tp, struct tcphdr *th, tcp_win tiwin, + tcp_seq acked, int tlen, int sacked) { - + /* + * NewReno FastRecovery: + * + * 1a) ssthresh = max (FlightSize / 2, 2*SMSS) [input] + * recover = snd_nxt [input] + * + * 2) retransmit snd_una+mss [output] + * cwnd = ssthresh + 3*mss [input] + * + * 3) on dupack > 3: cwnd =+ mss [input] + * + * 4) transmit new segment if cwnd allows [output] + * + * 5a) full ack + * cwnd = min(ssthresh, FlightSize + SMSS) [input] + * exit fastrecovery and reset dupack [input] + * + * 5b) partial ack + * deflate/inflate cwnd [input] + * retransmit new snd_una+mss [output] + * transmit new segment if cwnd allows [output] + * + * 5c) dupack again + * transmit new segment if cwnd allows [output] + */ + + if (tp->snd_dupack == 3) { + tp->snd_recover = tp->snd_nxt; + tp->snd_cwnd = tp->snd_ssthresh + 3 * tp->snd_mss; + if (tp->t_phase < TP_LOSSRECOV) + tp->t_phase = TP_LOSSRECOV; + } else if (tp->snd_dupack > 3) { + tp->snd_cwnd =+ tp->snd_mss; + } + + if (SEQ_GEQ(th->th_ack, tp->snd_recover)) { + tp->snd_cwnd = min(tp->snd_ssthresh, SEQ_DELTA(tp->snd_una, tp->snd_nxt) + tp->snd_mss); + tp->t_phase = TP_SENDING; + } else if (acked > 0) { + if (acked <= tp->snd_mss) + tp->snd_cwnd =- acked; + } } /* From owner-p4-projects@FreeBSD.ORG Thu Jul 1 15:00:42 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DB7D71065672; Thu, 1 Jul 2010 15:00:41 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FF68106564A for ; Thu, 1 Jul 2010 15:00:41 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 743A28FC14 for ; Thu, 1 Jul 2010 15:00:41 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o61F0fsi025866 for ; Thu, 1 Jul 2010 15:00:41 GMT (envelope-from andre@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o61F0fAA025864 for perforce@freebsd.org; Thu, 1 Jul 2010 15:00:41 GMT (envelope-from andre@freebsd.org) Date: Thu, 1 Jul 2010 15:00:41 GMT Message-Id: <201007011500.o61F0fAA025864@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andre@freebsd.org using -f From: Andre Oppermann To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180388 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2010 15:00:42 -0000 http://p4web.freebsd.org/@@180388?ac=10 Change 180388 by andre@andre_t61 on 2010/07/01 15:00:30 More comments and improvements to tcp_retransmit(). Affected files ... .. //depot/projects/tcp_new/netinet/tcp_output.c#19 edit Differences ... ==== //depot/projects/tcp_new/netinet/tcp_output.c#19 (text+ko) ==== @@ -264,8 +264,17 @@ break; case TP_LOSSRECOV: case TP_REXMT: + /* + * Retransmit is going to send segments so we need + * the options early. + */ optlen = tcp_options(tp, so, &to, &opt[0], flags); - if (tp->t_flags & TF_SACKOK) + /* + * Retransmit should only be entered when tcp_output() + * was called from tcp_input() or from the RTO timer, + * not when the application did a write. + */ + if (tp->t_flags & TF_SACKPERMIT) error = tcp_retransmit_sack(tp, so, &to, &opt[0], optlen, &len, rwin, duna, dlen, slen, len, flags); else error = tcp_retransmit(tp, so, &to, &opt[0], optlen, &len, rwin, dlen, slen, flags); @@ -812,20 +821,36 @@ * 3) on dupack > 3: cwnd =+ mss [input] * * 4) transmit new segment if cwnd allows [output] + * + * 5a) full ack + * cwnd = min(ssthresh, FlightSize + SMSS) [input] + * exit fastrecovery and reset dupack [input] + * + * 5b) partial ack + * deflate/inflate cwnd [input] + * retransmit new snd_una+mss [output] + * transmit new segment if cwnd allows [output] + * + * 5c) dupack again + * transmit new segment if cwnd allows [output] */ - /* Retransmit one mss or the unacknowledged amount of data. */ - rlen = min(tp->snd_mss, duna); - - /* Transmit one more new data. */ + /* Transmit one more new data if available. */ if (len > 0 && (len >= tp->snd_mss || dlen == len)) *lenp = len; else *lenp = 0; + /* Do not retransmit if ack didn't move. */ + if (tp->snd_dupack != 3 || tp->snd_dupack != 0) + return (0); + + /* Retransmit one mss or the unacknowledged amount of data. */ + rlen = min(tp->snd_mss, duna); + /* Fill in headers. */ th->th_win = (u_short)rwin; - th->th_seq = tp->snd_nxt; + th->th_seq = tp->snd_una; th->th_flags = flags; th->th_ack = tp->rcv_nxt; From owner-p4-projects@FreeBSD.ORG Fri Jul 2 00:21:56 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3F1C61065676; Fri, 2 Jul 2010 00:21:56 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 022FB1065670 for ; Fri, 2 Jul 2010 00:21:56 +0000 (UTC) (envelope-from bfiedler@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id CAE8B8FC2D for ; Fri, 2 Jul 2010 00:21:55 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o620LthU000672 for ; Fri, 2 Jul 2010 00:21:55 GMT (envelope-from bfiedler@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o620LtdW000670 for perforce@freebsd.org; Fri, 2 Jul 2010 00:21:55 GMT (envelope-from bfiedler@FreeBSD.org) Date: Fri, 2 Jul 2010 00:21:55 GMT Message-Id: <201007020021.o620LtdW000670@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bfiedler@FreeBSD.org using -f From: Benjamin Fiedler To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180399 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2010 00:21:56 -0000 http://p4web.freebsd.org/@@180399?ac=10 Change 180399 by bfiedler@freebsd-7803 on 2010/07/02 00:21:46 Fix bugs in strrep() Affected files ... .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#8 edit .. //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#9 edit Differences ... ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diff.c#8 (text+ko) ==== ==== //depot/projects/soc2010/bsdtextproc/gabor_diff/diffreg.c#9 (text+ko) ==== @@ -1573,12 +1573,12 @@ /* * Replaces all occurences of substring 'old' with substring 'new', - * realloc()'ing base ptr as necessary + * realloc()'ing base ptr if more characters necessary */ char * strrep(char *base, char *old, char *new) { - char *ptr, *tmp, *end; + char *ptr, *tmp; int occ, len1, len2, newlen; occ = 0; @@ -1592,45 +1592,36 @@ return base; } - while( (ptr = strstr(ptr, old)) ) + for(; (ptr = strstr(ptr, old)); occ++ ) { - occ++; ptr+=len1; } - if( occ == 0){ + if( occ == 0) + { return base; } + newlen = strlen(base) + occ * (len2 - len1); - newlen = strlen(base) + occ * (len2 - len1); - end = base + newlen -1; if( len2 > len1) { - base = realloc(base, sizeof(char) * newlen ); + base = erealloc(base, sizeof(char) * newlen +1); } - tmp = malloc( sizeof(char) * strlen(base)); + tmp = emalloc( sizeof(char) * strlen(base) +1); - if( len2 > 0 ) - { - len2 = 1; - } - for (ptr = base; (ptr = strstr(base, old)) != NULL; ) + for (ptr = base; (ptr = strstr(ptr, old)) != NULL; ) { - strncpy(tmp, ptr+len1, strlen(base) ); + strncpy(tmp, ptr+len1, strlen(base)+1 ); strncpy(ptr, new, len2); - strncpy(ptr+len2, tmp, end - ptr ); - ptr+=len2; + strncpy(ptr+len2, tmp, strlen(tmp)+1); + ptr+= len2 > 0 ? len2 : 1; } - if(len2 < len1) - { - *(end + occ*(len2 - len1) ) = '\0'; - } + *(base + newlen) = '\0'; free(tmp); - return base; } From owner-p4-projects@FreeBSD.ORG Fri Jul 2 04:51:57 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F2EE51065674; Fri, 2 Jul 2010 04:51:56 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F04F106564A for ; Fri, 2 Jul 2010 04:51:56 +0000 (UTC) (envelope-from lz@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 7CE1B8FC0A for ; Fri, 2 Jul 2010 04:51:56 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o624pu7b046372 for ; Fri, 2 Jul 2010 04:51:56 GMT (envelope-from lz@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o624puKt046370 for perforce@freebsd.org; Fri, 2 Jul 2010 04:51:56 GMT (envelope-from lz@FreeBSD.org) Date: Fri, 2 Jul 2010 04:51:56 GMT Message-Id: <201007020451.o624puKt046370@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to lz@FreeBSD.org using -f From: Zheng Liu To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180402 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2010 04:51:57 -0000 http://p4web.freebsd.org/@@180402?ac=10 Change 180402 by lz@gnehzuil-freebsd on 2010/07/02 04:51:46 Now ext2fs can read ext4 file system w/o some new features. * Now it can read data from ext4 file system in some features. Features: + has_journal + filetype + sparse_super + huge_file * Now ext2fs use old group descriptor. So it just can read 32 bits bitmap and inode table. Affected files ... .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#5 edit .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2fs.h#3 edit Differences ... ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#5 (text+ko) ==== @@ -335,7 +335,6 @@ } else { fs->e2fs_first_inode = es->e2fs_first_ino; fs->e2fs_isize = es->e2fs_inode_size; - /* * Simple sanity check for superblock inode size value. */ @@ -351,8 +350,9 @@ fs->e2fs_itpg = fs->e2fs_ipg /fs->e2fs_ipb; fs->e2fs_descpb = fs->e2fs_bsize / sizeof (struct ext2_gd); /* s_resuid / s_resgid ? */ - fs->e2fs_gcount = (es->e2fs_bcount_lo - es->e2fs_first_dblock + - EXT2_BLOCKS_PER_GROUP(fs) - 1) / EXT2_BLOCKS_PER_GROUP(fs); + fs->e2fs_gcount = (((int64_t)(es->e2fs_bcount_hi) << 32 | es->e2fs_bcount_lo) + - es->e2fs_first_dblock + EXT2_BLOCKS_PER_GROUP(fs) - 1) / + EXT2_BLOCKS_PER_GROUP(fs); db_count = (fs->e2fs_gcount + EXT2_DESC_PER_BLOCK(fs) - 1) / EXT2_DESC_PER_BLOCK(fs); fs->e2fs_gdbcount = db_count; @@ -386,7 +386,7 @@ } fs->e2fs_total_dir = 0; for (i=0; i < fs->e2fs_gcount; i++){ - fs->e2fs_total_dir += fs->e2fs_gd[i].ext2bgd_ndirs_lo; + fs->e2fs_total_dir += (fs->e2fs_gd[i].ext2bgd_ndirs_lo); fs->e2fs_contigdirs[i] = 0; } if (es->e2fs_rev == E2FS_REV0 || @@ -753,9 +753,12 @@ sbp->f_bsize = EXT2_FRAG_SIZE(fs); sbp->f_iosize = EXT2_BLOCK_SIZE(fs); - sbp->f_blocks = fs->e2fs->e2fs_bcount_lo - overhead; - sbp->f_bfree = fs->e2fs->e2fs_fbcount_lo; - sbp->f_bavail = sbp->f_bfree - fs->e2fs->e2fs_rbcount_lo; + sbp->f_blocks = ((int64_t)(fs->e2fs->e2fs_bcount_hi) << 32 | + fs->e2fs->e2fs_bcount_lo) - overhead; + sbp->f_bfree = ((int64_t)(fs->e2fs->e2fs_fbcount_hi) << 32 | + fs->e2fs->e2fs_fbcount_lo); + sbp->f_bavail = sbp->f_bfree - ((int64_t)(fs->e2fs->e2fs_rbcount_hi) << 32 | + fs->e2fs->e2fs_rbcount_lo); sbp->f_files = fs->e2fs->e2fs_icount; sbp->f_ffree = fs->e2fs->e2fs_ficount; return (0); @@ -947,9 +950,9 @@ ip->i_db[i] = 0; } -/* + ext2_print_inode(ip); -*/ + bqrelse(bp); /* ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2fs.h#3 (text+ko) ==== @@ -320,6 +320,7 @@ u_int16_t ext2bgd_nifree_lo; /* number of free inodes */ u_int16_t ext2bgd_ndirs_lo; /* number of directories */ u_int16_t ext2bgd_flags; /* EXT4_BG_flags */ +#if 0 u_int32_t reserved[2]; u_int16_t ext2bgd_i_tables_unused_lo; /* number of unused inodes */ u_int16_t ext2bgd_chksum; /* crc16 checksum */ @@ -330,6 +331,7 @@ u_int16_t ext2bgd_nifree_hi; /* number of free inodes MSB */ u_int16_t ext2bgd_ndirs_hi; /* number of directories MSB */ u_int16_t ext2bgd_i_tables_unused_hi; /* number of unused inodes MSB */ +#endif u_int32_t reserved2[3]; }; From owner-p4-projects@FreeBSD.ORG Fri Jul 2 09:34:41 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 36D381065673; Fri, 2 Jul 2010 09:34:41 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF9481065670 for ; Fri, 2 Jul 2010 09:34:40 +0000 (UTC) (envelope-from lz@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C4AF88FC1A for ; Fri, 2 Jul 2010 09:34:40 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o629YeAn082859 for ; Fri, 2 Jul 2010 09:34:40 GMT (envelope-from lz@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o629Yerx082857 for perforce@freebsd.org; Fri, 2 Jul 2010 09:34:40 GMT (envelope-from lz@FreeBSD.org) Date: Fri, 2 Jul 2010 09:34:40 GMT Message-Id: <201007020934.o629Yerx082857@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to lz@FreeBSD.org using -f From: Zheng Liu To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180406 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2010 09:34:41 -0000 http://p4web.freebsd.org/@@180406?ac=10 Change 180406 by lz@gnehzuil-freebsd on 2010/07/02 09:33:57 Add ext2_extents.c file to implement ext4 extent. Affected files ... .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.c#1 add Differences ... From owner-p4-projects@FreeBSD.ORG Fri Jul 2 11:27:45 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DB6BA1065674; Fri, 2 Jul 2010 11:27:44 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DFDB1065670 for ; Fri, 2 Jul 2010 11:27:44 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8A6928FC1C for ; Fri, 2 Jul 2010 11:27:44 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o62BRi2D093295 for ; Fri, 2 Jul 2010 11:27:44 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o62BRi4i093293 for perforce@freebsd.org; Fri, 2 Jul 2010 11:27:44 GMT (envelope-from afiveg@FreeBSD.org) Date: Fri, 2 Jul 2010 11:27:44 GMT Message-Id: <201007021127.o62BRi4i093293@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180408 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2010 11:27:45 -0000 http://p4web.freebsd.org/@@180408?ac=10 Change 180408 by afiveg@cottonmouth on 2010/07/02 11:26:58 New synchronizations features: now we a re using ringmap mutexes defined in the ringmap structure. Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-bpf.c#4 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-int.h#4 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#6 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#11 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82540.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82542.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_defines.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_hw.h#7 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.c#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_regs.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.c#8 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.h#4 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#19 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#17 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#18 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#16 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_e1000.h#8 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#22 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#22 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#6 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#7 edit .. //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#2 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-bpf.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-int.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#11 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82540.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82542.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_defines.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_hw.h#7 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.c#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_regs.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.c#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.h#4 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#19 (text+ko) ==== @@ -1383,17 +1383,15 @@ if (ifp->if_drv_flags & IFF_DRV_RUNNING) { #ifdef RINGMAP - if ((adapter->rm != NULL) && (adapter->rm->ring != NULL)) + if (adapter->rm != NULL) { adapter->rm->funcs->delayed_isr(context); #endif if (lem_rxeof(adapter, adapter->rx_process_limit) != 0) taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); - #ifdef RINGMAP - if ((adapter->rm != NULL) && (adapter->rm->ring != NULL)) { adapter->rm->funcs->sync_head(adapter->dev, adapter->rm->ring); - if (adapter->rm != NULL) - wakeup(adapter->rm); + + wakeup(adapter->rm); } #endif @@ -1447,12 +1445,7 @@ lem_disable_intr(adapter); #ifdef RINGMAP - if ((adapter->rm != NULL) && /* ringmap structure should be allocated */ - (adapter->rm->ring != NULL) && - (adapter->rm->ring->td != NULL)) - { - adapter->rm->funcs->isr(arg); - } + adapter->rm->funcs->isr(arg); #endif taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); @@ -3581,12 +3574,14 @@ if (accept_frame) { #ifdef RINGMAP - if ((adapter->rm != NULL) && (adapter->rm->ring != NULL)) { + if (adapter->rm != NULL) { + RINGMAP_LOCK(adapter->rm); adapter->rm->funcs->delayed_isr_per_packet(adapter->rm->ring, i); #ifdef __RINGMAP_DEB PRINT_SLOT((adapter->rm->ring), (i), (adapter)); #endif + RINGMAP_UNLOCK(adapter->rm); } #endif ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#17 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#18 (text+ko) ==== @@ -25,7 +25,6 @@ void rm_8254_enable_intr(device_t); void rm_8254_disable_intr(device_t); int rm_8254_set_slot(struct ring *, struct adapter *, unsigned int); -void rm_8254_print_slot(struct ring *, unsigned int); void rm_8254_interrupt(void *); void rm_8254_delayed_interrupt(void *); int rm_8254_print_ring_pointers(struct adapter *); @@ -34,47 +33,19 @@ void rm_8254_sync_head(device_t, struct ring *); void rm_8254_delayed_interrupt_per_packet(struct ring *, int); struct ring *rm_8254_alloc_ring(device_t); -void rm_8254_free_ring(device_t, struct ring *); extern devclass_t em_devclass; extern void lem_enable_intr(struct adapter *); extern void lem_disable_intr(struct adapter *); +extern void ringmap_print_slot(struct ring *, unsigned int); -void -rm_8254_free_ring(device_t dev, struct ring *ring) -{ - struct adapter *adapter = (struct adapter *)device_get_softc(dev); - - if ( (adapter == NULL) || (ring == NULL) ) - goto out; - - /* Disable interrupts of adapter */ - rm_8254_disable_intr(dev); - - EM_RX_LOCK(adapter); - - contigfree(ring, sizeof(struct ring), M_DEVBUF); - - adapter->rm->ring = NULL; - - EM_RX_UNLOCK(adapter); - -out: ; - -} - struct ring * rm_8254_alloc_ring(device_t dev) { struct ring *ring; - struct adapter *adapter = (struct adapter *)device_get_softc(dev); - if ( (adapter == NULL) || (adapter->rm == NULL) ) { - return (NULL); - } - /* * Allocate memory for ring structure * Use contigmalloc(9) to get PAGE_SIZE alignment that is needed @@ -88,45 +59,14 @@ return (NULL); } - /* Disable interrupts of adapter while allocating the ring */ - rm_8254_disable_intr(dev); - EM_RX_LOCK(adapter); - - /* Set ring fields in the initial state */ - ring->kern_wait_user = 0; - ring->user_wait_kern = 0; - ring->interrupts_counter = 0; - ring->pkt_counter = 0; - ring->size = SLOTS_NUMBER; if (rm_8254_init_slots(ring, dev) == -1) { RINGMAP_ERROR(The ring is not initialized. Device will not be opened!); contigfree(ring, sizeof(struct ring), M_DEVBUF); - EM_RX_UNLOCK(adapter); - rm_8254_enable_intr(dev); - return (NULL); } - - /** - ** Currently only one process only one time can open our device !!! - **/ - if (!atomic_cmpset_int(&adapter->rm->open_cnt, 0, 1)){ - RINGMAP_ERROR(Sorry! Can not open device more then one time!); - atomic_readandclear_int(&adapter->rm->open_cnt); - - EM_RX_UNLOCK(adapter); - rm_8254_enable_intr(dev); - - return (NULL); - } - adapter->rm->ring = ring; - - EM_RX_UNLOCK(adapter); - rm_8254_enable_intr(dev); - return (ring); } @@ -141,8 +81,7 @@ ring->slot[slot_num].intr_num = ring->interrupts_counter; #ifdef RINGMAP_TIMESTAMP - ring->slot[slot_num].ts.tv_sec = ring->last_ts.tv_sec; - ring->slot[slot_num].ts.tv_usec = ring->last_ts.tv_usec; + ring->slot[slot_num].ts = ring->last_ts; #endif } @@ -173,9 +112,11 @@ struct adapter *adapter; adapter = (struct adapter *)device_get_softc(dev); + RINGMAP_LOCK(adapter->rm); if (ring != NULL) { RINGMAP_HW_SYNC_TAIL(adapter, ring); /* SW_TAIL ==> HW_TAIL */ } + RINGMAP_UNLOCK(adapter->rm); } @@ -185,9 +126,11 @@ struct adapter *adapter; adapter = (struct adapter *)device_get_softc(dev); + RINGMAP_LOCK(adapter->rm); if (ring != NULL) { RINGMAP_HW_SYNC_HEAD(adapter, ring); /* SW_TAIL ==> HW_HEAD */ } + RINGMAP_UNLOCK(adapter->rm); } @@ -199,9 +142,14 @@ rm_8254_interrupt(void *arg) { struct adapter *adapter = (struct adapter *) arg; + /* count interrupts */ - adapter->rm->ring->interrupts_counter++; + if ( (adapter->rm != NULL) && (adapter->rm->ring != NULL) && + adapter->rm->ring->td != NULL) { + + adapter->rm->ring->interrupts_counter++; + } } @@ -212,21 +160,14 @@ RINGMAP_INTR(start); - /* - * synchronize HEAD and TAIL with userrp and kernrp - * TODO: we want multithreading, it means we should later - * sync not one ring but many rings, each per thread - */ + rm_8254_sync_tail(adapter->dev, adapter->rm->ring); - if (adapter->rm != NULL) { - rm_8254_sync_tail(adapter->dev, adapter->rm->ring); - } - - #ifdef RINGMAP_TIMESTAMP + RINGMAP_LOCK(adapter->rm); if (adapter->rm->ring != NULL) { getmicrotime(&adapter->rm->ring->last_ts); } + RINGMAP_UNLOCK(adapter->rm); #endif RINGMAP_INTR(end); @@ -250,11 +191,6 @@ adapter = (struct adapter *)device_get_softc(dev); /* Check some pointers in the adapter structure */ - if (adapter == NULL){ - RINGMAP_ERROR(Adapter structure is not allocated!); - RINGMAP_ERROR(Probably driver is not loaded.); - return (-1); - } if (adapter->rx_buffer_area == NULL){ RINGMAP_ERROR(mbufs array is not allocated) return (-1); @@ -327,7 +263,7 @@ (bus_addr_t)vtophys(GET_DESCRIPTOR_P(adapter, slot_num)); #if (__RINGMAP_DEB) - rm_8254_print_slot(ring, slot_num); + ringmap_print_slot(ring, slot_num); #endif return (0); @@ -337,34 +273,8 @@ } -void -rm_8254_print_slot(struct ring *ring, unsigned int slot_number) -{ - printf("\n[%s] Slot Number: %d\n", __func__, slot_number); - printf("---------------- \n"); - - printf("physical addr of descriptor[%d] = 0x%X\n", slot_number, - (unsigned int) ring->slot[slot_number].descriptor.phys); - - printf("kernel addr of descriptor[%d] = 0x%X\n", slot_number, - (unsigned int) ring->slot[slot_number].descriptor.kern); - printf("physical addr of mbuf[%d] = 0x%X\n", slot_number, - (unsigned int) ring->slot[slot_number].mbuf.phys); - printf("kernel addr of mbuf[%d] = 0x%X\n", slot_number, - (unsigned int) ring->slot[slot_number].mbuf.kern); - - printf("physical addr of packet_buffer[%d] = 0x%X\n", slot_number, - (unsigned int) ring->slot[slot_number].packet.phys); - - printf("kernel addr of packet_buffer[%d] = 0x%X\n", slot_number, - (unsigned int) ring->slot[slot_number].packet.kern); - - printf("---------------- \n"); -} - - /* * Disable interrupts on adapter */ @@ -450,15 +360,20 @@ unsigned int rdt, rdh; struct ringmap *rm = NULL; - if ( (adapter == NULL) || - (adapter->rm == NULL) || - (adapter->rm->ring ) == NULL){ - RINGMAP_WARN(NULL pointer! Can not print rings pointers); + rm = adapter->rm; + + /* + * We should lock our data because while printing + * other process (for instance from other CPU) can + * free the memory regions that we are access in + * this functions + */ - return (0); - } + /* -> Critical Section: begin */ + RINGMAP_LOCK(rm); - rm = adapter->rm; + if ( (rm == NULL) || (rm->ring == NULL) ) + goto out; rdh = RINGMAP_HW_READ_HEAD(adapter); rdt = RINGMAP_HW_READ_TAIL(adapter); @@ -471,5 +386,10 @@ printf("== + userrp = %d \n", rm->ring->userrp); printf("== ++++++++++++++++++++++++++++++++++++++ \n\n"); +out: + + RINGMAP_UNLOCK(rm); + /* -> Critical Section: end */ + return (0); } ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#16 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_e1000.h#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#22 (text+ko) ==== @@ -38,6 +38,7 @@ int is_supported (unsigned int); int set_ringmap_funcs (struct ringmap *, unsigned int); void ringmap_close_cb (void *data); +void ringmap_print_slot(struct ring *, unsigned int); struct ringmap *(*get_ringmap_p)(device_t); device_t (*get_device_p)(struct cdev *); @@ -54,7 +55,6 @@ extern void rm_8254_sync_head(device_t, struct ring *); extern void rm_8254_delayed_interrupt_per_packet(struct ring *, int); extern struct ring *rm_8254_alloc_ring(device_t); -extern void rm_8254_free_ring(device_t, struct ring *); d_open_t ringmap_open; d_close_t ringmap_close; @@ -127,7 +127,6 @@ rm->funcs->sync_tail = rm_8254_sync_tail; rm->funcs->sync_head = rm_8254_sync_head; rm->funcs->alloc_ring = rm_8254_alloc_ring; - rm->funcs->free_ring = rm_8254_free_ring; get_ringmap_p = rm_8254_get_ringmap_p; get_device_p = rm_8254_get_device_p; @@ -160,15 +159,14 @@ RINGMAP_FUNC_DEBUG(begin); pci_dev_id = pci_get_device(dev); - controller_type = is_supported(pci_dev_id); /* Make sure we are support this controller */ + controller_type = is_supported(pci_dev_id); if (!(controller_type)) return (-1); rm = (struct ringmap *) contigmalloc (sizeof(struct ringmap), - M_DEVBUF, M_ZERO, 0, -1L, PAGE_SIZE, 0); - + M_DEVBUF, M_ZERO, 0, -1L, PAGE_SIZE, 0); if (rm == NULL) { RINGMAP_ERROR(Can not allocate space for ringmap structure); return (-1); @@ -208,6 +206,9 @@ /* Store adapters device structure */ rm->dev = dev; + /* Init the mutex to protecting our data */ + RINGMAP_LOCK_INIT(rm, device_get_nameunit(dev)); + /* set the pointer to ringmap in the adapters structure */ rm->funcs->set_ringmap_to_adapter(dev, rm); @@ -231,6 +232,8 @@ } destroy_dev(rm->cdev); + + RINGMAP_LOCK_DESTROY(rm); contigfree(rm->funcs, sizeof(struct ringmap_functions), M_DEVBUF); contigfree(rm, sizeof(struct ringmap), M_DEVBUF); @@ -252,6 +255,7 @@ int ringmap_open(struct cdev *cdev, int flag, int otyp, struct thread *td) { + int err = 0; struct ringmap *rm = NULL; RINGMAP_FUNC_DEBUG(start); @@ -268,33 +272,61 @@ return (EIO); } - + + /* + * I think it is safe to disable interupts while we allocate + * allocate memory for oure structures + */ + rm->funcs->disable_intr(rm->dev); + + /* -> Critical Section: begin */ + RINGMAP_LOCK(rm); if ( rm->dev == NULL ) { RINGMAP_ERROR(Null pointer to device structure of adapter); - return (EIO); + err = EIO; goto out; } /* Allocate ring */ - if ( rm->funcs->alloc_ring(rm->dev ) == NULL) { - RINGMAP_ERROR(Null pointer to ring the structure); + rm->ring = rm->funcs->alloc_ring(rm->dev); - return (EIO); - } - /* Check for any cases */ if ( rm->ring == NULL ) { RINGMAP_ERROR(Error! Please debug!); - return (EIO); + + err = EIO; goto out; } + + /* Set ring fields in the initial state */ + rm->ring->kern_wait_user = 0; + rm->ring->user_wait_kern = 0; + rm->ring->interrupts_counter = 0; + rm->ring->pkt_counter = 0; + rm->ring->size = SLOTS_NUMBER; /* Store pointer to the thread */ rm->ring->td = td; + /* + * Currently only one process only one time can open our device !!! + */ + if (!atomic_cmpset_int(&rm->open_cnt, 0, 1)){ + RINGMAP_ERROR(Sorry! Can not open device more then one time!); + atomic_readandclear_int(&rm->open_cnt); + + err = EIO; goto out; + } + +out: + RINGMAP_UNLOCK(rm); + /* -> Critical Section: end */ + + rm->funcs->enable_intr(rm->dev); + RINGMAP_FUNC_DEBUG(end); - return (0); + return (err); } @@ -313,12 +345,20 @@ return (0); } + rm->funcs->disable_intr(rm->dev); + atomic_readandclear_int(&rm->open_cnt); - if (rm->ring != NULL){ - rm->funcs->free_ring(rm->dev, rm->ring); - rm->ring = NULL; - } + /* -> Critical Section: begin */ + RINGMAP_LOCK(rm); + + if (rm->ring != NULL) + contigfree(rm->ring, sizeof(struct ring), M_DEVBUF); + + rm->ring = NULL; + + RINGMAP_UNLOCK(rm); + /* -> Critical Section: end */ RINGMAP_FUNC_DEBUG(end); @@ -330,6 +370,7 @@ ringmap_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) { + int err = 0; struct ringmap *rm = NULL; RINGMAP_FUNC_DEBUG(start); @@ -342,22 +383,32 @@ RINGMAP_ERROR(Can not get pointer to ringmap structure); return (ENXIO); } + + /* -> Critical Section: begin */ + RINGMAP_LOCK(rm); + if (rm->ring == NULL){ RINGMAP_ERROR(Can not get pointer to ring structure); - return (ENXIO); + + err = ENXIO; goto out; } /* Check protections */ if (nprot & PROT_EXEC) { RINGMAP_WARN("PROT_EXEC ist set"); - return (ERESTART); + + err = ERESTART; goto out; } *paddr = vtophys(rm->ring); +out: + RINGMAP_UNLOCK(rm); + /* -> Critical Section: end */ + RINGMAP_FUNC_DEBUG(end); - return(0); + return(err); } @@ -396,9 +447,18 @@ /* Sleep and wait for new frames */ case IOCTL_SLEEP_WAIT: RINGMAP_IOCTL(Sleep and wait for new packets); + ringmap->ring->user_wait_kern++; ringmap->funcs->sync_head_tail(get_device_p(cdev), ringmap->ring); - err_sleep = tsleep(ringmap, (PRI_MIN) | PCATCH, "ioctl", 0); + + /* + * In the time: from user has called ioctl() until now could + * come the new packets. It means, before we are going to sleep + * it makes a sence to check if we really must do it :) + */ + if (RING_IS_EMPTY(ringmap->ring)) { + err_sleep = tsleep(ringmap, (PRI_MIN) | PCATCH, "ioctl", 0); + } break; case IOCTL_SYNC_HEAD_TAIL: @@ -419,3 +479,30 @@ return (err); } + +void +ringmap_print_slot(struct ring *ring, unsigned int slot_number) +{ + printf("\n[%s] Slot Number: %d\n", __func__, slot_number); + printf("---------------- \n"); + + printf("physical addr of descriptor[%d] = 0x%X\n", slot_number, + (unsigned int) ring->slot[slot_number].descriptor.phys); + + printf("kernel addr of descriptor[%d] = 0x%X\n", slot_number, + (unsigned int) ring->slot[slot_number].descriptor.kern); + + printf("physical addr of mbuf[%d] = 0x%X\n", slot_number, + (unsigned int) ring->slot[slot_number].mbuf.phys); + + printf("kernel addr of mbuf[%d] = 0x%X\n", slot_number, + (unsigned int) ring->slot[slot_number].mbuf.kern); + + printf("physical addr of packet_buffer[%d] = 0x%X\n", slot_number, + (unsigned int) ring->slot[slot_number].packet.phys); + + printf("kernel addr of packet_buffer[%d] = 0x%X\n", slot_number, + (unsigned int) ring->slot[slot_number].packet.kern); + + printf("---------------- \n"); +} ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#22 (text+ko) ==== @@ -1,11 +1,3 @@ -/* Minimum distance to be kept between the userrp and RDT to provide a - * guarantee to userspace processes that the previous n buffer positions - * behind userrp will not be overwritten - * - * Currently not used!!! - * */ -#define RING_SAFETY_MARGIN 3 - /* * value for number of descriptors (a.k.a. slots in the ringbuffer) */ @@ -20,12 +12,6 @@ #define MOD_NAME "if_ringmap.ko" /* - * Messaure statistics for each pkt. - * at the moment not used, but will be - */ -#define EACH_PKT 20 - -/* * Driver works only with device wich has the following device ID. If 0 * then work with all devices that was found and accepted in the "probe" * function. @@ -137,13 +123,22 @@ /* Counts number of hardware interrupts */ unsigned long long interrupts_counter; + /* + * Slot which currently processed by driver in context of + * delayed interupt + */ unsigned int volatile cur_slot_kern; + + /* + * Slot which currently processed by user-space process + * in the pcap_read_ringmap() function (ringmap_pcap.c) + */ unsigned int volatile cur_slot_user; /* * Number of received packets. This variable should be changed only in * user-space. We want to count the packets, that was seen by user-space - * process + * process. I am not sure we are need it :( */ unsigned long long pkt_counter; @@ -181,6 +176,9 @@ /* Hardware dependent functions */ struct ringmap_functions *funcs; + /* Mutex that should protect the data allocated in the ring */ + struct mtx ringmap_mtx; + /* Our ring that have to be mapped in space of user process */ struct ring *ring; }; @@ -229,9 +227,9 @@ void (*delayed_isr_per_packet)(struct ring *, int); /* - * This function synchronize the tail and head hardware registers - * with head and tail software varibles, that are visible from - * software process. + * Next functions synchronize the tail and head hardware registers + * with head and tail software varibles which are also visible from + * user-space process. * * Synchronisation rules: * 1. SYNC_HEAD: HARDWARE_HEAD => SOFTWARE_HEAD @@ -255,10 +253,16 @@ /* Alloc memory for our ring and initialize the slots */ struct ring *(*alloc_ring)(device_t); +}; - /* Free memory that was allocated for the ring */ - void (*free_ring)(device_t, struct ring *); -}; +/* MUTEX */ +#define RINGMAP_LOCK_INIT(rm, _name) \ + mtx_init(&(rm)->ringmap_mtx, _name, "RINGMAP Lock", MTX_DEF) +#define RINGMAP_LOCK_DESTROY(rm) mtx_destroy(&(rm)->ringmap_mtx) +#define RINGMAP_LOCK(rm) mtx_lock(&(rm)->ringmap_mtx) +#define RINGMAP_TRYLOCK(rm) mtx_trylock(&(rm)->ringmap_mtx) +#define RINGMAP_UNLOCK(rm) mtx_unlock(&(rm)->ringmap_mtx) + #endif /* _KERNEL */ @@ -420,7 +424,7 @@ (unsigned int)adapter->rx_buffer_area[i].m_head->m_data,\ (unsigned int)adapter->rx_desc_base[i].buffer_addr); -#define PRINT_SOME_BYTES_FROM_PKT(adapter, i) \ +#define PRINT_SOME_BYTES_FROM_PKT(adapter, i) \ printf("=+= [%s] SOME BYTES FROM PKT: %hhX %hhX %hhX %hhX %hhX\n", \ __func__, \ adapter->rx_buffer_area[i].m_head->m_data[0], \ @@ -444,7 +448,7 @@ printf("\n=+= =============================\n"); \ printf("=+= Slot Number: %d \n", (i)); \ printf("=+= Intrr num: %llu\n", (ring)->slot[(i)].intr_num); \ - printf("=+= Time stamp: %llu\n", (unsigned long long)(((ring)->slot[(i)].ts.tv_sec*1000000 + (ring)->slot[(i)].ts.tv_usec))); \ + printf("=+= Time stamp: %llu\n", (unsigned long long)(((ring)->slot[(i)].ts.tv_sec*1000000 + (ring)->slot[(i)].ts.tv_usec))); \ printf("=+= Accepted: %d\n", (ring)->slot[(i)].is_ok); \ PRINT_SOME_BYTES_FROM_PKT((arg), (i)); \ printf("=+= =============================\n\n"); \ ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#7 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#2 (text+ko) ==== From owner-p4-projects@FreeBSD.ORG Fri Jul 2 11:57:17 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 62FAE1065674; Fri, 2 Jul 2010 11:57:17 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ED291065672 for ; Fri, 2 Jul 2010 11:57:17 +0000 (UTC) (envelope-from lz@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id F05F98FC15 for ; Fri, 2 Jul 2010 11:57:16 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o62BvGKu095663 for ; Fri, 2 Jul 2010 11:57:16 GMT (envelope-from lz@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o62BvGwF095661 for perforce@freebsd.org; Fri, 2 Jul 2010 11:57:16 GMT (envelope-from lz@FreeBSD.org) Date: Fri, 2 Jul 2010 11:57:16 GMT Message-Id: <201007021157.o62BvGwF095661@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to lz@FreeBSD.org using -f From: Zheng Liu To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180409 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2010 11:57:17 -0000 http://p4web.freebsd.org/@@180409?ac=10 Change 180409 by lz@gnehzuil-freebsd on 2010/07/02 11:56:16 Modify ext2_read() function to adapt ext4 extent. Affected files ... .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.c#2 edit .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.h#3 edit .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode.c#3 edit .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode_cnv.c#4 edit .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_readwrite.c#3 edit .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_rsv_win.h#3 edit .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#6 edit .. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/inode.h#4 edit Differences ... ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.c#2 (text+ko) ==== @@ -26,10 +26,21 @@ * $FreeBSD: src/sys/fs/ext2fs/ext2_extents.c,v 0.1 2010/07/02 17:22:00 lz Exp $ */ +#include + +#include #include +/* + * find a block in ext4 extent cache. + */ int ext4_ext_in_cache(struct inode *ip, daddr_t lbn, struct ext4_extent *ep) { - return (0); + struct ext4_extent_cache *ecp; + int ret = EXT4_EXT_CACHE_NO; + + ecp = &ip->i_ext_cache; + + return (ret); } ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extents.h#3 (text+ko) ==== @@ -28,8 +28,18 @@ #ifndef _FS_EXT2FS_EXT2_EXTENTS_H_ #define _FS_EXT2FS_EXT2_EXTENTS_H_ +#include + #define EXT4_EXT_MAGIC 0xf30a +/* lock/unlock ext lock */ +#define EXT4_EXT_LOCK(ip) mtx_lock(&(ip)->i_ext_lock) +#define EXT4_EXT_UNLOCK(ip) mtx_unlock(&(ip)->i_ext_lock) + +#define EXT4_EXT_CACHE_NO 0 +#define EXT4_EXT_CACHE_GAP 1 +#define EXT4_EXT_CACHE_IN 2 + /* * ext4 file system extent on disk */ @@ -61,4 +71,17 @@ u_int32_t eh_gen; /* generation of extent tree */ }; +/* + * save cached extent + */ +struct ext4_extent_cache { + daddr_t ec_start; /* extent start */ + u_int32_t ec_blk; /* logical block */ + u_int32_t ec_len; + u_int32_t ec_type; +}; + +struct inode; +int ext4_ext_in_cache(struct inode *, daddr_t, struct ext4_extent *); + #endif /* !_FS_EXT2FS_EXT2_EXTENTS_H_ */ ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode.c#3 (text+ko) ==== @@ -550,6 +550,8 @@ EXT2_RSV_UNLOCK(ip); mtx_destroy(&ip->i_rsv_lock); + mtx_destroy(&ip->i_ext_lock); + free(vp->v_data, M_EXT2NODE); vp->v_data = 0; vnode_destroy_vobject(vp); ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode_cnv.c#4 (text+ko) ==== @@ -83,10 +83,13 @@ ip->i_atime = ei->e2di_atime; ip->i_mtime = ei->e2di_mtime; ip->i_ctime = ei->e2di_ctime; + ip->i_flags = ei->e2di_flags; /* we need to entire flags to check new features */ +#if 0 ip->i_flags = 0; ip->i_flags |= (ei->e2di_flags & EXT2_APPEND) ? SF_APPEND : 0; ip->i_flags |= (ei->e2di_flags & EXT2_IMMUTABLE) ? SF_IMMUTABLE : 0; ip->i_flags |= (ei->e2di_flags & EXT2_NODUMP) ? UF_NODUMP : 0; +#endif if (ip->i_e2fs->e2fs->e2fs_features_incompat & EXT4F_ROCOMPAT_HUGE_FILE) ip->i_blocks = ((int64_t)(ei->e2di_nblock_high)) << 32 | ei->e2di_nblock_lo; else ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_readwrite.c#3 (text+ko) ==== @@ -36,6 +36,9 @@ * $FreeBSD: src/sys/fs/ext2fs/ext2_readwrite.c,v 1.1 2010/01/14 14:30:54 lulf Exp $ */ +#include +#include + /* XXX TODO: remove these obfuscations (as in ffs_vnops.c). */ #define BLKSIZE(a, b, c) blksize(a, b, c) #define FS struct m_ext2fs @@ -45,17 +48,53 @@ #define WRITE ext2_write #define WRITE_S "ext2_write" +static int ext4_ext_read(struct vop_read_args *); +static int ext2_ind_read(struct vop_read_args *); + +/* + * this function handles ext4 extents block mapping + */ +static int +ext4_ext_read(struct vop_read_args *ap) +{ + struct vnode *vp; + struct inode *ip; + struct uio *uio; + struct m_ext2fs *fs; + struct ext4_extent nex; + daddr_t lbn, nextlbn; + u_short mode; + int cache_type; + int orig_resid; + int error = 0; + + vp = ap->a_vp; + ip = VTOI(vp); + mode = ip->i_mode; + uio = ap->a_uio; + + orig_resid = uio->uio_resid; + KASSERT(orig_resid >= 0, ("ext2_read: uio->uio_resid < 0")); + if (orig_resid == 0) + return (0); + KASSERT(uio->uio_offset >= 0, ("ext2_read: uio->uio_offset < 0")); + fs = ip->I_FS; + if (uio->uio_offset < ip->i_size && uio->uio_offset >= fs->e2fs_maxfilesize) + return (EOVERFLOW); + + lbn = lblkno(fs, uio->uio_offset); + nextlbn = lbn + 1; + + cache_type = ext4_ext_in_cache(ip, lbn, &nex); + + return (error); +} + /* - * Vnode op for reading. + * this function handles traditional block mapping */ static int -READ(ap) - struct vop_read_args /* { - struct vnode *a_vp; - struct uio *a_uio; - int a_ioflag; - struct ucred *a_cred; - } */ *ap; +ext2_ind_read(struct vop_read_args *ap) { struct vnode *vp; struct inode *ip; @@ -152,6 +191,35 @@ } /* + * Vnode op for reading. + */ +static int +READ(ap) + struct vop_read_args /* { + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; + } */ *ap; +{ + struct vnode *vp; + struct inode *ip; + int error; + + vp = ap->a_vp; + ip = VTOI(vp); + + EXT4_EXT_LOCK(ip); + if (ip->i_flags & EXT4_EXTENTS) + error = ext4_ext_read(ap); + else + error = ext2_ind_read(ap); + EXT4_EXT_UNLOCK(ip); + + return (error); +} + +/* * Vnode op for writing. */ static int ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_rsv_win.h#3 (text+ko) ==== @@ -69,6 +69,7 @@ RB_PROTOTYPE(ext2_rsv_win_tree, ext2_rsv_win, rsv_link, ext2_rsv_win_cmp); struct inode; +struct ucred; /* ext2_alloc.c */ void ext2_init_rsv(struct inode *ip); void ext2_discard_rsv(struct inode *ip); ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#6 (text+ko) ==== @@ -931,6 +931,7 @@ ip->i_prealloc_count = 0; ip->i_prealloc_block = 0; + /* initialize rsv lock and rsv data structure */ bzero(&ip->i_rsv_lock, sizeof(struct mtx)); mtx_init(&ip->i_rsv_lock, "inode rsv lock", NULL, MTX_DEF); EXT2_RSV_LOCK(ip); @@ -939,6 +940,10 @@ ext2_init_rsv(ip); EXT2_RSV_UNLOCK(ip); + /* initialize ext lock */ + bzero(&ip->i_ext_lock, sizeof(struct mtx)); + mtx_init(&ip->i_ext_lock, "inode ext lock", NULL, MTX_DEF); + /* * Now we want to make sure that block pointers for unused * blocks are zeroed out - ext2_balloc depends on this ==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/inode.h#4 (text+ko) ==== @@ -38,9 +38,13 @@ #ifndef _FS_EXT2FS_INODE_H_ #define _FS_EXT2FS_INODE_H_ +#include #include +#include #include + #include +#include #define ROOTINO ((ino_t)2) @@ -102,8 +106,14 @@ u_int32_t i_uid; /* File owner. */ u_int32_t i_gid; /* File group. */ + /* reservation window */ struct mtx i_rsv_lock; /* Protects i_rsv */ struct ext2_rsv_win *i_rsv; /* Reservation window */ + + /* ext4 extents support */ + struct mtx i_ext_lock; /* this lock only is required in read/write mode + but we still use it in read-only mode. */ + struct ext4_extent_cache i_ext_cache; /* cache for ext4 extent */ }; /* From owner-p4-projects@FreeBSD.ORG Fri Jul 2 14:51:28 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5680D106566B; Fri, 2 Jul 2010 14:51:28 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A5AE106566C for ; Fri, 2 Jul 2010 14:51:28 +0000 (UTC) (envelope-from phcoder@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id EBA7F8FC16 for ; Fri, 2 Jul 2010 14:51:27 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o62EpR2O022546 for ; Fri, 2 Jul 2010 14:51:27 GMT (envelope-from phcoder@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o62EpRGH022544 for perforce@freebsd.org; Fri, 2 Jul 2010 14:51:27 GMT (envelope-from phcoder@FreeBSD.org) Date: Fri, 2 Jul 2010 14:51:27 GMT Message-Id: <201007021451.o62EpRGH022544@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to phcoder@FreeBSD.org using -f From: Volodymyr Serbinenko To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180415 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2010 14:51:28 -0000 http://p4web.freebsd.org/@@180415?ac=10 Change 180415 by phcoder@phcoder_ on 2010/07/02 14:50:59 Resync with bzr. Now USB works but only when debug messages are enabled and only the controller on PCI (no Geode yet) Affected files ... .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/conf/YEELOONG#3 edit .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/include/cpuregs.h#4 edit .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/mips/busdma_machdep.c#3 edit .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/mips/exception.S#4 edit .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/mips/locore.S#4 edit .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/mips/pmap.c#3 edit .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/yeeloong/bonito_pci.c#1 add .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/yeeloong/files.yeeloong#2 edit .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/yeeloong/yeeloong_machdep.c#3 edit Differences ... ==== //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/conf/YEELOONG#3 (text+ko) ==== @@ -41,8 +41,22 @@ options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed +options USB_DEBUG # enable debug msgs device loop device ether device md device uart + +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +options PROCFS # Process filesystem (requires PSEUDOFS) +options GEOM_PART_GPT # GUID Partition Tables. +options GEOM_LABEL # Provides labelization + +device ch # SCSI media changers +device da # Direct Access (disks) +device sa # Sequential Access (tape etc) +device cd # CD +device pass # Passthrough device (direct SCSI access) +device ses # SCSI Environmental Services (and SAF-TE) ==== //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/include/cpuregs.h#4 (text+ko) ==== @@ -100,7 +100,7 @@ #define MIPS_XKPHYS_CCA_CNC 0x03 /* Cacheable non-coherent. */ #define MIPS_PHYS_TO_XKPHYS(cca,x) \ - ((0x2ULL << 62) | ((unsigned long long)(cca) << 59) | (x)) + ((0x2ULL << 62) | ((unsigned long long)(2) << 59) | (x)) #define MIPS_XKPHYS_TO_PHYS(x) ((x) & 0x07ffffffffffffffULL) #define MIPS_XUSEG_START 0x0000000000000000 @@ -343,7 +343,7 @@ #define MIPS_VEC_EJTAG 0xBFC00480 #define MIPS_VEC_TLB 0x80000000 #define MIPS_VEC_XTLB 0x80000080 -#define MIPS_VEC_CACHE 0x80000100 +#define MIPS_VEC_CACHE 0xa0000100 #define MIPS_VEC_GENERIC 0x80000180 /* Most exceptions */ #define MIPS_VEC_INTERRUPT 0x80000200 ==== //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/mips/busdma_machdep.c#3 (text+ko) ==== @@ -805,6 +805,9 @@ if (++seg >= dmat->nsegments) break; segs[seg].ds_addr = curaddr; +#ifdef TARGET_YEELOONG + segs[seg].ds_addr |= 0x80000000; +#endif segs[seg].ds_len = sgsize; } if (error) ==== //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/mips/exception.S#4 (text+ko) ==== @@ -156,7 +156,10 @@ CLEAR_PTE_SWBITS(k1) MTC0 k1, COP_0_TLB_LO1 #15: lo1 is loaded COP0_SYNC + MTC0 zero, COP_0_TLB_PG_MASK + COP0_SYNC tlbwr #1a: write to tlb + HAZARD_DELAY eret #1f: retUrn from exception 1: j MipsTLBMissException #20: kernel exception @@ -851,7 +854,10 @@ CLEAR_PTE_SWBITS(k1) MTC0 k1, COP_0_TLB_LO1 COP0_SYNC + MTC0 zero, COP_0_TLB_PG_MASK + COP0_SYNC + b tlb_insert_entry nop @@ -864,6 +870,8 @@ CLEAR_PTE_SWBITS(k1) MTC0 k1, COP_0_TLB_LO1 COP0_SYNC + MTC0 zero, COP_0_TLB_PG_MASK + COP0_SYNC tlb_insert_entry: tlbp @@ -1006,6 +1014,8 @@ CLEAR_PTE_SWBITS(k1) MTC0 k1, COP_0_TLB_LO1 # lo1 is loaded COP0_SYNC + MTC0 zero, COP_0_TLB_PG_MASK + COP0_SYNC tlbwr # write to tlb HAZARD_DELAY eret # return from exception ==== //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/mips/locore.S#4 (text+ko) ==== @@ -158,9 +158,48 @@ mtc0 t2, COP_0_STATUS_REG COP0_SYNC + lui t0, 0x8000 + lui t1, 0x8000 + addiu t1, 0x4000 +1: + cache 0, 0(t0) + cache 0, 1(t0) + cache 0, 2(t0) + cache 0, 3(t0) + addiu t0, 32 + bne t0, t1, 1b + nop + + lui t0, 0x8000 + lui t1, 0x8000 + addiu t1, 0x4000 +1: + cache 1, 0(t0) + cache 1, 1(t0) + cache 1, 2(t0) + cache 1, 3(t0) + addiu t0, 32 + bne t0, t1, 1b + nop + + lui t0, 0x8000 + lui t1, 0x8002 +1: + cache 3, 0(t0) + cache 3, 1(t0) + cache 3, 2(t0) + cache 3, 3(t0) + addiu t0, 32 + bne t0, t1, 1b + nop + + /* Make sure KSEG0 is cached */ mfc0 t0, MIPS_COP_0_CONFIG - ori t0, CFG_K0_CACHED + srl t0, 3 + sll t0, 3 + ori t0, 2 +// ori t0, CFG_K0_CACHED mtc0 t0, MIPS_COP_0_CONFIG COP0_SYNC ==== //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/mips/pmap.c#3 (text+ko) ==== @@ -226,7 +226,7 @@ sysm = &sysmap_lmem[cpu]; \ va = sysm->base; \ npte = TLBLO_PA_TO_PFN(phys) | \ - PG_D | PG_V | PG_G | PG_W | PG_C_CNC; \ + PG_D | PG_V | PG_G | PG_W | PG_C_UC; \ pte = pmap_pte(kernel_pmap, va); \ *pte = npte; \ sysm->valid1 = 1 @@ -242,11 +242,11 @@ va1 = sysm->base; \ va2 = sysm->base + PAGE_SIZE; \ npte = TLBLO_PA_TO_PFN(phys1) | \ - PG_D | PG_V | PG_G | PG_W | PG_C_CNC; \ + PG_D | PG_V | PG_G | PG_W | PG_C_UC; \ pte = pmap_pte(kernel_pmap, va1); \ *pte = npte; \ npte = TLBLO_PA_TO_PFN(phys2) | \ - PG_D | PG_V | PG_G | PG_W | PG_C_CNC; \ + PG_D | PG_V | PG_G | PG_W | PG_C_UC; \ pte = pmap_pte(kernel_pmap, va2); \ *pte = npte; \ sysm->valid1 = 1; \ @@ -731,7 +731,7 @@ npte = TLBLO_PA_TO_PFN(pa) | PG_D | PG_V | PG_G | PG_W; if (is_cacheable_mem(pa)) - npte |= PG_C_CNC; + npte |= PG_C_UC; else npte |= PG_C_UC; @@ -1828,7 +1828,7 @@ newpte = TLBLO_PA_TO_PFN(pa) | rw | PG_V; if (is_cacheable_mem(pa)) - newpte |= PG_C_CNC; + newpte |= PG_C_UC; else newpte |= PG_C_UC; @@ -1990,7 +1990,7 @@ *pte = TLBLO_PA_TO_PFN(pa) | PG_V; if (is_cacheable_mem(pa)) - *pte |= PG_C_CNC; + *pte |= PG_C_UC; else *pte |= PG_C_UC; @@ -2045,7 +2045,7 @@ cpu = PCPU_GET(cpuid); sysm = &sysmap_lmem[cpu]; /* Since this is for the debugger, no locks or any other fun */ - npte = TLBLO_PA_TO_PFN(pa) | PG_D | PG_V | PG_G | PG_W | PG_C_CNC; + npte = TLBLO_PA_TO_PFN(pa) | PG_D | PG_V | PG_G | PG_W | PG_C_UC; pte = pmap_pte(kernel_pmap, sysm->base); *pte = npte; sysm->valid1 = 1; @@ -2939,20 +2939,20 @@ pt_entry_t rw; if (!(prot & VM_PROT_WRITE)) - rw = PG_V | PG_RO | PG_C_CNC; + rw = PG_V | PG_RO | PG_C_UC; else { if (va >= VM_MIN_KERNEL_ADDRESS) { /* * Don't bother to trap on kernel writes, just * record page as dirty. */ - rw = PG_V | PG_D | PG_C_CNC; + rw = PG_V | PG_D | PG_C_UC; vm_page_dirty(m); } else if ((m->md.pv_flags & PV_TABLE_MOD) || m->dirty == VM_PAGE_BITS_ALL) - rw = PG_V | PG_D | PG_C_CNC; + rw = PG_V | PG_D | PG_C_UC; else - rw = PG_V | PG_C_CNC; + rw = PG_V | PG_C_UC; vm_page_flag_set(m, PG_WRITEABLE); } return rw; ==== //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/yeeloong/files.yeeloong#2 (text+ko) ==== @@ -4,3 +4,4 @@ mips/yeeloong/yeeloong_machdep.c standard mips/mips/tick.c standard mips/mips/intr_machdep.c standard +mips/yeeloong/bonito_pci.c optional pci ==== //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/yeeloong/yeeloong_machdep.c#3 (text+ko) ==== @@ -81,12 +81,11 @@ printf("entry: mips_init()\n"); - memstart = 64 << 20; //(((vm_offset_t)&end) & 0x1fffffff); -// memstart = (memstart + 2 * 1048576) & ~1048575; + memstart = ((((vm_offset_t)&end) + 0xfffff) & 0x1ff00000); bootverbose = 1; /* FIXME: retrieve memory map from loader. */ - realmem = btoc((32 << 20)); + realmem = btoc((64 << 20) - memstart); for (i = 0; i < 10; i++) { phys_avail[i] = 0; @@ -94,7 +93,7 @@ /* phys_avail regions are in bytes */ phys_avail[0] = memstart; - phys_avail[1] = 96 << 20; + phys_avail[1] = (64 << 20); physmem = realmem; @@ -157,9 +156,6 @@ /* FIXME: retrieve from multiboot2 info. */ uint64_t platform_counter_freq = 400 * 1000 * 1000; - *((volatile uint32_t *)(intptr_t) (int32_t) 0xbfe00150) = 0; - *((volatile uint32_t *)(intptr_t) (int32_t) 0xbfe00154) = 0; - /* clear the BSS and SBSS segments */ kernend = round_page((vm_offset_t)&end); memset(&edata, 0, kernend - (vm_offset_t)(&edata)); @@ -170,6 +166,7 @@ boothowto = RB_MULTIPLE | RB_SERIAL; cninit(); + mips_init(); mips_timer_init_params(platform_counter_freq, 0); } From owner-p4-projects@FreeBSD.ORG Fri Jul 2 21:38:54 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 506EE106567B; Fri, 2 Jul 2010 21:38:54 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F26751065674 for ; Fri, 2 Jul 2010 21:38:53 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id DFB248FC19 for ; Fri, 2 Jul 2010 21:38:53 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o62Lcr0C081603 for ; Fri, 2 Jul 2010 21:38:53 GMT (envelope-from gpf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o62LcrjA081601 for perforce@freebsd.org; Fri, 2 Jul 2010 21:38:53 GMT (envelope-from gpf@FreeBSD.org) Date: Fri, 2 Jul 2010 21:38:53 GMT Message-Id: <201007022138.o62LcrjA081601@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gpf@FreeBSD.org using -f From: Efstratios Karatzas To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180422 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2010 21:38:54 -0000 http://p4web.freebsd.org/@@180422?ac=10 Change 180422 by gpf@gpf_desktop on 2010/07/02 21:38:21 - nfsv4 open operation for nfsv4 belongs to audit class 'fc' - made the required changes so that nfsv4 ops that are supposed to change the current filehandle, actually do so. Also, changed getfh() so that the filehandle containing the hint is returned to the client. savefh() now saves the actual filehandle instead of just the vnode pointer. Tested the hell out of this change and it seems to be working fine. - provided audit support for a few more nfsv4 ops This is a work in progress - the code I'm editing now will be going through changes this weekend. Affected files ... .. //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/etc/audit_event#5 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdserv.c#7 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdsocket.c#10 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit_bsm.c#12 edit Differences ... ==== //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/etc/audit_event#5 (text) ==== @@ -397,7 +397,7 @@ 2029:AUE_NFS_LOCKU:nfsrv_locku():fm 2030:AUE_NFS_LOOKUPP:nfsrv_lockupp():fa,ad 2031:AUE_NFS_NVERIFY:nfsrv_nverify():fa -2032:AUE_NFS_OPEN:nfsrv_open():fa +2032:AUE_NFS_OPEN:nfsrv_open():fa,fc 2033:AUE_NFS_OPENATTR:nfsrv_openattr():fa 2034:AUE_NFS_OPENCONFIRM:nfsrv_openconfirm():fa 2035:AUE_NFS_OPENDOWNGRADE:nfsrv_opendowngrade():fm ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdserv.c#7 (text+ko) ==== @@ -1729,6 +1729,8 @@ nd->nd_repstat = nfsvno_getattr(ndp->ni_vp, nvap, nd->nd_cred, p); } + else if (nd->nd_flag & ND_NFSV4) + nfsvno_getfh(ndp->ni_vp, fhp, p, ndp->ni_dvp); if (vpp) { NFSVOPUNLOCK(ndp->ni_vp, 0, p); *vpp = ndp->ni_vp; @@ -2826,6 +2828,7 @@ (void) nfsm_strtom(nd, "OWNER@", 6); } *vpp = vp; + nfsvno_getfh(vp, fhp, p, dp); } else if (vp) { vrele(vp); } ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdsocket.c#10 (text+ko) ==== @@ -534,11 +534,12 @@ u_int32_t minorvers, retops = 0, *retopsp = NULL, *repp; u_char tag[NFSV4_SMALLSTR + 1], *tagstr; vnode_t vp, nvp, savevp; - struct nfsrvfh fh; + struct nfsrvfh fh, savefh; mount_t mp, savemp; struct ucred *credanon; struct nfsexstuff nes, vpnes, savevpnes; static u_int64_t compref = 0; + int rootfhflag = 0, pubfhflag = 0; NFSVNO_EXINIT(&vpnes); NFSVNO_EXINIT(&savevpnes); @@ -742,7 +743,7 @@ if (nd->nd_nam != NULL) AUDIT_ARG_SOCKADDR_IN((struct sockaddr_in *)nd->nd_nam); switch (op) { - /* xxx gpf */ + /* xxx gpf dbg */ printf("op = %d\n", op); case NFSV4OP_PUTFH: error = nfsrv_mtofh(nd, &fh); @@ -770,6 +771,7 @@ } break; case NFSV4OP_PUTPUBFH: + pubfhflag = 1; if (nfs_pubfhset) { nes.nes_vfslocked = vpnes.nes_vfslocked; nfsd_fhtovp(nd, &nfs_pubfh, &nvp, @@ -791,7 +793,9 @@ } break; case NFSV4OP_PUTROOTFH: + rootfhflag = 1; if (nfs_rootfhset) { + printf("mpkha sto prwto\n"); nes.nes_vfslocked = vpnes.nes_vfslocked; nfsd_fhtovp(nd, &nfs_rootfh, &nvp, &nes, &mp, 0, p); @@ -808,6 +812,7 @@ vpnes = nes; } } else if (nfsv4root_vp && nfsv4root_set) { + printf("mpkha sto deytero\n"); if (vp) { if (vpnes.nes_vfslocked) nfsvno_unlockvfs(mp); @@ -833,8 +838,8 @@ savevp = vp; savevpnes = vpnes; savemp = mp; + NFSBCOPY(&fh, &savefh, sizeof(fh)); } - /* XXXgpf: is this the correct filehandle? */ if (savevp) { nfsrv_auditpath(savevp, NULL, NULL, (fhandle_t *)fh.nfsrvfh_data, 1); @@ -849,10 +854,9 @@ case NFSV4OP_RESTOREFH: if (savevp) { nd->nd_repstat = 0; - /* XXXgpf: file handle? */ vref(savevp); nfsrv_auditpath(savevp, NULL, NULL, - NULL, 1); + (fhandle_t *)savefh.nfsrvfh_data, 1); vn_lock(savevp, LK_EXCLUSIVE); AUDIT_ARG_VNODE1(savevp); VOP_UNLOCK(savevp, 0); @@ -877,6 +881,7 @@ vp = savevp; vpnes = savevpnes; mp = savemp; + NFSBCOPY(&savefh, &fh, sizeof(fh)); } } else { nd->nd_repstat = NFSERR_RESTOREFH; @@ -929,6 +934,8 @@ NFS_STARTWRITE(NULL, &mp); error = (*(nfsrv4_ops1[op]))(nd, isdgram, vp, &nvp, (fhandle_t *)fh.nfsrvfh_data, p, &vpnes); + nfsrv_auditpath(nvp, NULL, NULL, + (fhandle_t *)fh.nfsrvfh_data, 1); if (!error && !nd->nd_repstat) { if (vfs_statfs(mp)->f_fsid.val[0] != vfs_statfs(vnode_mount(nvp))->f_fsid.val[0] || @@ -987,9 +994,9 @@ error = (*(nfsrv4_ops2[op]))(nd, isdgram, savevp, vp, p, &savevpnes, &vpnes); if (savevp) { - if (nd->nd_procnum == NFSPROC_LINK) + if (nd->nd_procnum == NFSV4OP_LINK) nfsrv_auditpath(savevp, NULL, NULL, - (fhandle_t *)fh.nfsrvfh_data, 2); + (fhandle_t *)savefh.nfsrvfh_data, 2); vrele(savevp); } if (nfsv4_opflag[op].modifyfs) @@ -1016,8 +1023,27 @@ } break; } - error = (*(nfsrv4_ops0[op]))(nd, isdgram, vp, - p, &vpnes); + /* + * XXXgpf: + * NFSV4OP_GETFH hack so that current filehandle, with the hint stored inside, + * is returned instead of recomputing the filehandle and losing the hint. + */ + if (op == NFSV4OP_GETFH) { + fhandle_t * fhp; + + vput(vp); + if (rootfhflag) + fhp = (fhandle_t *)nfs_rootfh.nfsrvfh_data; + else if (pubfhflag) + fhp = (fhandle_t *)nfs_pubfh.nfsrvfh_data; + else + fhp = (fhandle_t *)fh.nfsrvfh_data; + (void) nfsm_fhtom(nd, (u_int8_t *)fhp, 0, 0); + error = 0; + } + else + error = (*(nfsrv4_ops0[op]))(nd, isdgram, vp, + p, &vpnes); if (nfsv4_opflag[op].modifyfs) NFS_ENDWRITE(mp); } else { ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/security/audit/audit_bsm.c#12 (text) ==== @@ -1648,11 +1648,14 @@ } break; + /* XXXgpf: temporary fallthrough for nfsv4 events */ case AUE_NFS_PUTFH: case AUE_NFS_PUTPUBFH: case AUE_NFS_PUTROOTFH: case AUE_NFS_RESTOREFH: case AUE_NFS_SAVEFH: + case AUE_NFS_OPEN: + case AUE_NFS_LOOKUPP: UPATH1_VNODE1_TOKENS; if (ARG_IS_VALID(kar, ARG_TEXT)) { tok = au_to_text(ar->ar_arg_text); @@ -1667,10 +1670,8 @@ case AUE_NFSv4_GETFH: case AUE_NFS_LOCK: case AUE_NFS_LOCKT: - case AUE_NFS_LOCKU: - case AUE_NFS_LOOKUPP: - case AUE_NFS_NVERIFY: - case AUE_NFS_OPEN: + case AUE_NFS_LOCKU: + case AUE_NFS_NVERIFY: case AUE_NFS_OPENATTR: case AUE_NFS_OPENCONFIRM: case AUE_NFS_OPENDOWNGRADE: From owner-p4-projects@FreeBSD.ORG Sat Jul 3 05:15:14 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 71E5C1065674; Sat, 3 Jul 2010 05:15:14 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D78B106566B for ; Sat, 3 Jul 2010 05:15:14 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id ECE9C8FC0A for ; Sat, 3 Jul 2010 05:15:13 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o635FDvx052346 for ; Sat, 3 Jul 2010 05:15:13 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o635FDtk052344 for perforce@freebsd.org; Sat, 3 Jul 2010 05:15:13 GMT (envelope-from afiveg@FreeBSD.org) Date: Sat, 3 Jul 2010 05:15:13 GMT Message-Id: <201007030515.o635FDtk052344@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180424 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2010 05:15:14 -0000 http://p4web.freebsd.org/@@180424?ac=10 Change 180424 by afiveg@cottonmouth on 2010/07/03 05:14:42 Multithreading for ringmap alsmost ready. Cosmetic fixes remain. Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-bpf.c#5 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-int.h#5 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#7 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#12 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82540.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82542.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_defines.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_hw.h#8 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.c#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_regs.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.c#9 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.h#7 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.c#7 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.h#5 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#20 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#18 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#19 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#17 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_e1000.h#9 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#23 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#23 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#7 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#8 edit .. //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#3 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-bpf.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-int.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#7 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#12 (text+ko) ==== @@ -131,12 +131,8 @@ return (-1); } -#if (__RINGMAP_DEB) - printf("[%s] Number of descriptors: %d \n", __func__, SLOTS_NUMBER); -#endif - if (ringmap_cdev_fd < 0){ - RINGMAP_ERROR(ringmap char device seems tgo be not open); + RINGMAP_ERROR(ringmap char device is not open); return (-1); } tmp_addr = mmap(0, sizeof(struct ring), PROT_WRITE|PROT_READ, MAP_SHARED, ringmap_cdev_fd, 0); @@ -299,13 +295,12 @@ // if (tmp_res == -1) // printf(ERR_PREFIX"[%s] Error by unmapping of statistic structure %d\n", __func__, i); //} - +out: if (ringmap_cdev_fd >= 0){ if ( close(ringmap_cdev_fd) == -1 ) perror("close()"); } -out: RINGMAP_FUNC_DEBUG(end); } @@ -337,8 +332,8 @@ again: #ifdef __RINGMAP_DEB - printf("[%s] user to kern distance = %d\n", __func__, - SW_TAIL_TO_HEAD_DIST(ring)); +// printf("[%s] user to kern distance = %d\n", __func__, + // SW_TAIL_TO_HEAD_DIST(ring)); #endif if ( RING_IS_EMPTY(ring) ) { @@ -432,10 +427,6 @@ printf("Ring-Full counter: %llu\n", p->ring->kern_wait_user); printf("Ring-Empty counter: %llu\n", p->ring->user_wait_kern); - printf("Number of interrupts: %llu\n", p->ring->interrupts_counter); - printf("Packets per Interrupt: %llu\n", - (((unsigned long long )p->ring->pkt_counter) / (p->ring->interrupts_counter))); - return (err); } ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82540.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82542.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_defines.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_hw.h#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.c#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_regs.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.c#9 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.h#7 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.c#7 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.h#5 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#20 (text+ko) ==== @@ -1389,7 +1389,7 @@ if (lem_rxeof(adapter, adapter->rx_process_limit) != 0) taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); #ifdef RINGMAP - adapter->rm->funcs->sync_head(adapter->dev, adapter->rm->ring); + adapter->rm->funcs->sync_head(adapter->dev); wakeup(adapter->rm); } @@ -3574,15 +3574,8 @@ if (accept_frame) { #ifdef RINGMAP - if (adapter->rm != NULL) { - RINGMAP_LOCK(adapter->rm); - adapter->rm->funcs->delayed_isr_per_packet(adapter->rm->ring, - i); -#ifdef __RINGMAP_DEB - PRINT_SLOT((adapter->rm->ring), (i), (adapter)); -#endif - RINGMAP_UNLOCK(adapter->rm); - } + if (adapter->rm != NULL) + adapter->rm->funcs->delayed_isr_per_packet(adapter->dev, i); #endif #ifndef RINGMAP ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#18 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#19 (text+ko) ==== @@ -27,11 +27,11 @@ int rm_8254_set_slot(struct ring *, struct adapter *, unsigned int); void rm_8254_interrupt(void *); void rm_8254_delayed_interrupt(void *); -int rm_8254_print_ring_pointers(struct adapter *); +int rm_8254_print_ring_pointers(struct adapter *, struct ring *); void rm_8254_sync_head_tail(device_t, struct ring *); void rm_8254_sync_tail(device_t, struct ring *); -void rm_8254_sync_head(device_t, struct ring *); -void rm_8254_delayed_interrupt_per_packet(struct ring *, int); +void rm_8254_sync_head(device_t); +void rm_8254_delayed_interrupt_per_packet(device_t, int); struct ring *rm_8254_alloc_ring(device_t); extern devclass_t em_devclass; @@ -41,53 +41,6 @@ -struct ring * -rm_8254_alloc_ring(device_t dev) -{ - struct ring *ring; - - /* - * Allocate memory for ring structure - * Use contigmalloc(9) to get PAGE_SIZE alignment that is needed - * for memory mapping. - */ - ring = (struct ring *) contigmalloc (sizeof(struct ring), - M_DEVBUF, M_ZERO, 0, -1L, PAGE_SIZE, 0); - if (ring == NULL) { - RINGMAP_ERROR(Can not allocate space for ring structure); - - return (NULL); - } - - - if (rm_8254_init_slots(ring, dev) == -1) { - RINGMAP_ERROR(The ring is not initialized. Device will not be opened!); - contigfree(ring, sizeof(struct ring), M_DEVBUF); - - return (NULL); - } - - return (ring); -} - -void -rm_8254_delayed_interrupt_per_packet(struct ring *ring, int slot_num) -{ - RINGMAP_INTR(start); - - if ( ring != NULL ) { - ring->cur_slot_kern = slot_num; - ring->slot[slot_num].is_ok = 1; - ring->slot[slot_num].intr_num = ring->interrupts_counter; - -#ifdef RINGMAP_TIMESTAMP - ring->slot[slot_num].ts = ring->last_ts; -#endif - } - - RINGMAP_INTR(end); -} - /* * This function synchronize the tail and head hardware registers @@ -102,7 +55,7 @@ rm_8254_sync_head_tail(device_t dev, struct ring *ring) { rm_8254_sync_tail(dev, ring); - rm_8254_sync_head(dev, ring); + rm_8254_sync_head(dev); } @@ -112,24 +65,26 @@ struct adapter *adapter; adapter = (struct adapter *)device_get_softc(dev); - RINGMAP_LOCK(adapter->rm); - if (ring != NULL) { - RINGMAP_HW_SYNC_TAIL(adapter, ring); /* SW_TAIL ==> HW_TAIL */ - } - RINGMAP_UNLOCK(adapter->rm); + RINGMAP_HW_SYNC_TAIL(adapter, ring); /* SW_TAIL ==> HW_TAIL */ } void -rm_8254_sync_head(device_t dev, struct ring *ring) +rm_8254_sync_head(device_t dev) { + struct capt_instance *ci = NULL; struct adapter *adapter; + adapter = (struct adapter *)device_get_softc(dev); RINGMAP_LOCK(adapter->rm); - if (ring != NULL) { - RINGMAP_HW_SYNC_HEAD(adapter, ring); /* SW_TAIL ==> HW_HEAD */ + + SLIST_FOREACH(ci, &adapter->rm->instance_list, next_instance) { + if (ci->ring != NULL) { + RINGMAP_HW_SYNC_HEAD(adapter, ci->ring); /* SW_TAIL ==> HW_HEAD */ + } } + RINGMAP_UNLOCK(adapter->rm); } @@ -144,33 +99,100 @@ struct adapter *adapter = (struct adapter *) arg; /* count interrupts */ - if ( (adapter->rm != NULL) && (adapter->rm->ring != NULL) && - adapter->rm->ring->td != NULL) { + if ( adapter->rm->open_cnt > 0 ) + adapter->rm->interrupts_counter++; +} + + +void +rm_8254_delayed_interrupt(void *context) +{ + struct adapter *adapter = (struct adapter *)context; + struct capt_instance *ci = NULL; + +// RINGMAP_INTR(start); - adapter->rm->ring->interrupts_counter++; + RINGMAP_LOCK(adapter->rm); + SLIST_FOREACH(ci, &adapter->rm->instance_list, next_instance) { +#ifdef __RINGMAP_DEB + printf("[%s] Ring Kernel Addr:0x%X\n", __func__, (unsigned int)ci->ring); +#endif + if (ci->ring != NULL) { + /* TODO: find the next ring */ + rm_8254_sync_tail(adapter->dev, ci->ring); +#ifdef RINGMAP_TIMESTAMP + getmicrotime(&ci->ring->last_ts); +#endif + } } + + RINGMAP_UNLOCK(adapter->rm); + +// RINGMAP_INTR(end); } void -rm_8254_delayed_interrupt(void *context) +rm_8254_delayed_interrupt_per_packet(device_t dev, int slot_num) { - struct adapter *adapter = (struct adapter *)context; + struct capt_instance *ci = NULL; + struct adapter *adapter = NULL; + struct ringmap *rm = NULL; + + adapter = (struct adapter *)device_get_softc(dev); + rm = adapter->rm; - RINGMAP_INTR(start); + //RINGMAP_INTR(start); - rm_8254_sync_tail(adapter->dev, adapter->rm->ring); + RINGMAP_LOCK(rm); + SLIST_FOREACH(ci, &rm->instance_list, next_instance) { + if ( ci->ring != NULL ) { + ci->ring->cur_slot_kern = slot_num; + ci->ring->slot[slot_num].is_ok = 1; + ci->ring->slot[slot_num].intr_num = rm->interrupts_counter; #ifdef RINGMAP_TIMESTAMP - RINGMAP_LOCK(adapter->rm); - if (adapter->rm->ring != NULL) { - getmicrotime(&adapter->rm->ring->last_ts); + ci->ring->slot[slot_num].ts = ci->ring->last_ts; +#endif + +#ifdef __RINGMAP_DEB + PRINT_SLOT((ci->ring), (slot_num), adapter); +#endif + } + } + RINGMAP_UNLOCK(rm); + + //RINGMAP_INTR(end); +} + + +struct ring * +rm_8254_alloc_ring(device_t dev) +{ + struct ring *ring; + + /* + * Allocate memory for ring structure + * Use contigmalloc(9) to get PAGE_SIZE alignment that is needed + * for memory mapping. + */ + ring = (struct ring *) contigmalloc (sizeof(struct ring), + M_DEVBUF, M_ZERO, 0, -1L, PAGE_SIZE, 0); + if (ring == NULL) { + RINGMAP_ERROR(Can not allocate space for ring structure); + + return (NULL); } - RINGMAP_UNLOCK(adapter->rm); -#endif + + if (rm_8254_init_slots(ring, dev) == -1) { + RINGMAP_ERROR(The ring is not initialized. Device will not be opened!); + contigfree(ring, sizeof(struct ring), M_DEVBUF); + + return (NULL); + } - RINGMAP_INTR(end); + return (ring); } @@ -215,6 +237,9 @@ RINGMAP_ERROR(Ring initialization failed!); return (-1); } +#if (__RINGMAP_DEB) + ringmap_print_slot(ring, slot_num); +#endif } RINGMAP_FUNC_DEBUG(end); @@ -262,9 +287,6 @@ ring->slot[slot_num].descriptor.phys = (bus_addr_t)vtophys(GET_DESCRIPTOR_P(adapter, slot_num)); -#if (__RINGMAP_DEB) - ringmap_print_slot(ring, slot_num); -#endif return (0); fail: @@ -355,7 +377,7 @@ int -rm_8254_print_ring_pointers(struct adapter *adapter) +rm_8254_print_ring_pointers(struct adapter *adapter, struct ring *ring) { unsigned int rdt, rdh; struct ringmap *rm = NULL; @@ -372,7 +394,7 @@ /* -> Critical Section: begin */ RINGMAP_LOCK(rm); - if ( (rm == NULL) || (rm->ring == NULL) ) + if ( (rm == NULL) || (ring == NULL) ) goto out; rdh = RINGMAP_HW_READ_HEAD(adapter); @@ -382,8 +404,8 @@ printf("== + HW HEAD = %d (KERN POINTER)\n", rdh); printf("== + HW TAIL = %d (USER POINTER)\n", rdt); printf("== +\n"); - printf("== + kernrp = %d \n", rm->ring->kernrp); - printf("== + userrp = %d \n", rm->ring->userrp); + printf("== + kernrp = %d \n", ring->kernrp); + printf("== + userrp = %d \n", ring->userrp); printf("== ++++++++++++++++++++++++++++++++++++++ \n\n"); out: ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#17 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_e1000.h#9 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#23 (text+ko) ==== @@ -39,6 +39,7 @@ int set_ringmap_funcs (struct ringmap *, unsigned int); void ringmap_close_cb (void *data); void ringmap_print_slot(struct ring *, unsigned int); +void clear_capt_instance(void *); struct ringmap *(*get_ringmap_p)(device_t); device_t (*get_device_p)(struct cdev *); @@ -52,8 +53,8 @@ extern void rm_8254_delayed_interrupt(void *); extern void rm_8254_sync_head_tail(device_t, struct ring *); extern void rm_8254_sync_tail(device_t, struct ring *); -extern void rm_8254_sync_head(device_t, struct ring *); -extern void rm_8254_delayed_interrupt_per_packet(struct ring *, int); +extern void rm_8254_sync_head(device_t); +extern void rm_8254_delayed_interrupt_per_packet(device_t, int); extern struct ring *rm_8254_alloc_ring(device_t); d_open_t ringmap_open; @@ -206,6 +207,9 @@ /* Store adapters device structure */ rm->dev = dev; + /* Initialize our list of capturing instances */ + SLIST_INIT(&rm->instance_list); + /* Init the mutex to protecting our data */ RINGMAP_LOCK_INIT(rm, device_get_nameunit(dev)); @@ -222,6 +226,7 @@ ringmap_detach(device_t dev) { struct ringmap *rm = NULL; + struct capt_instance *ci = NULL; RINGMAP_FUNC_DEBUG(start); @@ -231,6 +236,12 @@ return (-1); } + while (!SLIST_EMPTY(&rm->instance_list)) { + ci = SLIST_FIRST(&rm->instance_list); + SLIST_REMOVE_HEAD(&rm->instance_list, next_instance); + clear_capt_instance((void *)ci); + } + destroy_dev(rm->cdev); RINGMAP_LOCK_DESTROY(rm); @@ -238,8 +249,6 @@ contigfree(rm->funcs, sizeof(struct ringmap_functions), M_DEVBUF); contigfree(rm, sizeof(struct ringmap), M_DEVBUF); - rm = NULL; - RINGMAP_FUNC_DEBUG(end); return (0); @@ -257,6 +266,7 @@ { int err = 0; struct ringmap *rm = NULL; + struct capt_instance *ci = NULL; RINGMAP_FUNC_DEBUG(start); @@ -273,54 +283,48 @@ return (EIO); } + MALLOC(ci, struct capt_instance *, + sizeof(struct capt_instance), M_DEVBUF, (M_ZERO | M_WAITOK)); + if ( ci == NULL ){ + return (EIO); + } + /* * I think it is safe to disable interupts while we allocate * allocate memory for oure structures */ rm->funcs->disable_intr(rm->dev); - /* -> Critical Section: begin */ RINGMAP_LOCK(rm); - - if ( rm->dev == NULL ) { - RINGMAP_ERROR(Null pointer to device structure of adapter); - - err = EIO; goto out; - } /* Allocate ring */ - rm->ring = rm->funcs->alloc_ring(rm->dev); - - /* Check for any cases */ - if ( rm->ring == NULL ) { + ci->ring = rm->funcs->alloc_ring(rm->dev); + if ( ci->ring == NULL ) { RINGMAP_ERROR(Error! Please debug!); err = EIO; goto out; } - - /* Set ring fields in the initial state */ - rm->ring->kern_wait_user = 0; - rm->ring->user_wait_kern = 0; - rm->ring->interrupts_counter = 0; - rm->ring->pkt_counter = 0; - rm->ring->size = SLOTS_NUMBER; + ci->ring->size = SLOTS_NUMBER; + ci->td = td; + ci->rm = rm; - /* Store pointer to the thread */ - rm->ring->td = td; - - /* - * Currently only one process only one time can open our device !!! - */ - if (!atomic_cmpset_int(&rm->open_cnt, 0, 1)){ - RINGMAP_ERROR(Sorry! Can not open device more then one time!); - atomic_readandclear_int(&rm->open_cnt); + SLIST_INSERT_HEAD(&rm->instance_list, ci, next_instance); + if ( devfs_set_cdevpriv((void *)ci, clear_capt_instance) ) { + RINGMAP_ERROR(Ooooooooooooooohhhhhhhh !!!!!); err = EIO; goto out; } + + rm->open_cnt++; +#ifdef __RINGMAP_DEB + printf("[%s] currthread->proc->pid: %d \n", __func__, curthread->td_proc->p_pid); + printf("[%s] ci->td->proc->pid: %d\n", __func__, ci->td->td_proc->p_pid); + + printf("[%s] Ring Kernel Addr:0x%X\n", __func__, (unsigned int)ci->ring); +#endif out: RINGMAP_UNLOCK(rm); - /* -> Critical Section: end */ rm->funcs->enable_intr(rm->dev); @@ -333,32 +337,43 @@ int ringmap_close(struct cdev *cdev, int flag, int otyp, struct thread *td) { + struct capt_instance *ci = NULL; + struct capt_instance *ki = NULL; struct ringmap *rm = NULL; RINGMAP_FUNC_DEBUG(start); rm = get_ringmap_p(get_device_p(cdev)); - if (rm == NULL){ - RINGMAP_ERROR(Can not get pointer to ringmap structure); - /* TODO: Fix it! */ - return (0); - } + RINGMAP_LOCK(rm); - rm->funcs->disable_intr(rm->dev); + devfs_get_cdevpriv((void **)&ci); - atomic_readandclear_int(&rm->open_cnt); +#ifdef __RINGMAP_DEB + printf("[%s] currthread->proc->pid: %d \n", __func__, curthread->td_proc->p_pid); + printf("[%s] ci->td->proc->pid: %d\n", __func__, ci->td->td_proc->p_pid); - /* -> Critical Section: begin */ - RINGMAP_LOCK(rm); + printf("[%s] Ring Kernel Addr:0x%X\n", __func__, (unsigned int)ci->ring); +#endif +// if (ci->ring != NULL) +// contigfree(ci->ring, sizeof(struct ring), M_DEVBUF); +// ci->ring = NULL; +// +// /* Remove the capturing instance from list */ +// SLIST_REMOVE(&rm->instance_list, ci, capt_instance, next_instance); +// FREE(ci, M_DEVBUF); +// ci = NULL; +// rm->open_cnt--; - if (rm->ring != NULL) - contigfree(rm->ring, sizeof(struct ring), M_DEVBUF); + SLIST_FOREACH(ki, &rm->instance_list, next_instance) { +#ifdef __RINGMAP_DEB + printf("[%s] Aufter dealocation: ", __func__); + printf("[%s] ki->td->proc->pid: %d\n", __func__, ki->td->td_proc->p_pid); + printf("[%s] Ring Kernel Addr:0x%X\n", __func__, (unsigned int)ki->ring); +#endif + } - rm->ring = NULL; - RINGMAP_UNLOCK(rm); - /* -> Critical Section: end */ RINGMAP_FUNC_DEBUG(end); @@ -372,27 +387,16 @@ { int err = 0; struct ringmap *rm = NULL; + struct capt_instance *ci = NULL; + pid_t pid = 0; + + pid = curthread->td_proc->p_pid; RINGMAP_FUNC_DEBUG(start); /* Get pointer to the ringmap structure */ rm = get_ringmap_p(get_device_p(cdev)); - - /* Check pointers: rm and rm->ring should be allocated */ - if (rm == NULL){ - RINGMAP_ERROR(Can not get pointer to ringmap structure); - return (ENXIO); - } - - /* -> Critical Section: begin */ - RINGMAP_LOCK(rm); - - if (rm->ring == NULL){ - RINGMAP_ERROR(Can not get pointer to ring structure); - - err = ENXIO; goto out; - } - + /* Check protections */ if (nprot & PROT_EXEC) { RINGMAP_WARN("PROT_EXEC ist set"); @@ -400,11 +404,20 @@ err = ERESTART; goto out; } - *paddr = vtophys(rm->ring); + /* -> Critical Section: begin */ + RINGMAP_LOCK(rm); + + if (devfs_get_cdevpriv((void **)&ci)) { + SLIST_FOREACH(ci, &rm->instance_list, next_instance) { + if ( ci->td == curthread) + break; + } + } + + *paddr = vtophys(ci->ring); out: RINGMAP_UNLOCK(rm); - /* -> Critical Section: end */ RINGMAP_FUNC_DEBUG(end); @@ -418,18 +431,23 @@ { int err = 0, err_sleep = err_sleep; struct ringmap *ringmap = NULL; + struct capt_instance *ci; - RINGMAP_IOCTL(start); +// RINGMAP_IOCTL(start); - /* TODO: use private data to set and get ring from curr. thread */ ringmap = get_ringmap_p(get_device_p(cdev)); - if ((ringmap == NULL) || (ringmap->ring == NULL)){ + if ( ringmap == NULL ){ RINGMAP_ERROR(NULL pointer. ioctl can not be accomplished); /* TODO: look if ENODEV is a correctly for this case */ return(ENODEV); } + if ( devfs_get_cdevpriv((void **)&ci) ) { + RINGMAP_IOCTL(Error! Can not get private date!) + return (ENODEV); + } + switch( cmd ){ /* Enable Interrupts */ @@ -444,30 +462,30 @@ RINGMAP_IOCTL(interrupts schould be disabled); break; - /* Sleep and wait for new frames */ + /* Sleep and wait for new packets */ case IOCTL_SLEEP_WAIT: - RINGMAP_IOCTL(Sleep and wait for new packets); +// RINGMAP_IOCTL(Sleep and wait for new packets); - ringmap->ring->user_wait_kern++; - ringmap->funcs->sync_head_tail(get_device_p(cdev), ringmap->ring); + ci->ring->user_wait_kern++; + ringmap->funcs->sync_head_tail(ringmap->dev, ci->ring); /* * In the time: from user has called ioctl() until now could * come the new packets. It means, before we are going to sleep * it makes a sence to check if we really must do it :) */ - if (RING_IS_EMPTY(ringmap->ring)) { + if (RING_IS_EMPTY(ci->ring)) { err_sleep = tsleep(ringmap, (PRI_MIN) | PCATCH, "ioctl", 0); } break; case IOCTL_SYNC_HEAD_TAIL: - ringmap->funcs->sync_head_tail(get_device_p(cdev), ringmap->ring); + ringmap->funcs->sync_head_tail(ringmap->dev, ci->ring); break; /* Synchronize sowftware ring-tail with hardware-ring-tail (RDT) */ case IOCTL_SYNC_TAIL: - ringmap->funcs->sync_tail(get_device_p(cdev), ringmap->ring); + ringmap->funcs->sync_tail(ringmap->dev, ci->ring); break; default: @@ -475,11 +493,42 @@ return (ENODEV); } - RINGMAP_IOCTL(end); +// RINGMAP_IOCTL(end); return (err); } + +void +clear_capt_instance(void * data) +{ + struct capt_instance *ci = NULL; + + RINGMAP_FUNC_DEBUG(start); + + if ( data != NULL ) { + ci = (struct capt_instance *)data; + RINGMAP_LOCK(ci->rm); +#ifdef __RINGMAP_DEB + printf("[%s] ci->td->proc->pid: %d\n", __func__, ci->td->td_proc->p_pid); + printf("[%s] Ring Kernel Addr:0x%X\n", __func__, (unsigned int)ci->ring); +#endif + + if ( ci->ring != NULL ){ + contigfree(ci->ring, sizeof(struct ring), M_DEVBUF); + SLIST_REMOVE(&ci->rm->instance_list, ci, capt_instance, next_instance); + FREE(ci, M_DEVBUF); + data = NULL; + } + } else { + RINGMAP_FUNC_DEBUG(NULL pointer to the capturing instance!); + } + + RINGMAP_UNLOCK(ci->rm); + + RINGMAP_FUNC_DEBUG(end); +} + void ringmap_print_slot(struct ring *ring, unsigned int slot_number) { ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#23 (text+ko) ==== @@ -101,9 +101,6 @@ /* Values from adapters statistic registers */ struct address hw_stats; - /* Capturing thread */ - struct thread *td; - /* * Number of times kernel (hardware) waits for user process. More * specifically, this is the number of times that the write pointer (HEAD) @@ -120,8 +117,6 @@ */ unsigned long long user_wait_kern; - /* Counts number of hardware interrupts */ - unsigned long long interrupts_counter; /* * Slot which currently processed by driver in context of @@ -157,6 +152,16 @@ unsigned int controller_type; }; +struct capt_instance { + struct thread *td; + struct ring *ring; + struct ringmap *rm; + void *private_data; + + SLIST_ENTRY(capt_instance) next_instance; +}; + + /* * This structure will be visible only in the kernel. It contains * the pointers to the ring that should be mapped in user-space, @@ -179,8 +184,10 @@ /* Mutex that should protect the data allocated in the ring */ struct mtx ringmap_mtx; - /* Our ring that have to be mapped in space of user process */ - struct ring *ring; + SLIST_HEAD(instance_list, capt_instance) instance_list; + + /* Counts number of hardware interrupts */ + unsigned long long interrupts_counter; }; struct ringmap_functions { @@ -224,7 +231,7 @@ * should be called from this cycle, so it will be called * per packet. */ - void (*delayed_isr_per_packet)(struct ring *, int); + void (*delayed_isr_per_packet)(device_t, int); /* * Next functions synchronize the tail and head hardware registers @@ -249,7 +256,7 @@ */ void (*sync_head_tail)(device_t, struct ring *); void (*sync_tail)(device_t, struct ring *); - void (*sync_head)(device_t, struct ring *); + void (*sync_head)(device_t); /* Alloc memory for our ring and initialize the slots */ struct ring *(*alloc_ring)(device_t); ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#7 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#3 (text+ko) ==== From owner-p4-projects@FreeBSD.ORG Sat Jul 3 05:59:07 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5EE791065672; Sat, 3 Jul 2010 05:59:07 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B257106566B for ; Sat, 3 Jul 2010 05:59:07 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id EC1488FC0C for ; Sat, 3 Jul 2010 05:59:06 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o635x6xk055513 for ; Sat, 3 Jul 2010 05:59:06 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o635x6n3055511 for perforce@freebsd.org; Sat, 3 Jul 2010 05:59:06 GMT (envelope-from afiveg@FreeBSD.org) Date: Sat, 3 Jul 2010 05:59:06 GMT Message-Id: <201007030559.o635x6n3055511@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180425 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2010 05:59:07 -0000 http://p4web.freebsd.org/@@180425?ac=10 Change 180425 by afiveg@cottonmouth on 2010/07/03 05:58:58 Multithreading done! ringmap works in -current corectly! Proofed with tcpdump Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-bpf.c#6 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-int.h#6 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#8 edit .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#13 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82540.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82542.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.h#7 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_defines.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_hw.h#9 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.c#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_regs.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.c#10 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.h#8 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.c#8 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.h#6 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#21 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#19 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#20 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#18 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_e1000.h#10 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#24 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#24 edit .. //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#8 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#9 edit .. //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#4 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-bpf.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap-int.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/pcap.c#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#13 (text+ko) ==== @@ -382,7 +382,6 @@ out: SW_INCR_TAIL(ring); - ring->slot[curr_slot].is_ok = 0; ring->slot[curr_slot].filtered = 0; } ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_80003es2lan.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82540.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82541.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82542.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82543.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82571.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_82575.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_api.h#7 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_defines.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_hw.h#9 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_ich8lan.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_mac.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_manage.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_nvm.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_osdep.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.c#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_phy.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/e1000_regs.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.c#10 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_em.h#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.c#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_igb.h#6 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#21 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#19 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#20 (text+ko) ==== @@ -32,6 +32,7 @@ void rm_8254_sync_tail(device_t, struct ring *); void rm_8254_sync_head(device_t); void rm_8254_delayed_interrupt_per_packet(device_t, int); +struct ring * rm_8254_find_next(struct adapter *); struct ring *rm_8254_alloc_ring(device_t); extern devclass_t em_devclass; @@ -110,7 +111,7 @@ struct adapter *adapter = (struct adapter *)context; struct capt_instance *ci = NULL; -// RINGMAP_INTR(start); + RINGMAP_INTR(start); RINGMAP_LOCK(adapter->rm); @@ -120,7 +121,7 @@ #endif if (ci->ring != NULL) { /* TODO: find the next ring */ - rm_8254_sync_tail(adapter->dev, ci->ring); + rm_8254_sync_tail(adapter->dev, rm_8254_find_next(adapter)); #ifdef RINGMAP_TIMESTAMP getmicrotime(&ci->ring->last_ts); #endif @@ -129,9 +130,29 @@ RINGMAP_UNLOCK(adapter->rm); -// RINGMAP_INTR(end); + RINGMAP_INTR(end); } +struct ring * +rm_8254_find_next(struct adapter *adapter) +{ + unsigned int rdh, rdt, dist, min_dist = SLOTS_NUMBER; + struct ringmap *rm = adapter->rm; + struct capt_instance *ci = NULL, *min_ci = NULL; + + rdh = RINGMAP_HW_READ_HEAD(adapter); + + SLIST_FOREACH(ci, &rm->instance_list, next_instance) { + rdt = ci->ring->userrp; + dist = R_DISTANCE(rdh, rdt); + if (dist <= min_dist) { + dist = min_dist; + min_ci = ci; + } + } + + return (min_ci->ring); +} void rm_8254_delayed_interrupt_per_packet(device_t dev, int slot_num) ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#18 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_e1000.h#10 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#24 (text+ko) ==== @@ -350,28 +350,19 @@ devfs_get_cdevpriv((void **)&ci); #ifdef __RINGMAP_DEB - printf("[%s] currthread->proc->pid: %d \n", __func__, curthread->td_proc->p_pid); printf("[%s] ci->td->proc->pid: %d\n", __func__, ci->td->td_proc->p_pid); - printf("[%s] Ring Kernel Addr:0x%X\n", __func__, (unsigned int)ci->ring); #endif -// if (ci->ring != NULL) -// contigfree(ci->ring, sizeof(struct ring), M_DEVBUF); -// ci->ring = NULL; -// -// /* Remove the capturing instance from list */ -// SLIST_REMOVE(&rm->instance_list, ci, capt_instance, next_instance); -// FREE(ci, M_DEVBUF); -// ci = NULL; -// rm->open_cnt--; + + rm->open_cnt--; +#ifdef __RINGMAP_DEB SLIST_FOREACH(ki, &rm->instance_list, next_instance) { -#ifdef __RINGMAP_DEB printf("[%s] Aufter dealocation: ", __func__); printf("[%s] ki->td->proc->pid: %d\n", __func__, ki->td->td_proc->p_pid); printf("[%s] Ring Kernel Addr:0x%X\n", __func__, (unsigned int)ki->ring); + } #endif - } RINGMAP_UNLOCK(rm); @@ -433,7 +424,7 @@ struct ringmap *ringmap = NULL; struct capt_instance *ci; -// RINGMAP_IOCTL(start); + RINGMAP_IOCTL(start); ringmap = get_ringmap_p(get_device_p(cdev)); if ( ringmap == NULL ){ @@ -464,7 +455,7 @@ /* Sleep and wait for new packets */ case IOCTL_SLEEP_WAIT: -// RINGMAP_IOCTL(Sleep and wait for new packets); + RINGMAP_IOCTL(Sleep and wait for new packets); ci->ring->user_wait_kern++; ringmap->funcs->sync_head_tail(ringmap->dev, ci->ring); @@ -493,7 +484,7 @@ return (ENODEV); } -// RINGMAP_IOCTL(end); + RINGMAP_IOCTL(end); return (err); } ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#24 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/build_ringmap.sh#8 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#9 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/scripts/tailf_ringmap_msgs.sh#4 (text+ko) ==== From owner-p4-projects@FreeBSD.ORG Sat Jul 3 14:38:36 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8E8011065673; Sat, 3 Jul 2010 14:38:36 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52A67106564A for ; Sat, 3 Jul 2010 14:38:36 +0000 (UTC) (envelope-from phcoder@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 401CD8FC16 for ; Sat, 3 Jul 2010 14:38:36 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o63EcZFO024467 for ; Sat, 3 Jul 2010 14:38:35 GMT (envelope-from phcoder@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o63EcZ1J024465 for perforce@freebsd.org; Sat, 3 Jul 2010 14:38:35 GMT (envelope-from phcoder@FreeBSD.org) Date: Sat, 3 Jul 2010 14:38:35 GMT Message-Id: <201007031438.o63EcZ1J024465@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to phcoder@FreeBSD.org using -f From: Volodymyr Serbinenko To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180435 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2010 14:38:36 -0000 http://p4web.freebsd.org/@@180435?ac=10 Change 180435 by phcoder@phcoder_ on 2010/07/03 14:38:03 Fix several bonito bugs. Now OHCI seems to work correctly. Affected files ... .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/cam/cam_xpt.c#3 edit .. //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/yeeloong/bonito_pci.c#2 edit Differences ... ==== //depot/projects/soc2010/phcoder_yeeloong/src/sys/cam/cam_xpt.c#3 (text+ko) ==== @@ -806,6 +806,9 @@ return 0; } +static struct root_hold_token *xpt_rool_hold = NULL; +static int rescan_counter = 0; + static void xpt_rescan_done(struct cam_periph *periph, union ccb *done_ccb) { @@ -818,6 +821,11 @@ (*done_ccb->ccb_h.cbfcnp)(periph, done_ccb); } xpt_release_boot(); + if (atomic_fetchadd_int (&rescan_counter, -1) == 1) + { + root_mount_rel (xpt_rool_hold); + xpt_rool_hold = NULL; + } } /* thread to handle bus rescans */ @@ -851,6 +859,11 @@ { struct ccb_hdr *hdr; + if (atomic_fetchadd_int (&rescan_counter, 1) == 0) + { + xpt_rool_hold = root_mount_hold("XPT bus rescan"); + } + /* Prepare request */ if (ccb->ccb_h.path->target->target_id == CAM_TARGET_WILDCARD && ccb->ccb_h.path->device->lun_id == CAM_LUN_WILDCARD) ==== //depot/projects/soc2010/phcoder_yeeloong/src/sys/mips/yeeloong/bonito_pci.c#2 (text+ko) ==== @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include @@ -69,6 +71,7 @@ struct rman sc_mem; struct intr_event *intr_events[BONITO_NUM_INTS]; void *intr_cookie; + struct mtx config_mtx; }; #define PCI_CONF_CTRL_REG (*(volatile uint32_t *)(intptr_t)(int32_t)0xbfe00118) @@ -79,7 +82,12 @@ #define PCI_INTEN_REG (*(volatile uint32_t *)(intptr_t)(int32_t)0xbfe00138) #define PCI_INTISR_REG (*(volatile uint32_t *)(intptr_t)(int32_t)0xbfe0013c) #define PCI_CONFSPACE 0xbfe80000 -#define PCI_INT0 4 +#define PCI_INTA 4 +#define PCI_INTB 5 +#define PCI_INTC 6 +#define PCI_INTD 7 +#define HANDLED_INTERRUPTS 0xf0 + #define BONITO_IRQ 4 static void @@ -101,27 +109,16 @@ bonito_intr(void *sc_in) { struct intr_event *event; - int i, intr; + int i; struct bonito_softc *sc = sc_in; - printf ("pre: intisr=%x inten=%x\n", PCI_INTISR_REG, PCI_INTEN_REG); - - /* - * Do not handle masked interrupts. They were masked by - * pre_ithread function (mips_mask_XXX_intr) and will be - * unmasked once ithread is through with handler - */ - intr = PCI_INTISR_REG & PCI_INTEN_REG; - while ((i = fls(intr)) != 0) { + while ((i = fls(PCI_INTISR_REG & PCI_INTEN_REG & HANDLED_INTERRUPTS)) + != 0) { i--; /* Get a 0-offset interrupt. */ - intr &= ~(1 << i); PCI_INTENCLR_REG = (1 << i); PCI_INTENSET_REG = (1 << i); event = sc->intr_events[i]; - printf ("Handling Bonito int %d isr=%x en=%x\n", i, PCI_INTISR_REG, - PCI_INTEN_REG); - if (!event || TAILQ_EMPTY(&event->ie_handlers)) { printf("stray bonito interrupt %d\n", i); continue; @@ -131,10 +128,6 @@ printf("stray bonito interrupt %d\n", i); } } - - printf ("intisr=%x inten=%x\n", PCI_INTISR_REG, PCI_INTEN_REG); - - KASSERT(i == 0, ("all interrupts handled")); } static int @@ -145,6 +138,9 @@ sc = device_get_softc(dev); + mtx_init(&sc->config_mtx, "bonito_cfg", + "Bonito configuration space mutex", MTX_SPIN | MTX_QUIET); + sc->sc_irq.rm_type = RMAN_ARRAY; sc->sc_irq.rm_descr = "Bonito PCI IRQs"; error = rman_init(&sc->sc_irq); @@ -214,21 +210,32 @@ int bytes) { intptr_t addr; + uint32_t ret; + struct bonito_softc *sc; - PCI_CONF_CTRL_REG = (1 << slot); + sc = device_get_softc(dev); addr = (int32_t) (PCI_CONFSPACE | (func << 8) | (reg & ~(bytes - 1))); + mtx_lock_spin(&sc->config_mtx); + PCI_CONF_CTRL_REG = (1 << slot); + switch (bytes) { case 4: - return *((volatile uint32_t *) addr); + ret = *((volatile uint32_t *) addr); + break; case 2: - return *((volatile uint16_t *) addr); + ret = *((volatile uint16_t *) addr); + break; case 1: - return *((volatile uint8_t *) addr); + ret = *((volatile uint8_t *) addr); + break; default: - return ((uint32_t)-1); + ret = ((uint32_t)-1); + break; } + mtx_unlock_spin(&sc->config_mtx); + return ret; } static void @@ -236,24 +243,30 @@ u_int reg, uint32_t data, int bytes) { intptr_t addr; + struct bonito_softc *sc; - PCI_CONF_CTRL_REG = (1 << slot); + sc = device_get_softc(dev); addr = (int32_t) (PCI_CONFSPACE | (func << 8) | (reg & ~(bytes - 1))); + mtx_lock_spin(&sc->config_mtx); + + PCI_CONF_CTRL_REG = (1 << slot); + switch (bytes) { case 4: *((volatile uint32_t *) addr) = data; - return; + break; case 2: *((volatile uint16_t *) addr) = data; - return; + break; case 1: *((volatile uint8_t *) addr) = data; - return; + break; default: - return; + break; } + mtx_unlock_spin(&sc->config_mtx); } static struct resource * @@ -352,9 +365,7 @@ { uintptr_t irq = (uintptr_t)source; - printf ("Previous inten is %x\n", PCI_INTEN_REG); PCI_INTENSET_REG = (1 << irq); - printf ("Current inten is %x\n", PCI_INTEN_REG); } static int @@ -376,7 +387,6 @@ if (irq < 0 || irq >= BONITO_NUM_INTS) return ENXIO; -// irq += PCI_INT0; event = sc->intr_events[irq]; if (event == NULL) { error = intr_event_create(&event, (void *)(uintptr_t) irq, 0, @@ -410,7 +420,6 @@ if (irq < 0 || irq >= BONITO_NUM_INTS) return (ENXIO); - //irq += PCI_INT0; event = sc->intr_events[irq]; intr_event_remove_handler(cookie); @@ -423,7 +432,14 @@ static int bonito_route_interrupt(device_t bus, device_t child, int pin) { - return pin + PCI_INT0 - 1; + /* Some strange Yeeloong routing? */ + switch (pci_get_slot (child)) + { + case 4: + return PCI_INTD; + default: + return pin + PCI_INTA - 1; + } } From owner-p4-projects@FreeBSD.ORG Sat Jul 3 14:52:52 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 75BB01065675; Sat, 3 Jul 2010 14:52:52 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21E55106566B for ; Sat, 3 Jul 2010 14:52:52 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 0F9A28FC21 for ; Sat, 3 Jul 2010 14:52:52 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o63EqpdX025556 for ; Sat, 3 Jul 2010 14:52:51 GMT (envelope-from gpf@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o63Eqp0e025554 for perforce@freebsd.org; Sat, 3 Jul 2010 14:52:51 GMT (envelope-from gpf@FreeBSD.org) Date: Sat, 3 Jul 2010 14:52:51 GMT Message-Id: <201007031452.o63Eqp0e025554@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gpf@FreeBSD.org using -f From: Efstratios Karatzas To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180436 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jul 2010 14:52:52 -0000 http://p4web.freebsd.org/@@180436?ac=10 Change 180436 by gpf@gpf_desktop on 2010/07/03 14:52:47 - make putroofh & putpubfh actually replace the current fh - provide a cleaner/better implementation of getfh - remove an __unused marker - relocate AUDIT_NFS_EXIT() so that we auditing the final error code Affected files ... .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdserv.c#8 edit .. //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdsocket.c#11 edit Differences ... ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdserv.c#8 (text+ko) ==== @@ -2455,7 +2455,7 @@ */ APPLESTATIC int nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram, - vnode_t dp, vnode_t *vpp, __unused fhandle_t *fhp, NFSPROC_T *p, + vnode_t dp, vnode_t *vpp, fhandle_t *fhp, NFSPROC_T *p, struct nfsexstuff *exp) { u_int32_t *tl; ==== //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdsocket.c#11 (text+ko) ==== @@ -539,7 +539,6 @@ struct ucred *credanon; struct nfsexstuff nes, vpnes, savevpnes; static u_int64_t compref = 0; - int rootfhflag = 0, pubfhflag = 0; NFSVNO_EXINIT(&vpnes); NFSVNO_EXINIT(&savevpnes); @@ -771,7 +770,6 @@ } break; case NFSV4OP_PUTPUBFH: - pubfhflag = 1; if (nfs_pubfhset) { nes.nes_vfslocked = vpnes.nes_vfslocked; nfsd_fhtovp(nd, &nfs_pubfh, &nvp, @@ -790,12 +788,11 @@ (fhandle_t *)nfs_pubfh.nfsrvfh_data, 1); vrele(vp); vpnes = nes; + NFSBCOPY(&nfs_pubfh, &fh, sizeof(fh)); } break; case NFSV4OP_PUTROOTFH: - rootfhflag = 1; if (nfs_rootfhset) { - printf("mpkha sto prwto\n"); nes.nes_vfslocked = vpnes.nes_vfslocked; nfsd_fhtovp(nd, &nfs_rootfh, &nvp, &nes, &mp, 0, p); @@ -810,9 +807,9 @@ (fhandle_t *)nfs_rootfh.nfsrvfh_data, 1); vrele(vp); vpnes = nes; + NFSBCOPY(&nfs_rootfh, &fh, sizeof(fh)); } } else if (nfsv4root_vp && nfsv4root_set) { - printf("mpkha sto deytero\n"); if (vp) { if (vpnes.nes_vfslocked) nfsvno_unlockvfs(mp); @@ -823,6 +820,7 @@ NFSVNO_SETEXRDONLY(&vpnes); vpnes.nes_vfslocked = 0; mp = vnode_mount(vp); + NFSBCOPY(&nfs_rootfh, &fh, sizeof(fh)); } else { nd->nd_repstat = NFSERR_NOFILEHANDLE; } @@ -887,6 +885,21 @@ nd->nd_repstat = NFSERR_RESTOREFH; } break; + /* + * XXXgpf: + * NFSV4OP_GETFH hack so that current filehandle, with the hint stored inside, + * is returned instead of recomputing the filehandle and losing the hint. + * All NFS v4 OPs that are supposed to replace the current filehandle, now do so: + * putroofh, putpubfh, open, mknod, lookup, lookupp, putfh + */ + case NFSV4OP_GETFH: + if (vp == NULL) + error = nd->nd_repstat = NFSERR_NOFILEHANDLE; + else { + (void) nfsm_fhtom(nd, (u_int8_t *)fh.nfsrvfh_data, 0, 0); + error = nd->nd_repstat = 0; + } + break; default: /* * Allow a Lookup, Getattr, GetFH, Secinfo on an @@ -1023,27 +1036,8 @@ } break; } - /* - * XXXgpf: - * NFSV4OP_GETFH hack so that current filehandle, with the hint stored inside, - * is returned instead of recomputing the filehandle and losing the hint. - */ - if (op == NFSV4OP_GETFH) { - fhandle_t * fhp; - - vput(vp); - if (rootfhflag) - fhp = (fhandle_t *)nfs_rootfh.nfsrvfh_data; - else if (pubfhflag) - fhp = (fhandle_t *)nfs_pubfh.nfsrvfh_data; - else - fhp = (fhandle_t *)fh.nfsrvfh_data; - (void) nfsm_fhtom(nd, (u_int8_t *)fhp, 0, 0); - error = 0; - } - else - error = (*(nfsrv4_ops0[op]))(nd, isdgram, vp, - p, &vpnes); + error = (*(nfsrv4_ops0[op]))(nd, isdgram, vp, + p, &vpnes); if (nfsv4_opflag[op].modifyfs) NFS_ENDWRITE(mp); } else { @@ -1051,8 +1045,7 @@ NULL, p, &vpnes); } } - }; - AUDIT_NFS_EXIT(nd->nd_repstat, curthread); + }; if (error) { if (error == EBADRPC || error == NFSERR_BADXDR) { nd->nd_repstat = NFSERR_BADXDR; @@ -1062,6 +1055,7 @@ } error = 0; } + AUDIT_NFS_EXIT(nd->nd_repstat, curthread); retops++; if (nd->nd_repstat) { *repp = nfsd_errmap(nd);