pstore: Fix warning in pstore_kill_sb()
Subsystems (2)
Sasha Levin
maintainerPATCH 1/8 pstore: Fix warning in pstore_kill_sb()
From: Tetsuo Handa <[email protected]>
[ Upstream commit 9c7d83ae6ba67d6c6199cce24573983db3b56332 ]
syzbot is hitting WARN_ON(pstore_sb != sb) at pstore_kill_sb() [1], for the assumption that pstore_sb != NULL is wrong because pstore_fill_super() will not assign pstore_sb = sb when new_inode() for d_make_root() returned NULL (due to memory allocation fault injection).
Since mount_single() calls pstore_kill_sb() when pstore_fill_super() failed, pstore_kill_sb() needs to be aware of such failure path.
[1] https://syzkaller.appspot.com/bug?id=6abacb8da5137cb47a416f2bef95719ed60508a0
--- fs/pstore/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/pstore/inode.c +1 -1
@@ -467,7 +467,7 @@ static struct dentry *pstore_mount(struct file_system_type *fs_type,static void pstore_kill_sb (struct super_block *sb) {mutex_lock (&pstore_sb_lock); -WARN_ON (pstore_sb != sb); +WARN_ON (pstore_sb && pstore_sb != sb);kill_litter_super (sb); pstore_sb =NULL ;
Signature · 1 line
2.30.1
Sasha Levin
maintainerPATCH 2/8 pstore/ram: Rate-limit "uncorrectable error in header" message
From: Dmitry Osipenko <[email protected]>
[ Upstream commit 7db688e99c0f770ae73e0f1f3fb67f9b64266445 ]
There is a quite huge "uncorrectable error in header" flood in KMSG on a clean system boot since there is no pstore buffer saved in RAM. Let's silence the redundant noisy messages by rate-limiting the printk message. Now there are maximum 10 messages printed repeatedly instead of 35+.
--- fs/pstore/ram_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/pstore/ram_core.c +1 -1
@@ -246,7 +246,7 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz,pr_info ("error in header, %d\n" , numerr); prz->corrected_bytes += numerr; }else if (numerr <0 ) { -pr_info ("uncorrectable error in header\n" ); +pr_info_ratelimited ("uncorrectable error in header\n" ); prz->bad_blocks++; }
Signature · 1 line
2.30.1
Sasha Levin
maintainerPATCH 3/8 drm/amdgpu: enable BACO runpm by default on sienna cichlid and navy flounder
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit 25951362db7b3791488ec45bf56c0043f107b94b ]
It works fine and was only disabled because primary GPUs don't enter runpm if there is a console bound to the fbdev due to the kmap. This will at least allow runpm on secondary cards.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -2
@@ -169,8 +169,6 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)#endif case CHIP_VEGA20 :case CHIP_ARCTURUS : -case CHIP_SIENNA_CICHLID : -case CHIP_NAVY_FLOUNDER :/* enable runpm if runpm=1 */ if (amdgpu_runtime_pm >0 ) adev->runpm = true;
Signature · 6 lines
2.30.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 4/8 tracing: Skip selftests if tracing is disabled
In reply to Sasha LevinFrom: "Steven Rostedt (VMware)" <[email protected]>
[ Upstream commit ee666a185558ac9a929e53b902a568442ed62416 ]
If tracing is disabled for some reason (traceoff_on_warning, command line, etc), the ftrace selftests are guaranteed to fail, as their results are defined by trace data in the ring buffers. If the ring buffers are turned off, the tests will fail, due to lack of data.
Because tracing being disabled is for a specific reason (warning, user decided to, etc), it does not make sense to enable tracing to run the self tests, as the test output may corrupt the reason for the tracing to be disabled.
Instead, simply skip the self tests and report that they are being skipped due to tracing being disabled.
--- kernel/trace/trace.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/trace/trace.c +6 -0
@@ -1932,6 +1932,12 @@ static int run_tracer_selftest(struct tracer *type)if (!selftests_can_run)return save_selftest (type); +if (!tracing_is_on ()) { +pr_warn ("Selftest for tracer %s skipped due to tracing disabled\n" , + type->name); +return 0 ; + } +/* * Run a selftest on this tracer. * Here we reset the trace buffer, and set the current
Signature · 1 line
2.30.1
Sasha Levin
maintainerPATCH 5/8 nvme-pci: mark Seagate Nytro XM1440 as QUIRK_NO_NS_DESC_LIST.
In reply to Sasha LevinFrom: Julian Einwag <[email protected]>
[ Upstream commit 5e112d3fb89703a4981ded60561b5647db3693bf ]
The kernel fails to fully detect these SSDs, only the character devices are present:
[ 10.785605] nvme nvme0: pci function 0000:04:00.0 [ 10.876787] nvme nvme1: pci function 0000:81:00.0 [ 13.198614] nvme nvme0: missing or invalid SUBNQN field. [ 13.198658] nvme nvme1: missing or invalid SUBNQN field. [ 13.206896] nvme nvme0: Shutdown timeout set to 20 seconds [ 13.215035] nvme nvme1: Shutdown timeout set to 20 seconds [ 13.225407] nvme nvme0: 16/0/0 default/read/poll queues [ 13.233602] nvme nvme1: 16/0/0 default/read/poll queues [ 13.239627] nvme nvme0: Identify Descriptors failed (8194) [ 13.246315] nvme nvme1: Identify Descriptors failed (8194)
Adding the NVME_QUIRK_NO_NS_DESC_LIST fixes this problem.
--- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +2 -1
@@ -3235,7 +3235,8 @@ static const struct pci_device_id nvme_id_table[] = { { PCI_DEVICE(0x126f, 0x2263), /* Silicon Motion unidentified */ .driver_data = NVME_QUIRK_NO_NS_DESC_LIST, }, { PCI_DEVICE(0x1bb1, 0x0100), /* Seagate Nytro Flash Storage */ - .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, + .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY | + NVME_QUIRK_NO_NS_DESC_LIST, }, { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, { PCI_DEVICE(0x1c58, 0x0023), /* WDC SN200 adapter */
Signature · 1 line
2.30.1
Sasha Levin
maintainerPATCH 6/8 nvme-pci: add quirks for Lexar 256GB SSD
In reply to Sasha LevinFrom: Pascal Terjan <[email protected]>
[ Upstream commit 6e6a6828c517fb6819479bf5187df5f39084eb9e ]
Add the NVME_QUIRK_NO_NS_DESC_LIST and NVME_QUIRK_IGNORE_DEV_SUBNQN quirks for this buggy device.
Reported and tested in https://bugs.mageia.org/show_bug.cgi?id=28417
--- drivers/nvme/host/pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvme/host/pci.c +3 -0
@@ -3250,6 +3250,9 @@ static const struct pci_device_id nvme_id_table[] = { NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */ .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, }, + { PCI_DEVICE(0x1b4b, 0x1092), /* Lexar 256 GB SSD */ + .driver_data = NVME_QUIRK_NO_NS_DESC_LIST | + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_DEVICE(0x1d1d, 0x1f1f), /* LighNVM qemu device */ .driver_data = NVME_QUIRK_LIGHTNVM, }, { PCI_DEVICE(0x1d1d, 0x2807), /* CNEX WL */
Signature · 1 line
2.30.1
Sasha Levin
maintainerPATCH 7/8 nvme-fabrics: fix kato initialization
In reply to Sasha LevinFrom: Martin George <[email protected]>
[ Upstream commit 32feb6de47242e54692eceab52cfae8616aa0518 ]
Currently kato is initialized to NVME_DEFAULT_KATO for both discovery & i/o controllers. This is a problem specifically for non-persistent discovery controllers since it always ends up with a non-zero kato value. Fix this by initializing kato to zero instead, and ensuring various controllers are assigned appropriate kato values as follows:
non-persistent controllers - kato set to zero
persistent controllers - kato set to NVMF_DEV_DISC_TMO
(or any positive int via nvme-cli)
i/o controllers - kato set to NVME_DEFAULT_KATO
(or any positive int via nvme-cli)
--- drivers/nvme/host/fabrics.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/nvme/host/fabrics.c +4 -1
@@ -632,7 +632,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts, opts->queue_size =NVMF_DEF_QUEUE_SIZE ; opts->nr_io_queues =num_online_cpus (); opts->reconnect_delay =NVMF_DEF_RECONNECT_DELAY ; - opts->kato =NVME_DEFAULT_KATO ; + opts->kato =0 ; opts->duplicate_connect = false; opts->hdr_digest = false; opts->data_digest = false;
@@ -883,6 +883,9 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts, opts->nr_write_queues =0 ; opts->nr_poll_queues =0 ; opts->duplicate_connect = true; + }else { +if (!opts->kato) + opts->kato =NVME_DEFAULT_KATO ; }if (ctrl_loss_tmo <0 ) opts->max_reconnects =-1 ;
Signature · 1 line
2.30.1
Sasha Levin
maintainerPATCH 8/8 nvmet: model_number must be immutable once set
In reply to Sasha LevinFrom: Max Gurtovoy <[email protected]>
[ Upstream commit d9f273b7585c380d7a10d4b3187ddc2d37f2740b ]
In case we have already established connection to nvmf target, it shouldn't be allowed to change the model_number. E.g. if someone will identify ctrl and get model_number of "my_model" later on will change the model_numbel via configfs to "my_new_model" this will break the NVMe specification for "Get Log Page – Persistent Event Log" that refers to Model Number as: "This field contains the same value as reported in the Model Number field of the Identify Controller data structure, bytes 63:24."
Although it doesn't mentioned explicitly that this field can't be changed, we can assume it.
So allow setting this field only once: using configfs or in the first identify ctrl operation.
--- drivers/nvme/target/admin-cmd.c | 36 ++++++++++++++++-------- drivers/nvme/target/configfs.c | 50 +++++++++++++++------------------ drivers/nvme/target/core.c | 2 +- drivers/nvme/target/nvmet.h | 7 +---- 4 files changed, 50 insertions(+), 45 deletions(-)
drivers/nvme/target/admin-cmd.c +25 -11
@@ -319,27 +319,40 @@ static void nvmet_execute_get_log_page(struct nvmet_req *req)nvmet_req_complete (req,NVME_SC_INVALID_FIELD |NVME_SC_DNR ); } -static void nvmet_id_set_model_number (struct nvme_id_ctrl *id, -struct nvmet_subsys *subsys) +static u16 nvmet_set_model_number (struct nvmet_subsys *subsys) { -const char *model =NVMET_DEFAULT_CTRL_MODEL ; -struct nvmet_subsys_model *subsys_model; +u16 status =0 ; + +mutex_lock (&subsys->lock); +if (!subsys->model_number) { + subsys->model_number = +kstrdup (NVMET_DEFAULT_CTRL_MODEL ,GFP_KERNEL ); +if (!subsys->model_number) + status =NVME_SC_INTERNAL ; + } +mutex_unlock (&subsys->lock); -rcu_read_lock (); - subsys_model =rcu_dereference (subsys->model); -if (subsys_model) - model = subsys_model->number; -memcpy_and_pad (id->mn,sizeof (id->mn), model,strlen (model),' ' ); -rcu_read_unlock (); +return status; }static void nvmet_execute_identify_ctrl (struct nvmet_req *req) {struct nvmet_ctrl *ctrl = req->sq->ctrl; +struct nvmet_subsys *subsys = ctrl->subsys;struct nvme_id_ctrl *id;u32 cmd_capsule_size;u16 status =0 ; +/* +* If there is no model number yet, set it now. It will then remain +* stable for the life time of the subsystem. +*/ +if (!subsys->model_number) { + status =nvmet_set_model_number (subsys); +if (status) + goto out; + } + id =kzalloc (sizeof (*id),GFP_KERNEL );if (!id) { status =NVME_SC_INTERNAL ;
@@ -353,7 +366,8 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)memset (id->sn,' ' ,sizeof (id->sn));bin2hex (id->sn, &ctrl->subsys->serial,min (sizeof (ctrl->subsys->serial),sizeof (id->sn) /2 )); -nvmet_id_set_model_number (id, ctrl->subsys); +memcpy_and_pad (id->mn,sizeof (id->mn), subsys->model_number, +strlen (subsys->model_number),' ' );memcpy_and_pad (id->fr,sizeof (id->fr),UTS_RELEASE ,strlen (UTS_RELEASE ),' ' );
drivers/nvme/target/configfs.c +23 -27
81 lines not on this page · raw message
drivers/nvme/target/core.c +1 -1
@@ -1532,7 +1532,7 @@ static void nvmet_subsys_free(struct kref *ref)nvmet_passthru_subsys_free (subsys);kfree (subsys->subsysnqn); -kfree_rcu (subsys->model, rcuhead); +kfree (subsys->model_number);kfree (subsys); }
drivers/nvme/target/nvmet.h +1 -6
@@ -209,11 +209,6 @@ struct nvmet_ctrl {bool pi_support; }; -struct nvmet_subsys_model { -struct rcu_head rcuhead; -char number[]; -}; -struct nvmet_subsys {enum nvme_subsys_type type;
@@ -243,7 +238,7 @@ struct nvmet_subsys {struct config_group namespaces_group;struct config_group allowed_hosts_group; -struct nvmet_subsys_model __rcu *model; +char *model_number;#ifdef CONFIG_NVME_TARGET_PASSTHRU struct nvme_ctrl *passthru_ctrl;
Signature · 1 line
2.30.1