-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DAOS-14408 common: enable NDCTL for DCPM #14371
base: master
Are you sure you want to change the base?
Changes from 17 commits
ee6d615
f74f025
ceccaca
12bed56
44c0346
9598f9a
fc2c933
1f3f723
a9a4a5c
8f6e286
884f96d
5ec658a
2ca8e35
4528923
648d374
0976c04
dfb9bf0
c1dba55
d6fd878
a9a12d5
118ad26
a33e5c0
f8c108b
bcdced7
193f4e6
560d9de
3212708
f2a865e
5d4aaf2
9815445
8bd6325
cc7000b
e80ae21
1ace438
05efd1e
6e07425
dbb626b
6dd7d34
16c0519
ec653de
b0842ed
cf26dd1
8297d37
da701b4
23f52e6
83123e2
88d5087
913b030
ac3193a
4c5ed9d
eea85fb
ee99bf5
bd9100f
48f6285
4f90e7a
f4c187d
8f8d846
c9f0c11
e701bb8
e52972b
e433d4c
9175174
82e9e92
bc08b29
0565522
c6f4853
817c616
e444b1f
8d7da45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,8 +129,14 @@ func mockConfigFromFile(t *testing.T, path string) (*Server, error) { | |
t.Helper() | ||
c := DefaultServer() | ||
c.Path = path | ||
err := c.Load() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding env specific code here is a bad smell, we are doing something wrong if we have to do that. Maybe we can make it work nicer by creating config parameters for these variables? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an internal logic specific to PMDK w/ NDCTL. We do not need any parameters, as everything can be derived from the existing configuration. It is a permanent change for PMDK started from version 2.1.0-2 (daos-stack/pmdk#38). We do not want to bother the end-user with something that can be done automatically. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change is fully transparent from an end-user perspective. No changes in configuration and no changes in behavior except additional NDCTL operations in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the explanation, whilst the above highlighted change is a workaround that looks out of scope in the test code, it is only test code so I think it's okay. |
||
if err == nil { | ||
for i := 0; i < len(c.Engines); i++ { | ||
c.Engines[i] = c.Engines[i].WithSDSForRam().WithStackSizeForDCPM() | ||
} | ||
} | ||
|
||
return c, c.Load() | ||
return c, err | ||
} | ||
|
||
func TestServerConfig_MarshalUnmarshal(t *testing.T) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ package engine | |
import ( | ||
"fmt" | ||
"os" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/pkg/errors" | ||
|
@@ -28,6 +29,8 @@ const ( | |
envLogMasks = "D_LOG_MASK" | ||
envLogDbgStreams = "DD_MASK" | ||
envLogSubsystems = "DD_SUBSYS" | ||
|
||
MIN_ABT_THREAD_STACKSIZE_FOR_DCPM = 18432 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. go variable names, even Constants should be of the form minAbtThreadStackSizeDcpm or minABTThreadStackSizeDCPM There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
) | ||
|
||
// FabricConfig encapsulates networking fabric configuration. | ||
|
@@ -343,6 +346,41 @@ func (c *Config) Validate() error { | |
return errors.Wrap(err, "validate engine log subsystems") | ||
} | ||
|
||
// Ensure proper environment variables for PMDK w/ NDCTL enabled. | ||
pmemobj_conf_str, pmemobj_conf_err := c.GetEnvVar("PMEMOBJ_CONF") | ||
if c.Storage.Tiers[0].Class == storage.ClassDcpm { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be great to have new unit test cases for this new block of logic. I see a few cases here:
It may be easiest to test by breaking the if-block out into a helper function and writing tests for that, rather than updating an existing unit test to check whether the Config was updated. Either way would be acceptable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So far all existing tests have been updated. |
||
// Ensure 18KiB ABT stack size for an engine with DCPM storage class. | ||
stacksize_str, err := c.GetEnvVar("ABT_THREAD_STACKSIZE") | ||
if err != nil { | ||
fmt.Printf("env_var ABT_THREAD_STACKSIZE set to %d for `dcpm` storage class\n", | ||
MIN_ABT_THREAD_STACKSIZE_FOR_DCPM) | ||
c.EnvVars = append(c.EnvVars, fmt.Sprintf("ABT_THREAD_STACKSIZE=%d", | ||
MIN_ABT_THREAD_STACKSIZE_FOR_DCPM)) | ||
} else { | ||
stacksize_value, err := strconv.Atoi(stacksize_str) | ||
if err != nil || stacksize_value < MIN_ABT_THREAD_STACKSIZE_FOR_DCPM { | ||
return errors.New(fmt.Sprintf("env_var ABT_THREAD_STACKSIZE should be >= %d for `dcpm` storage class", | ||
MIN_ABT_THREAD_STACKSIZE_FOR_DCPM)) | ||
} | ||
} | ||
// Ensure default handling of shutdown state (SDS) for DCPM storage class. | ||
if pmemobj_conf_err != nil && strings.Contains(pmemobj_conf_str, "sds.at_create") { | ||
return errors.New("env_var PMEMOBJ_CONF should NOT be set to sds.at_create=? for non-`dcpm` storage class") | ||
} | ||
} else { | ||
grom72 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Disable shutdown state (SDS) (part of RAS) for RAM-based simulated SCM. | ||
// RAM doesn't support this feature and trying to use | ||
// it will fail the create/open operations. | ||
if pmemobj_conf_err != nil { | ||
fmt.Printf("env_var PMEMOBJ_CONF set to sds.at_create=0 for non-`dcpm` storage class\n") | ||
c.EnvVars = append(c.EnvVars, "PMEMOBJ_CONF=sds.at_create=0") | ||
} else if strings.Contains(pmemobj_conf_str, "sds.at_create") { | ||
if strings.Contains(pmemobj_conf_str, "sds.at_create=1") { | ||
return errors.New("env_var PMEMOBJ_CONF should be set to sds.at_create=0 for non-`dcpm` storage class") | ||
} | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
|
@@ -480,7 +518,7 @@ func (c *Config) WithSystemName(name string) *Config { | |
func (c *Config) WithStorage(cfgs ...*storage.TierConfig) *Config { | ||
c.Storage.Tiers = storage.TierConfigs{} | ||
c.AppendStorage(cfgs...) | ||
return c | ||
return c.WithStackSizeForDCPM().WithSDSForRam() | ||
} | ||
|
||
// AppendStorage appends the given storage tier configurations to | ||
|
@@ -690,3 +728,17 @@ func (c *Config) WithStorageIndex(i uint32) *Config { | |
c.Storage.EngineIdx = uint(i) | ||
return c | ||
} | ||
|
||
func (c *Config) WithStackSizeForDCPM() *Config { | ||
if len(c.Storage.Tiers) > 0 && c.Storage.Tiers[0].Class == storage.ClassDcpm { | ||
c.EnvVars = append(c.EnvVars, fmt.Sprintf("ABT_THREAD_STACKSIZE=%d", MIN_ABT_THREAD_STACKSIZE_FOR_DCPM)) | ||
} | ||
return c | ||
} | ||
|
||
func (c *Config) WithSDSForRam() *Config { | ||
if len(c.Storage.Tiers) > 0 && c.Storage.Tiers[0].Class != storage.ClassDcpm { | ||
c.EnvVars = append(c.EnvVars, "PMEMOBJ_CONF=sds.at_create=0") | ||
} | ||
return c | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1180,7 +1180,7 @@ ds_mgmt_hdlr_tgt_create(crt_rpc_t *tc_req) | |
/* A zero size accommodates the existing file */ | ||
vpa.vpa_scm_size = 0; | ||
vpa.vpa_nvme_size = tc_in->tc_nvme_size / dss_tgt_nr; | ||
rc = dss_thread_collective(tgt_vos_create_one, &vpa, 0); | ||
rc = dss_thread_collective(tgt_vos_create_one, &vpa, DSS_ULT_DEEP_STACK); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change should probably be reviewed by someone familiar with the repercussions on the engine side. Maybe @NiuYawei ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looks fine. It just uses deeper stack by default for creating the vos target. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we've already used deep stack size for regular pool open/create ULTs in other places, this is a missed case. |
||
if (rc) { | ||
D_ERROR(DF_UUID": thread collective tgt_vos_create_one failed, "DF_RC"\n", | ||
DP_UUID(tc_in->tc_pool_uuid), DP_RC(rc)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should not be including this in the output of config gen considering we handle it automatically on reading back the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We compare raw
expOut
not config structure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to have
- ABT_THREAD_STACKSIZE=18432
explicitly listed rather than making some tricks with reverting changes that are common for all configurations.