Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*


 567         /*
 568          * The following (re)configuration events are common code
 569          * initiated. lgrp_plat_config() is called here to inform the
 570          * platform of the reconfiguration event.
 571          */
 572         case LGRP_CONFIG_CPU_ADD:
 573                 cp = (cpu_t *)resource;
 574 
 575                 /*
 576                  * Initialize the new CPU's lgrp related next/prev
 577                  * links, and give it a bootstrap lpl so that it can
 578                  * survive should it need to enter the dispatcher.
 579                  */
 580                 cp->cpu_next_lpl = cp;
 581                 cp->cpu_prev_lpl = cp;
 582                 cp->cpu_next_lgrp = cp;
 583                 cp->cpu_prev_lgrp = cp;
 584                 cp->cpu_lpl = lpl_bootstrap;
 585 
 586                 lgrp_plat_config(event, resource);
 587                 atomic_add_32(&lgrp_gen, 1);
 588 
 589                 break;
 590         case LGRP_CONFIG_CPU_DEL:
 591                 lgrp_plat_config(event, resource);
 592                 atomic_add_32(&lgrp_gen, 1);
 593 
 594                 break;
 595         case LGRP_CONFIG_CPU_ONLINE:
 596                 cp = (cpu_t *)resource;
 597                 lgrp_cpu_init(cp);
 598                 lgrp_part_add_cpu(cp, cp->cpu_lpl->lpl_lgrpid);
 599                 rc = lpl_topo_verify(cp->cpu_part);
 600                 if (rc != LPL_TOPO_CORRECT) {
 601                         panic("lpl_topo_verify failed: %d", rc);
 602                 }
 603                 lgrp_plat_config(event, resource);
 604                 atomic_add_32(&lgrp_gen, 1);
 605 
 606                 break;
 607         case LGRP_CONFIG_CPU_OFFLINE:
 608                 cp = (cpu_t *)resource;
 609                 id = cp->cpu_lpl->lpl_lgrpid;
 610                 lgrp_part_del_cpu(cp);
 611                 lgrp_cpu_fini(cp, id);
 612                 rc = lpl_topo_verify(cp->cpu_part);
 613                 if (rc != LPL_TOPO_CORRECT) {
 614                         panic("lpl_topo_verify failed: %d", rc);
 615                 }
 616                 lgrp_plat_config(event, resource);
 617                 atomic_add_32(&lgrp_gen, 1);
 618 
 619                 break;
 620         case LGRP_CONFIG_CPUPART_ADD:
 621                 cp = (cpu_t *)resource;
 622                 lgrp_part_add_cpu((cpu_t *)resource, (lgrp_id_t)where);
 623                 rc = lpl_topo_verify(cp->cpu_part);
 624                 if (rc != LPL_TOPO_CORRECT) {
 625                         panic("lpl_topo_verify failed: %d", rc);
 626                 }
 627                 lgrp_plat_config(event, resource);
 628 
 629                 break;
 630         case LGRP_CONFIG_CPUPART_DEL:
 631                 cp = (cpu_t *)resource;
 632                 lgrp_part_del_cpu((cpu_t *)resource);
 633                 rc = lpl_topo_verify(cp->cpu_part);
 634                 if (rc != LPL_TOPO_CORRECT) {
 635                         panic("lpl_topo_verify failed: %d", rc);
 636                 }
 637                 lgrp_plat_config(event, resource);
 638 
 639                 break;
 640         /*
 641          * The following events are initiated by the memnode
 642          * subsystem.
 643          */
 644         case LGRP_CONFIG_MEM_ADD:
 645                 lgrp_mem_init((int)resource, where, B_FALSE);
 646                 atomic_add_32(&lgrp_gen, 1);
 647 
 648                 break;
 649         case LGRP_CONFIG_MEM_DEL:
 650                 lgrp_mem_fini((int)resource, where, B_FALSE);
 651                 atomic_add_32(&lgrp_gen, 1);
 652 
 653                 break;
 654         case LGRP_CONFIG_MEM_RENAME: {
 655                 lgrp_config_mem_rename_t *ren_arg =
 656                     (lgrp_config_mem_rename_t *)where;
 657 
 658                 lgrp_mem_rename((int)resource,
 659                     ren_arg->lmem_rename_from,
 660                     ren_arg->lmem_rename_to);
 661                 atomic_add_32(&lgrp_gen, 1);
 662 
 663                 break;
 664         }
 665         case LGRP_CONFIG_GEN_UPDATE:
 666                 atomic_add_32(&lgrp_gen, 1);
 667 
 668                 break;
 669         case LGRP_CONFIG_FLATTEN:
 670                 if (where == 0)
 671                         lgrp_topo_levels = (int)resource;
 672                 else
 673                         (void) lgrp_topo_flatten(resource,
 674                             lgrp_table, lgrp_alloc_max, &changed);
 675 
 676                 break;
 677         /*
 678          * Update any lgroups with old latency to new latency
 679          */
 680         case LGRP_CONFIG_LAT_CHANGE_ALL:
 681                 lgrp_latency_change(LGRP_NULL_HANDLE, (u_longlong_t)resource,
 682                     (u_longlong_t)where);
 683 
 684                 break;
 685         /*
 686          * Update lgroup with specified lgroup platform handle to have




 567         /*
 568          * The following (re)configuration events are common code
 569          * initiated. lgrp_plat_config() is called here to inform the
 570          * platform of the reconfiguration event.
 571          */
 572         case LGRP_CONFIG_CPU_ADD:
 573                 cp = (cpu_t *)resource;
 574 
 575                 /*
 576                  * Initialize the new CPU's lgrp related next/prev
 577                  * links, and give it a bootstrap lpl so that it can
 578                  * survive should it need to enter the dispatcher.
 579                  */
 580                 cp->cpu_next_lpl = cp;
 581                 cp->cpu_prev_lpl = cp;
 582                 cp->cpu_next_lgrp = cp;
 583                 cp->cpu_prev_lgrp = cp;
 584                 cp->cpu_lpl = lpl_bootstrap;
 585 
 586                 lgrp_plat_config(event, resource);
 587                 atomic_inc_32(&lgrp_gen);
 588 
 589                 break;
 590         case LGRP_CONFIG_CPU_DEL:
 591                 lgrp_plat_config(event, resource);
 592                 atomic_inc_32(&lgrp_gen);
 593 
 594                 break;
 595         case LGRP_CONFIG_CPU_ONLINE:
 596                 cp = (cpu_t *)resource;
 597                 lgrp_cpu_init(cp);
 598                 lgrp_part_add_cpu(cp, cp->cpu_lpl->lpl_lgrpid);
 599                 rc = lpl_topo_verify(cp->cpu_part);
 600                 if (rc != LPL_TOPO_CORRECT) {
 601                         panic("lpl_topo_verify failed: %d", rc);
 602                 }
 603                 lgrp_plat_config(event, resource);
 604                 atomic_inc_32(&lgrp_gen);
 605 
 606                 break;
 607         case LGRP_CONFIG_CPU_OFFLINE:
 608                 cp = (cpu_t *)resource;
 609                 id = cp->cpu_lpl->lpl_lgrpid;
 610                 lgrp_part_del_cpu(cp);
 611                 lgrp_cpu_fini(cp, id);
 612                 rc = lpl_topo_verify(cp->cpu_part);
 613                 if (rc != LPL_TOPO_CORRECT) {
 614                         panic("lpl_topo_verify failed: %d", rc);
 615                 }
 616                 lgrp_plat_config(event, resource);
 617                 atomic_inc_32(&lgrp_gen);
 618 
 619                 break;
 620         case LGRP_CONFIG_CPUPART_ADD:
 621                 cp = (cpu_t *)resource;
 622                 lgrp_part_add_cpu((cpu_t *)resource, (lgrp_id_t)where);
 623                 rc = lpl_topo_verify(cp->cpu_part);
 624                 if (rc != LPL_TOPO_CORRECT) {
 625                         panic("lpl_topo_verify failed: %d", rc);
 626                 }
 627                 lgrp_plat_config(event, resource);
 628 
 629                 break;
 630         case LGRP_CONFIG_CPUPART_DEL:
 631                 cp = (cpu_t *)resource;
 632                 lgrp_part_del_cpu((cpu_t *)resource);
 633                 rc = lpl_topo_verify(cp->cpu_part);
 634                 if (rc != LPL_TOPO_CORRECT) {
 635                         panic("lpl_topo_verify failed: %d", rc);
 636                 }
 637                 lgrp_plat_config(event, resource);
 638 
 639                 break;
 640         /*
 641          * The following events are initiated by the memnode
 642          * subsystem.
 643          */
 644         case LGRP_CONFIG_MEM_ADD:
 645                 lgrp_mem_init((int)resource, where, B_FALSE);
 646                 atomic_inc_32(&lgrp_gen);
 647 
 648                 break;
 649         case LGRP_CONFIG_MEM_DEL:
 650                 lgrp_mem_fini((int)resource, where, B_FALSE);
 651                 atomic_inc_32(&lgrp_gen);
 652 
 653                 break;
 654         case LGRP_CONFIG_MEM_RENAME: {
 655                 lgrp_config_mem_rename_t *ren_arg =
 656                     (lgrp_config_mem_rename_t *)where;
 657 
 658                 lgrp_mem_rename((int)resource,
 659                     ren_arg->lmem_rename_from,
 660                     ren_arg->lmem_rename_to);
 661                 atomic_inc_32(&lgrp_gen);
 662 
 663                 break;
 664         }
 665         case LGRP_CONFIG_GEN_UPDATE:
 666                 atomic_inc_32(&lgrp_gen);
 667 
 668                 break;
 669         case LGRP_CONFIG_FLATTEN:
 670                 if (where == 0)
 671                         lgrp_topo_levels = (int)resource;
 672                 else
 673                         (void) lgrp_topo_flatten(resource,
 674                             lgrp_table, lgrp_alloc_max, &changed);
 675 
 676                 break;
 677         /*
 678          * Update any lgroups with old latency to new latency
 679          */
 680         case LGRP_CONFIG_LAT_CHANGE_ALL:
 681                 lgrp_latency_change(LGRP_NULL_HANDLE, (u_longlong_t)resource,
 682                     (u_longlong_t)where);
 683 
 684                 break;
 685         /*
 686          * Update lgroup with specified lgroup platform handle to have