rdtgroup.c (b045c215866393419fb960432ed6be69a0113ee1) | rdtgroup.c (781096d971dfe3c5f9401a300bdb0b148a600584) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * User interface for Resource Allocation in Resource Director Technology(RDT) 4 * 5 * Copyright (C) 2016 Intel Corporation 6 * 7 * Author: Fenghua Yu <fenghua.yu@intel.com> 8 * --- 1875 unchanged lines hidden (view full) --- 1884 1885 if (r->rid == RDT_RESOURCE_L2) 1886 l2_qos_cfg_update(&hw_res->cdp_enabled); 1887 1888 if (r->rid == RDT_RESOURCE_L3) 1889 l3_qos_cfg_update(&hw_res->cdp_enabled); 1890} 1891 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * User interface for Resource Allocation in Resource Director Technology(RDT) 4 * 5 * Copyright (C) 2016 Intel Corporation 6 * 7 * Author: Fenghua Yu <fenghua.yu@intel.com> 8 * --- 1875 unchanged lines hidden (view full) --- 1884 1885 if (r->rid == RDT_RESOURCE_L2) 1886 l2_qos_cfg_update(&hw_res->cdp_enabled); 1887 1888 if (r->rid == RDT_RESOURCE_L3) 1889 l3_qos_cfg_update(&hw_res->cdp_enabled); 1890} 1891 |
1892static int mba_sc_domain_allocate(struct rdt_resource *r, struct rdt_domain *d) 1893{ 1894 u32 num_closid = resctrl_arch_get_num_closid(r); 1895 int cpu = cpumask_any(&d->cpu_mask); 1896 int i; 1897 1898 d->mbps_val = kcalloc_node(num_closid, sizeof(*d->mbps_val), 1899 GFP_KERNEL, cpu_to_node(cpu)); 1900 if (!d->mbps_val) 1901 return -ENOMEM; 1902 1903 for (i = 0; i < num_closid; i++) 1904 d->mbps_val[i] = MBA_MAX_MBPS; 1905 1906 return 0; 1907} 1908 1909static void mba_sc_domain_destroy(struct rdt_resource *r, 1910 struct rdt_domain *d) 1911{ 1912 kfree(d->mbps_val); 1913 d->mbps_val = NULL; 1914} 1915 |
|
1892/* 1893 * MBA software controller is supported only if 1894 * MBM is supported and MBA is in linear scale. 1895 */ 1896static bool supports_mba_mbps(void) 1897{ 1898 struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl; 1899 1900 return (is_mbm_local_enabled() && 1901 r->alloc_capable && is_mba_linear()); 1902} 1903 1904/* 1905 * Enable or disable the MBA software controller 1906 * which helps user specify bandwidth in MBps. 1907 */ 1908static int set_mba_sc(bool mba_sc) 1909{ 1910 struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl; | 1916/* 1917 * MBA software controller is supported only if 1918 * MBM is supported and MBA is in linear scale. 1919 */ 1920static bool supports_mba_mbps(void) 1921{ 1922 struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl; 1923 1924 return (is_mbm_local_enabled() && 1925 r->alloc_capable && is_mba_linear()); 1926} 1927 1928/* 1929 * Enable or disable the MBA software controller 1930 * which helps user specify bandwidth in MBps. 1931 */ 1932static int set_mba_sc(bool mba_sc) 1933{ 1934 struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl; |
1935 u32 num_closid = resctrl_arch_get_num_closid(r); 1936 struct rdt_domain *d; 1937 int i; |
|
1911 1912 if (!supports_mba_mbps() || mba_sc == is_mba_sc(r)) 1913 return -EINVAL; 1914 1915 r->membw.mba_sc = mba_sc; 1916 | 1938 1939 if (!supports_mba_mbps() || mba_sc == is_mba_sc(r)) 1940 return -EINVAL; 1941 1942 r->membw.mba_sc = mba_sc; 1943 |
1944 list_for_each_entry(d, &r->domains, list) { 1945 for (i = 0; i < num_closid; i++) 1946 d->mbps_val[i] = MBA_MAX_MBPS; 1947 } 1948 |
|
1917 return 0; 1918} 1919 1920static int cdp_enable(int level) 1921{ 1922 struct rdt_resource *r_l = &rdt_resources_all[level].r_resctrl; 1923 int ret; 1924 --- 1317 unchanged lines hidden (view full) --- 3242 kfree(d->mbm_total); 3243 kfree(d->mbm_local); 3244} 3245 3246void resctrl_offline_domain(struct rdt_resource *r, struct rdt_domain *d) 3247{ 3248 lockdep_assert_held(&rdtgroup_mutex); 3249 | 1949 return 0; 1950} 1951 1952static int cdp_enable(int level) 1953{ 1954 struct rdt_resource *r_l = &rdt_resources_all[level].r_resctrl; 1955 int ret; 1956 --- 1317 unchanged lines hidden (view full) --- 3274 kfree(d->mbm_total); 3275 kfree(d->mbm_local); 3276} 3277 3278void resctrl_offline_domain(struct rdt_resource *r, struct rdt_domain *d) 3279{ 3280 lockdep_assert_held(&rdtgroup_mutex); 3281 |
3282 if (supports_mba_mbps() && r->rid == RDT_RESOURCE_MBA) 3283 mba_sc_domain_destroy(r, d); 3284 |
|
3250 if (!r->mon_capable) 3251 return; 3252 3253 /* 3254 * If resctrl is mounted, remove all the 3255 * per domain monitor data directories. 3256 */ 3257 if (static_branch_unlikely(&rdt_mon_enable_key)) --- 48 unchanged lines hidden (view full) --- 3306} 3307 3308int resctrl_online_domain(struct rdt_resource *r, struct rdt_domain *d) 3309{ 3310 int err; 3311 3312 lockdep_assert_held(&rdtgroup_mutex); 3313 | 3285 if (!r->mon_capable) 3286 return; 3287 3288 /* 3289 * If resctrl is mounted, remove all the 3290 * per domain monitor data directories. 3291 */ 3292 if (static_branch_unlikely(&rdt_mon_enable_key)) --- 48 unchanged lines hidden (view full) --- 3341} 3342 3343int resctrl_online_domain(struct rdt_resource *r, struct rdt_domain *d) 3344{ 3345 int err; 3346 3347 lockdep_assert_held(&rdtgroup_mutex); 3348 |
3349 if (supports_mba_mbps() && r->rid == RDT_RESOURCE_MBA) 3350 /* RDT_RESOURCE_MBA is never mon_capable */ 3351 return mba_sc_domain_allocate(r, d); 3352 |
|
3314 if (!r->mon_capable) 3315 return 0; 3316 3317 err = domain_setup_mon_state(r, d); 3318 if (err) 3319 return err; 3320 3321 if (is_mbm_enabled()) { --- 81 unchanged lines hidden --- | 3353 if (!r->mon_capable) 3354 return 0; 3355 3356 err = domain_setup_mon_state(r, d); 3357 if (err) 3358 return err; 3359 3360 if (is_mbm_enabled()) { --- 81 unchanged lines hidden --- |