On 27.11.23 10:58, Miquel Raynal wrote:
The intended move from wait_for_completion_*() to wait_for_completion_interruptible_*() was to allow (very) long spi memory transfers to be stopped upon user request instead of freezing the machine forever as the timeout value could now be significantly bigger. However, depending on the user logic, applications can receive many signals for their own "internal" purpose and have nothing to do with the requested kernel operations, hence interrupting spi transfers upon any signal is probably not a wise choice. Instead, let's switch to wait_for_completion_killable_*() to only catch the "important" signals. This was likely the intended behavior anyway.
Actually this seems to work. But aborting a process that has a SPI transfer running causes ugly messages from kernel. This is somehow unexpected: # dd if=/dev/urandom of=/flashdisk/testfile bs=1024 count=512 ^C[ 380.726760] spi-nor spi0.0: spi transfer canceled [ 380.731688] spi-nor spi0.0: SPI transfer failed: -512 [ 380.737141] spi_master spi0: failed to transfer one message from queue [ 380.746495] spi-nor spi0.0: spi transfer canceled [ 380.751549] spi-nor spi0.0: SPI transfer failed: -512 [ 380.756844] spi_master spi0: failed to transfer one message from queue JFFS2 also logs an informational message which is less visible but also may rise eyebrows: [ 380.743904] jffs2: Write of 4164 bytes at 0x0016a47c failed. returned -512, retlen 68 Killing a process is something to expect in certain cases and it should not cause such messages which may create some anxiety that something bad had happened. So maybe the "kill" case should be silent (e.g. level "debug") but without out hiding real errors. But even when hiding the message in the SPI framework it may cause additional messages in upper layers like JFFS2. I'm not sure whether all of this is a good idea. This is something others have to decide. - ron ________________________________ Ce message, ainsi que tous les fichiers joints à ce message, peuvent contenir des informations sensibles et/ ou confidentielles ne devant pas être divulguées. Si vous n'êtes pas le destinataire de ce message (ou que vous recevez ce message par erreur), nous vous remercions de le notifier immédiatement à son expéditeur, et de détruire ce message. Toute copie, divulgation, modification, utilisation ou diffusion, non autorisée, directe ou indirecte, de tout ou partie de ce message, est strictement interdite. This e-mail, and any document attached hereby, may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized, direct or indirect, copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.